mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-06-26 06:14:42 +02:00
vehicle.envelope: Minecarts.
The envelope check will need more adaption for false positives, e.g. for skipped moves with boats.
This commit is contained in:
parent
67e7b95901
commit
7df0f74d5d
|
@ -40,7 +40,11 @@ public class MagicVehicle {
|
|||
|
||||
public static final double maxRailsVertical = 0.5;
|
||||
|
||||
public static final double boatGravityMin = Magic.GRAVITY_MIN / 2.0;
|
||||
public static final double boatGravityMin = Magic.GRAVITY_MIN / 3.0;
|
||||
/** Allow lower gravity when falling this fast. */
|
||||
public static final double boatLowGravitySpeed = 0.5;
|
||||
/** Simplistic approach for falling speed more than 0.5. */
|
||||
public static final double boatGravityMinAtSpeed = Magic.GRAVITY_MIN / 12.0;
|
||||
public static final double boatGravityMax = (Magic.GRAVITY_MAX + Magic.GRAVITY_SPAN) / 2.0;
|
||||
/** The speed up to which gravity mechanics roughly work. */
|
||||
public static final double boatVerticalFallTarget = 3.7;
|
||||
|
|
|
@ -58,6 +58,7 @@ public class VehicleEnvelope extends Check {
|
|||
public boolean canRails;
|
||||
public boolean canJump, canStepUpBlock; // TODO: Model as heights?
|
||||
public double maxAscend;
|
||||
public double lowGravitySpeed;
|
||||
|
||||
/** Simplified type, like BOAT, MINECART. */
|
||||
public EntityType simplifiedType; // Not sure can be kept up.
|
||||
|
@ -79,6 +80,7 @@ public class VehicleEnvelope extends Check {
|
|||
checkAscendMuch = checkDescendMuch = true;
|
||||
fromIsSafeMedium = toIsSafeMedium = inAir = false;
|
||||
simplifiedType = null;
|
||||
lowGravitySpeed = MagicVehicle.boatVerticalFallTarget;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -322,6 +324,7 @@ public class VehicleEnvelope extends Check {
|
|||
checkDetails.toIsSafeMedium = true;
|
||||
checkDetails.inAir = false;
|
||||
}
|
||||
checkDetails.lowGravitySpeed = 0.79;
|
||||
}
|
||||
else if (vehicle instanceof Horse) {
|
||||
// TODO: Climbable? -> seems not.
|
||||
|
@ -395,16 +398,16 @@ public class VehicleEnvelope extends Check {
|
|||
// }
|
||||
// Enforce falling speed (vdist) envelope by in-air phase count.
|
||||
// Slow falling (vdist), do not bind to descending in general.
|
||||
// TODO: Distinguish gravity by vehicle type or not (plus max fall target).
|
||||
final double minDescend = -MagicVehicle.boatGravityMin * (checkDetails.canJump ? Math.max(data.sfJumpPhase - MagicVehicle.maxJumpPhaseAscend, 0) : data.sfJumpPhase);
|
||||
final double minDescend = -(thisMove.yDistance < -MagicVehicle.boatGravityMinAtSpeed ? MagicVehicle.boatGravityMinAtSpeed : MagicVehicle.boatGravityMin) * (checkDetails.canJump ? Math.max(data.sfJumpPhase - MagicVehicle.maxJumpPhaseAscend, 0) : data.sfJumpPhase);
|
||||
final double maxDescend = -MagicVehicle.boatGravityMax * data.sfJumpPhase - 0.5;
|
||||
if (data.sfJumpPhase > (checkDetails.canJump ? MagicVehicle.maxJumpPhaseAscend : 1)
|
||||
&& thisMove.yDistance > Math.max(minDescend, -MagicVehicle.boatVerticalFallTarget)) {
|
||||
&& thisMove.yDistance > Math.max(minDescend, -checkDetails.lowGravitySpeed)) {
|
||||
tags.add("slow_fall_vdist");
|
||||
violation = true;
|
||||
}
|
||||
// Fast falling (vdist).
|
||||
else if (data.sfJumpPhase > 1 && thisMove.yDistance < maxDescend) {
|
||||
// TODO: Allow one skipped move per jump phase (1, 2, 3).
|
||||
tags.add("fast_fall_vdist");
|
||||
violation = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user