mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-06-26 06:14:42 +02:00
[BLEEDING] Pigs can climb.
Known false positives: * Transition to air / blocks above (Step up / other).
This commit is contained in:
parent
b35805adc8
commit
f2d0123ee0
|
@ -47,6 +47,9 @@ public class MagicVehicle {
|
|||
/** Max ascending in-air jump phase. */
|
||||
public static final int maxJumpPhaseAscend = 8;
|
||||
|
||||
/** Absolute max. speed. */
|
||||
public static final double climbSpeed = 0.1625;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param thisMove
|
||||
|
|
|
@ -54,7 +54,8 @@ public class VehicleEnvelope extends Check {
|
|||
*/
|
||||
public class CheckDetails {
|
||||
|
||||
public boolean canJump, canStepUpBlock;
|
||||
public boolean canClimb;
|
||||
public boolean canJump, canStepUpBlock; // TODO: Model as heights?
|
||||
public double maxAscend;
|
||||
|
||||
/** Simplified type, like BOAT, MINECART. */
|
||||
|
@ -72,7 +73,7 @@ public class VehicleEnvelope extends Check {
|
|||
public boolean inAir;
|
||||
|
||||
public void reset() {
|
||||
canJump = canStepUpBlock = false;
|
||||
canClimb = canJump = canStepUpBlock = false;
|
||||
maxAscend = 0.0;
|
||||
checkAscendMuch = checkDescendMuch = true;
|
||||
fromIsSafeMedium = toIsSafeMedium = inAir = false;
|
||||
|
@ -180,6 +181,14 @@ public class VehicleEnvelope extends Check {
|
|||
// TODO: Enforce not ascending ?
|
||||
// TODO: max speed.
|
||||
}
|
||||
else if (checkDetails.canClimb && thisMove.from.onClimbable) {
|
||||
// TODO: Order.
|
||||
checkDetails.checkAscendMuch = checkDetails.checkDescendMuch = false;
|
||||
if (Math.abs(thisMove.yDistance) > MagicVehicle.climbSpeed) {
|
||||
violation = true;
|
||||
tags.add("climbspeed");
|
||||
}
|
||||
}
|
||||
else if (thisMove.from.inWater && thisMove.to.inWater) {
|
||||
// Default in-medium move.
|
||||
if (data.debug) {
|
||||
|
@ -307,7 +316,7 @@ public class VehicleEnvelope extends Check {
|
|||
}
|
||||
}
|
||||
else if (vehicle instanceof Horse) {
|
||||
// TODO: Climbable?
|
||||
// TODO: Climbable? -> seems not.
|
||||
checkDetails.simplifiedType = EntityType.HORSE;
|
||||
checkDetails.canJump = checkDetails.canStepUpBlock = true;
|
||||
}
|
||||
|
@ -316,6 +325,7 @@ public class VehicleEnvelope extends Check {
|
|||
checkDetails.simplifiedType = EntityType.PIG;
|
||||
checkDetails.canJump = false;
|
||||
checkDetails.canStepUpBlock = true;
|
||||
checkDetails.canClimb = true;
|
||||
}
|
||||
else {
|
||||
checkDetails.simplifiedType = thisMove.vehicleType;
|
||||
|
@ -326,6 +336,17 @@ public class VehicleEnvelope extends Check {
|
|||
if (checkDetails.canJump) {
|
||||
checkDetails.maxAscend = 1.0; // Coarse envelope. Actual lift off gain should be checked on demand.
|
||||
}
|
||||
// Climbable
|
||||
if (checkDetails.canClimb) {
|
||||
if (thisMove.from.onClimbable) {
|
||||
checkDetails.fromIsSafeMedium = true;
|
||||
checkDetails.inAir = false;
|
||||
}
|
||||
if (thisMove.to.onClimbable) {
|
||||
checkDetails.toIsSafeMedium = true;
|
||||
checkDetails.inAir = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user