Skip to content

Commit

Permalink
Merge pull request #985 from UserNugget/fix-981
Browse files Browse the repository at this point in the history
Fix #981
  • Loading branch information
AoElite authored Jan 17, 2024
2 parents 70005cf + d516749 commit 2046fb9
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,17 @@ public List<VectorData> applyInputsToVelocityPossibilities(GrimPlayer player, Se
List<VectorData> vectors = new ArrayList<>();

for (VectorData data : possibleVectors) {
controlBoat(player, data.vector);
// Boats ignore forward steering, using raw inputs instead,
// so if a player tries to move in both directions, a packet will
// show that the player is staying, but the boat will move anyway
if (player.vehicleData.vehicleForward == 0) {
Vector vector = data.vector.clone();
controlBoat(player, vector, true);
vector.multiply(player.stuckSpeedMultiplier);
vectors.add(data.returnNewModified(vector, VectorData.VectorType.InputResult));
}

controlBoat(player, data.vector, false);
data.vector.multiply(player.stuckSpeedMultiplier);
vectors.add(data);
}
Expand Down Expand Up @@ -250,18 +260,18 @@ public float getWaterLevelAbove(GrimPlayer player) {
return (float) (l + 1);
}

private void controlBoat(GrimPlayer player, Vector vector) {
private void controlBoat(GrimPlayer player, Vector vector, boolean intermediate) {
float f = 0.0F;
if (player.vehicleData.vehicleHorizontal != 0 && player.vehicleData.vehicleForward == 0) {
if (player.vehicleData.vehicleHorizontal != 0 && (!intermediate && player.vehicleData.vehicleForward == 0)) {
f += 0.005F;
}

//player.boatData.yRot += player.boatData.deltaRotation;
if (player.vehicleData.vehicleForward > 0.1) {
if (intermediate || player.vehicleData.vehicleForward > 0.1) {
f += 0.04F;
}

if (player.vehicleData.vehicleForward < -0.01) {
if (intermediate || player.vehicleData.vehicleForward < -0.01) {
f -= 0.005F;
}

Expand Down

0 comments on commit 2046fb9

Please sign in to comment.