mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-02 13:57:49 +01:00
Yawrate: add maximum penalty, corect use of minimum.
This commit is contained in:
parent
fc6d15b6fe
commit
c05336e3e4
@ -83,12 +83,14 @@ public class Combined {
|
|||||||
if (total > threshold){
|
if (total > threshold){
|
||||||
// Add time
|
// Add time
|
||||||
final float amount = ((total - threshold) / threshold * 1000f);
|
final float amount = ((total - threshold) / threshold * 1000f);
|
||||||
data.timeFreeze = Math.max(data.timeFreeze, (long) Math.max(cc.yawRatePenaltyFactor * ((float) now + amount) , cc.yawRatePenaltyMin));
|
data.timeFreeze = Math.max(data.timeFreeze, now + (long) Math.min(Math.max(cc.yawRatePenaltyFactor * amount , cc.yawRatePenaltyMin), cc.yawRatePenaltyMax));
|
||||||
// TODO: balance (100 ... 200 ) ?
|
// TODO: balance (100 ... 200 ) ?
|
||||||
if (cc.yawRateImprobable && Improbable.check(player, amount / 100f, now))
|
if (cc.yawRateImprobable && Improbable.check(player, amount / 100f, now))
|
||||||
cancel = true;
|
cancel = true;
|
||||||
}
|
}
|
||||||
if (now < data.timeFreeze) cancel = true;
|
if (now < data.timeFreeze){
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
return cancel;
|
return cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ public class CombinedConfig extends ACheckConfig {
|
|||||||
public final boolean yawRateImprobable;
|
public final boolean yawRateImprobable;
|
||||||
public final float yawRatePenaltyFactor;
|
public final float yawRatePenaltyFactor;
|
||||||
public final int yawRatePenaltyMin;
|
public final int yawRatePenaltyMin;
|
||||||
|
public final int yawRatePenaltyMax;
|
||||||
|
|
||||||
public CombinedConfig(final ConfigFile config) {
|
public CombinedConfig(final ConfigFile config) {
|
||||||
super(config, ConfPaths.COMBINED);
|
super(config, ConfPaths.COMBINED);
|
||||||
@ -109,6 +110,7 @@ public class CombinedConfig extends ACheckConfig {
|
|||||||
yawRateImprobable = config.getBoolean(ConfPaths.COMBINED_YAWRATE_IMPROBABLE);
|
yawRateImprobable = config.getBoolean(ConfPaths.COMBINED_YAWRATE_IMPROBABLE);
|
||||||
yawRatePenaltyFactor = (float) config.getDouble(ConfPaths.COMBINED_YAWRATE_PENALTY_FACTOR);
|
yawRatePenaltyFactor = (float) config.getDouble(ConfPaths.COMBINED_YAWRATE_PENALTY_FACTOR);
|
||||||
yawRatePenaltyMin = config.getInt(ConfPaths.COMBINED_YAWRATE_PENALTY_MIN);
|
yawRatePenaltyMin = config.getInt(ConfPaths.COMBINED_YAWRATE_PENALTY_MIN);
|
||||||
|
yawRatePenaltyMax = config.getInt(ConfPaths.COMBINED_YAWRATE_PENALTY_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -321,6 +321,7 @@ public abstract class ConfPaths {
|
|||||||
private static final String COMBINED_YAWRATE_PENALTY = COMBINED_YAWRATE + "penalty.";
|
private static final String COMBINED_YAWRATE_PENALTY = COMBINED_YAWRATE + "penalty.";
|
||||||
public static final String COMBINED_YAWRATE_PENALTY_FACTOR = COMBINED_YAWRATE_PENALTY + "factor";
|
public static final String COMBINED_YAWRATE_PENALTY_FACTOR = COMBINED_YAWRATE_PENALTY + "factor";
|
||||||
public static final String COMBINED_YAWRATE_PENALTY_MIN = COMBINED_YAWRATE_PENALTY + "minimum";
|
public static final String COMBINED_YAWRATE_PENALTY_MIN = COMBINED_YAWRATE_PENALTY + "minimum";
|
||||||
|
public static final String COMBINED_YAWRATE_PENALTY_MAX = COMBINED_YAWRATE_PENALTY + "maximum";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 888'Y88 ,e, 888 d8
|
* 888'Y88 ,e, 888 d8
|
||||||
|
@ -247,6 +247,7 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
set(ConfPaths.COMBINED_YAWRATE_RATE , 380);
|
set(ConfPaths.COMBINED_YAWRATE_RATE , 380);
|
||||||
set(ConfPaths.COMBINED_YAWRATE_PENALTY_FACTOR, 1.0);
|
set(ConfPaths.COMBINED_YAWRATE_PENALTY_FACTOR, 1.0);
|
||||||
set(ConfPaths.COMBINED_YAWRATE_PENALTY_MIN, 250);
|
set(ConfPaths.COMBINED_YAWRATE_PENALTY_MIN, 250);
|
||||||
|
set(ConfPaths.COMBINED_YAWRATE_PENALTY_MAX, 2000);
|
||||||
set(ConfPaths.COMBINED_YAWRATE_IMPROBABLE, true);
|
set(ConfPaths.COMBINED_YAWRATE_IMPROBABLE, true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user