[BLEEDING] Re-activate accounting once vertical velocity is used up.

This commit is contained in:
asofold 2015-09-12 23:20:15 +02:00
parent 6d1c56675b
commit 0a5f590801
3 changed files with 31 additions and 5 deletions

View File

@ -34,6 +34,14 @@ public class AxisVelocity {
return !queued.isEmpty();
}
/**
* Queued or active.
* @return
*/
public boolean hasAny() {
return !active.isEmpty() || !queued.isEmpty();
}
/**
* Tick the velocity entries with a moving event, no invalidation takes
* place here. This method uses the defaultFrictionFactor.

View File

@ -605,6 +605,22 @@ public class MovingData extends ACheckData {
return horVel.hasQueued();
}
/**
* Active or queued.
* @return
*/
public boolean hasAnyHorVel() {
return horVel.hasAny();
}
/**
* Active or queued.
* @return
*/
public boolean hasAnyVerVel() {
return verticalFreedom >= 0.001 || verticalVelocityCounter > 0;
}
/**
* Clear active vertical velocity (until recoded, this will remove all vertical velocity).
*/
@ -878,8 +894,10 @@ public class MovingData extends ACheckData {
}
/**
* Refactoring stage: Test if velocity has affected the in-air
* jumping phase. Use clearActiveVerVel to force end velocity jump phase.
* Test if velocity has affected the in-air jumping phase. Keeps set until
* reset on-ground or otherwise. Use clearActiveVerVel to force end velocity
* jump phase. Use hasAnyVerVel() to test if active or queued vertical
* velocity should still be able to influence the in-air jump phase.
*
* @return
*/

View File

@ -806,11 +806,11 @@ public class SurvivalFly extends Check {
// Allow adding 0.
data.vDistAcc.add((float) yDistance);
}
else if (!data.isVelocityJumpPhase()) {
else if (!data.hasAnyVerVel()) {
// Here yDistance can be negative and positive.
if (yDistance != 0D) {
data.vDistAcc.add((float) yDistance);
final double accAboveLimit = verticalAccounting(yDistance, data.vDistAcc ,tags, "vacc");
final double accAboveLimit = verticalAccounting(yDistance, data.vDistAcc ,tags, "vacc" + (data.isVelocityJumpPhase() ? "dirty" : ""));
if (accAboveLimit > vDistanceAboveLimit) {
vDistanceAboveLimit = accAboveLimit;
}
@ -898,7 +898,7 @@ public class SurvivalFly extends Check {
}
else {
// Moving upwards after falling without having touched the ground.
if (!data.isVelocityJumpPhase() && data.bunnyhopDelay < 9 && !(data.fromWasReset && data.sfLastYDist == 0D)) {
if (!data.hasAnyVerVel() && data.bunnyhopDelay < 9 && !(data.fromWasReset && data.sfLastYDist == 0D)) {
// TODO: adjust limit for bunny-hop.
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance));
tags.add("ychincfly");