From b49df0412049f2f2d385107bddc9173ed62f050f Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 17 Jul 2013 23:22:38 +0200 Subject: [PATCH] Comments. Hint at per-velocity friction factor. Could be used to add short term velocity that does not decrease. However it can't replace extra-buffer due to special invalidation conditions. --- .../nocheatplus/checks/fight/FightListener.java | 3 ++- .../neatmonster/nocheatplus/checks/moving/MovingData.java | 3 ++- .../fr/neatmonster/nocheatplus/checks/moving/Velocity.java | 7 ++++++- .../java/fr/neatmonster/nocheatplus/logging/DebugUtil.java | 3 +-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java index d977b7ce..01c89f43 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java @@ -231,7 +231,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{ final double hDist = TrigUtil.distance(loc.getX(), loc.getZ(), mData.fromX, mData.fromZ) ; if (hDist >= 0.23 && mData.sfHorizontalBuffer > 0.5 && MovingListener.shouldCheckSurvivalFly(player, mData, MovingConfig.getConfig(player))){ // Allow extra consumption with buffer. - mData.sfHBufExtra = 7; + // TODO: Add to normal buffer or add velocity entry. +// mData.sfHBufExtra = 7; if (cc.debug && BuildParameters.debugLevel > 0){ System.out.println(player.getName() + " attacks, hDist to last from: " + hDist + " | targetdist=" + TrigUtil.distance(loc.getX(), loc.getZ(), targetLoc.getX(), targetLoc.getZ()) + " | sprinting=" + player.isSprinting() + " | food=" + player.getFoodLevel() +" | hbuf=" + mData.sfHorizontalBuffer); } 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 633ec2d7..61a8deab 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 @@ -503,11 +503,12 @@ public class MovingData extends ACheckData { */ public void velocityTick(){ // Decrease counts for active. + // TODO: Actual friction. Could pass as an argument (special value for not to be used). // TODO: Consider removing already invalidated here. for (final Velocity vel : hVelActive){ vel.valCount --; vel.sum += vel.value; - vel.value *= 0.93; // TODO: Actual friction. + vel.value *= 0.93; // vel.frictionFactor; // (Altered entries should be kept, since they get used right away.) } // Decrease counts for queued. diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/Velocity.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/Velocity.java index 4e2a56e1..4ee29c84 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/Velocity.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/Velocity.java @@ -10,17 +10,22 @@ import fr.neatmonster.nocheatplus.utilities.TickTask; */ public class Velocity { +// private static final double defaultFrictionFactor = 0.93; + /** Tick at which velocity got added. */ public final int tick; /** The amount of velocity, decreasing with use. */ public double value; + +// /** Factor for decrease of value */ +// public double frictionFactor = defaultFrictionFactor; + /** "Some sum" for general purpose. *
  • For vertical entries this is used to alter the allowed y-distance to the set-back point.
  • */ public double sum; - /////////////////////////// // Activation conditions. /////////////////////////// diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/DebugUtil.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/DebugUtil.java index 592b4cda..3578d63d 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/DebugUtil.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/DebugUtil.java @@ -175,8 +175,7 @@ public class DebugUtil { if (BuildParameters.debugLevel > 0){ try{ // TODO: Check backwards compatibility (1.4.2). Remove try-catch - - builder.append("\n(walkspeed=" + player.getWalkSpeed() + " flyspeed=" + player.getFlySpeed() + ")"); + builder.append("\n(walkspeed=" + player.getWalkSpeed() + " flyspeed=" + player.getFlySpeed() + ")"); } catch (Throwable t){} if (player.isSprinting()){ builder.append("(sprinting)");