mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-03-12 22:49:31 +01:00
Add special case using two past moves (rare).
This commit is contained in:
parent
37c35cd271
commit
2bb605a497
@ -1027,6 +1027,9 @@ public class SurvivalFly extends Check {
|
||||
else if (data.thisMove.headObstructed || lastMove.toIsValid && lastMove.headObstructed && lastMove.yDistance >= 0.0) {
|
||||
// Head is blocked, thus a shorter move.
|
||||
}
|
||||
else if (lastMove.toIsValid && oddFrictionUp(yDistance, lastMove, data)) {
|
||||
// Odd friction behavior (not necessarily friction).
|
||||
}
|
||||
else {
|
||||
vDistRelVL = true;
|
||||
}
|
||||
@ -1415,6 +1418,33 @@ public class SurvivalFly extends Check {
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Odd friction behavior with moving up (not necessarily friction),
|
||||
* accounting for more than one past move.
|
||||
*
|
||||
* @param yDistance
|
||||
* @param lastMove
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static boolean oddFrictionUp(final double yDistance, final MoveData lastMove, final MovingData data) {
|
||||
// Use past move data for two moves.
|
||||
final MoveData pastMove1 = data.moveData.get(1);
|
||||
if (!lastMove.to.extraPropertiesValid || !pastMove1.toIsValid || !pastMove1.to.extraPropertiesValid) {
|
||||
return false;
|
||||
}
|
||||
final MoveData thisMove = data.thisMove;
|
||||
return
|
||||
// Odd speed decrease bumping into a block sideways somehow, having moved through water.
|
||||
data.sfJumpPhase == 1 && data.liftOffEnvelope == LiftOffEnvelope.LIMIT_NEAR_GROUND
|
||||
&& !thisMove.touchedGround && !thisMove.from.resetCond && !thisMove.to.resetCond // In-air
|
||||
&& !lastMove.touchedGround && lastMove.from.inWater && !lastMove.to.resetCond // Out of water.
|
||||
&& lastMove.yDistance > yDistance + GRAVITY_MAX && yDistance > lastMove.yDistance / 5.0 // Odd too high decrease.
|
||||
&& !pastMove1.touchedGround && !pastMove1.from.resetCond && pastMove1.to.inWater // Into water.
|
||||
&& pastMove1.yDistance > lastMove.yDistance - GRAVITY_MAX // Some speed decrease.
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extended in-air checks for vertical move: y-direction changes and accounting.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user