[Experimental] Add "strictinvalidation" flag to velocity config.

This allows triggering the invalidation for the active horizontal
velocity at half of the allowed speed instead of full, in case of
setting the flag to false.
This commit is contained in:
asofold 2013-05-01 22:44:19 +02:00
parent 5e8cf481a1
commit 3e96d7d9a2
4 changed files with 6 additions and 1 deletions

View File

@ -121,6 +121,7 @@ public class MovingConfig extends ACheckConfig {
public final int velocityGraceTicks;
public final int velocityActivationCounter;
public final int velocityActivationTicks;
public final boolean velocityStrictInvalidation;
public final double noFallyOnGround;
public final double yOnGround;
public final double yStep;
@ -191,6 +192,7 @@ public class MovingConfig extends ACheckConfig {
velocityGraceTicks = config.getInt(ConfPaths.MOVING_VELOCITY_GRACETICKS);
velocityActivationCounter = config.getInt(ConfPaths.MOVING_VELOCITY_ACTIVATIONCOUNTER);
velocityActivationTicks = config.getInt(ConfPaths.MOVING_VELOCITY_ACTIVATIONTICKS);
velocityStrictInvalidation = config.getBoolean(ConfPaths.MOVING_VELOCITY_STRICTINVALIDATION);
yOnGround = config.getDouble(ConfPaths.MOVING_YONGROUND, 0.001, 2.0, 0.0626); // sqrt(1/256), see: NetServerHandler.
noFallyOnGround = config.getDouble(ConfPaths.MOVING_NOFALL_YONGROUND, 0.001, 2.0, yOnGround);
// ystep is set to 0.45 by default, for stairs / steps.

View File

@ -549,7 +549,8 @@ public class SurvivalFly extends Check {
}
// Check removal of active horizontal velocity.
if (hDistance <= hAllowedDistance){ // TODO: Check conditions etc.
if (hDistance <= (cc.velocityStrictInvalidation ? hAllowedDistance : hAllowedDistance / 2.0)){
// TODO: Should there be other side conditions?
// Invalidate used horizontal velocity.
// System.out.println("*** INVALIDATE ON SPEED");
data.hVelActive.clear();

View File

@ -565,6 +565,7 @@ public abstract class ConfPaths {
public static final String MOVING_VELOCITY_GRACETICKS = MOVING_VELOCITY + "graceticks";
public static final String MOVING_VELOCITY_ACTIVATIONCOUNTER = MOVING_VELOCITY + "activationcounter";
public static final String MOVING_VELOCITY_ACTIVATIONTICKS = MOVING_VELOCITY + "activationticks";
public static final String MOVING_VELOCITY_STRICTINVALIDATION = MOVING_VELOCITY + "strictinvalidation";
public static final String MOVING_NOFALL_YONGROUND = MOVING_NOFALL + "yonground";
public static final String MOVING_YONGROUND = MOVING + "yonground";

View File

@ -443,6 +443,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_VELOCITY_GRACETICKS, 20);
set(ConfPaths.MOVING_VELOCITY_ACTIVATIONCOUNTER, 80);
set(ConfPaths.MOVING_VELOCITY_ACTIVATIONTICKS, 140);
set(ConfPaths.MOVING_VELOCITY_STRICTINVALIDATION, true);
// General.
set(ConfPaths.MOVING_TEMPKICKILLEGAL, true);