From 0a5f59080108e9af67c73259f2d28415d3507f2f Mon Sep 17 00:00:00 2001 From: asofold Date: Sat, 12 Sep 2015 23:20:15 +0200 Subject: [PATCH] [BLEEDING] Re-activate accounting once vertical velocity is used up. --- .../checks/moving/AxisVelocity.java | 8 +++++++ .../nocheatplus/checks/moving/MovingData.java | 22 +++++++++++++++++-- .../checks/moving/SurvivalFly.java | 6 ++--- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/AxisVelocity.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/AxisVelocity.java index 77a7dfa6..32a70ac0 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/AxisVelocity.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/AxisVelocity.java @@ -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. diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.java index 2af795df..f45a7082 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.java @@ -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 */ diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index 487c3c9d..ddb4a7c7 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -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");