Skip to content

Commit

Permalink
Let's have different climb speed thresholds for ascend and descend.
Browse files Browse the repository at this point in the history
Configurability ... later.
  • Loading branch information
asofold committed Jun 23, 2016
1 parent c9efd7b commit 99df1f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Expand Up @@ -63,7 +63,9 @@ public class Magic {
public static final double GLIDE_HORIZONTAL_GAIN_MAX = GRAVITY_MAX / 2.0;

// Vertical speeds/modifiers.
public static final double climbSpeed = WALK_SPEED * 1.3; // TODO: Check if the factor is needed!
public static final double climbSpeedAscend = 0.119;
public static final double climbSpeedDescend = 0.151;

/**
* Some kind of minimum y descend speed (note the negative sign), for an
* already advanced gliding/falling phase with elytra.
Expand Down
Expand Up @@ -1677,15 +1677,16 @@ private double vDistClimbable(final Player player, final PlayerLocation from, fi
final double jumpHeight = 1.35 + (data.jumpAmplifier > 0 ? (0.6 + data.jumpAmplifier - 1.0) : 0.0);
// TODO: ladders are ground !
// TODO: yDistance < 0.0 ?
if (Math.abs(yDistance) > Magic.climbSpeed) {
final double maxSpeed = yDistance < 0.0 ? Magic.climbSpeedDescend : Magic.climbSpeedAscend;
if (Math.abs(yDistance) > maxSpeed) {
if (from.isOnGround(jumpHeight, 0D, 0D, BlockProperties.F_CLIMBABLE)) {
if (yDistance > data.liftOffEnvelope.getMaxJumpGain(data.jumpAmplifier)+ 0.1) {
tags.add("climbstep");
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - Magic.climbSpeed);
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - maxSpeed);
}
} else {
tags.add("climbspeed");
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - Magic.climbSpeed);
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - maxSpeed);
}
}
if (yDistance > 0) {
Expand Down

0 comments on commit 99df1f6

Please sign in to comment.