[Bleeding] Adjust velocity handling.

Mainly horizontal velocity. Should reduce abuse potential for small
amounts of velocity added. Repeated adding of velocity might pose
problems, still.
This commit is contained in:
asofold 2013-02-03 21:37:00 +01:00
parent 5711a261a0
commit d897c99a23
2 changed files with 6 additions and 4 deletions

View File

@ -524,8 +524,10 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
// Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do
// general data modifications one for each event.
if (data.horizontalVelocityCounter > 0D)
data.horizontalVelocityCounter--;
if (data.horizontalVelocityCounter > 0D){
data.horizontalVelocityCounter--;
data.horizontalFreedom -= 0.09;
}
else if (data.horizontalFreedom > 0.001D)
data.horizontalFreedom *= 0.90D;
@ -890,7 +892,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
newVal = Math.sqrt(velocity.getX() * velocity.getX() + velocity.getZ() * velocity.getZ());
if (newVal > 0D) {
data.horizontalFreedom += newVal;
data.horizontalVelocityCounter = 50; // Math.min(100, (int) Math.round(newVal * 10.0)); // 30;
data.horizontalVelocityCounter = Math.min(100, (int) Math.round(newVal * 10.0)); // 30;
}
// Set dirty flag here.

View File

@ -411,7 +411,7 @@ public class SurvivalFly extends Check {
data.sfJumpPhase = 0;
data.clearAccounting();
// TODO: Experimental: reset velocity.
if (toOnGround || Math.abs(yDistance) < 0.18){
if (toOnGround && yDistance < 0 || Math.abs(yDistance) < 0.09){
data.verticalVelocityCounter = 0;
data.verticalFreedom = 0;
data.verticalVelocity = 0;