Something against criticals.

NoFall will now reset fall distances to 0 if the player walks on ground
(configurable: anticriticals).
This commit is contained in:
asofold 2013-02-19 02:25:49 +01:00
parent 2304abd6e8
commit 4a2dfc853e
4 changed files with 16 additions and 1 deletions

View File

@ -85,6 +85,8 @@ public class MovingConfig extends ACheckConfig {
public final boolean noFallViolationReset;
/** Reset data on tp. */
public final boolean noFallTpReset;
/** Reset fd to 0 if on ground (dealdamage only). */
public final boolean noFallAntiCriticals;
public final ActionList noFallActions;
public final boolean passableCheck;
@ -149,6 +151,7 @@ public class MovingConfig extends ACheckConfig {
noFallDealDamage = data.getBoolean(ConfPaths.MOVING_NOFALL_DEALDAMAGE);
noFallViolationReset = data.getBoolean(ConfPaths.MOVING_NOFALL_RESETONVL);
noFallTpReset = data.getBoolean(ConfPaths.MOVING_NOFALL_RESETONTP);
noFallAntiCriticals = data.getBoolean(ConfPaths.MOVING_NOFALL_ANTICRITICALS);
noFallActions = data.getOptimizedActionList(ConfPaths.MOVING_NOFALL_ACTIONS, Permissions.MOVING_NOFALL);
passableCheck = data.getBoolean(ConfPaths.MOVING_PASSABLE_CHECK);

View File

@ -154,12 +154,22 @@ public class NoFall extends Check {
// TODO: fall distance might be behind (!)
// TODO: should be the data.noFallMaxY be counted in ?
data.noFallFallDistance = Math.max(player.getFallDistance(), data.noFallFallDistance);
final float mcFallDistance = player.getFallDistance(); // Note: it has to be fetched here.
data.noFallFallDistance = Math.max(mcFallDistance, data.noFallFallDistance);
// Add y distance.
if (!toReset && !toOnGround && yDiff < 0){
data.noFallFallDistance -= yDiff;
}
else if (cc.noFallDealDamage && cc.noFallAntiCriticals && (toReset || toOnGround || (fromReset || fromOnGround || data.noFallAssumeGround) && yDiff >= 0)){
// TODO: Only use this if dealdamage is true ?
if (data.noFallFallDistance > 0){
data.noFallFallDistance = 0;
}
if (mcFallDistance > 0){
player.setFallDistance(0);
}
}
if (cc.debug) System.out.println(player.getName() + " NoFall: mc=" + StringUtil.fdec3.format(player.getFallDistance()) +" / nf=" + StringUtil.fdec3.format(data.noFallFallDistance) + (oldNFDist < data.noFallFallDistance ? " (+" + StringUtil.fdec3.format(data.noFallFallDistance - oldNFDist) + ")" : ""));

View File

@ -489,6 +489,7 @@ public abstract class ConfPaths {
public static final String MOVING_NOFALL_DEALDAMAGE = MOVING_NOFALL + "dealdamage";
public static final String MOVING_NOFALL_RESETONVL = MOVING_NOFALL + "resetonviolation";
public static final String MOVING_NOFALL_RESETONTP = MOVING_NOFALL + "resetonteleport";
public static final String MOVING_NOFALL_ANTICRITICALS = MOVING_NOFALL + "anticriticals";
public static final String MOVING_NOFALL_ACTIONS = MOVING_NOFALL + "actions";
public static final String MOVING_PASSABLE = MOVING + "passable.";

View File

@ -383,6 +383,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_NOFALL_DEALDAMAGE, true);
set(ConfPaths.MOVING_NOFALL_RESETONVL, false);
set(ConfPaths.MOVING_NOFALL_RESETONTP, false);
set(ConfPaths.MOVING_NOFALL_ANTICRITICALS, true);
set(ConfPaths.MOVING_NOFALL_ACTIONS, "log:nofall:0:5:if cancel vl>30 log:nofall:0:5:icf cancel");
set(ConfPaths.MOVING_PASSABLE_CHECK, true);