Skip to content

Commit

Permalink
Moving: Only set sfDirty flag if velocity is really used.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Mar 11, 2013
1 parent ea0b26a commit 186eec6
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -974,7 +974,9 @@ public void onPlayerVelocity(final PlayerVelocityEvent event) {
if (cc.debug) System.out.println(event.getPlayer().getName() + " new velocity: " + velocity);

double newVal = velocity.getY();
boolean used = false;
if (newVal >= 0D) {
used = true;
if (data.verticalFreedom <= 0.001 && data.verticalVelocityCounter >= 0){
data.verticalVelocity = 0;
}
Expand All @@ -986,6 +988,7 @@ public void onPlayerVelocity(final PlayerVelocityEvent event) {

newVal = Math.sqrt(velocity.getX() * velocity.getX() + velocity.getZ() * velocity.getZ());
if (newVal > 0D) {
used = true;
final Velocity vel = new Velocity(newVal, cc.velocityActivationCounter, 1 + (int) Math.round(newVal * 10.0));
data.addHorizontalVelocity(vel);
// data.horizontalFreedom += newVal;
Expand All @@ -994,7 +997,9 @@ public void onPlayerVelocity(final PlayerVelocityEvent event) {
}

// Set dirty flag here.
data.sfDirty = true;
if (used){
data.sfDirty = true;
}

// TODO: clear accounting here ?
}
Expand Down

0 comments on commit 186eec6

Please sign in to comment.