mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-27 10:57:47 +01:00
SurvivalFly: adjust "swimup" workarounds.
1. After-failure workarounds checking (performance). 2. Hopefully fixes issues with flowing water and stairs.
This commit is contained in:
parent
3f2780fe7d
commit
ea0b26ad19
@ -310,17 +310,24 @@ public class SurvivalFly extends Check {
|
||||
else if (data.verticalFreedom <= 0.001 && from.isInLiquid() && (Math.abs(yDistance) > 0.2 || to.isInLiquid())){
|
||||
// Swimming...
|
||||
if (yDistance >= 0){
|
||||
// TODO: This is more simple to test.
|
||||
// TODO: mediumLiftOff: refine conditions (general) , to should be near water level.
|
||||
if (data.mediumLiftOff == MediumLiftOff.GROUND && !BlockProperties.isLiquid(from.getTypeIdAbove()) && yDistance < 0.5 || !to.isInLiquid() || yDistance <= 0.5 && (toOnGround || data.sfLastYDist - yDistance >= 0.010)){
|
||||
// This is more simple to test.
|
||||
// TODO: Friction in water...
|
||||
vAllowedDistance = swimmingSpeed + 0.5;
|
||||
}
|
||||
else{
|
||||
vAllowedDistance = swimmingSpeed + 0.02;
|
||||
}
|
||||
vDistanceAboveLimit = yDistance - vAllowedDistance;
|
||||
if (vDistanceAboveLimit > 0) tags.add("swimup");
|
||||
if (vDistanceAboveLimit > 0){
|
||||
// Check workarounds.
|
||||
if (yDistance <= 0.5){
|
||||
// TODO: mediumLiftOff: refine conditions (general) , to should be near water level.
|
||||
if (data.mediumLiftOff == MediumLiftOff.GROUND && !BlockProperties.isLiquid(from.getTypeIdAbove()) || !to.isInLiquid() || (toOnGround || data.sfLastYDist - yDistance >= 0.010 || to.isAboveStairs())){
|
||||
vAllowedDistance = swimmingSpeed + 0.5;
|
||||
vDistanceAboveLimit = yDistance - vAllowedDistance;
|
||||
}
|
||||
}
|
||||
|
||||
if (vDistanceAboveLimit > 0){
|
||||
tags.add("swimup");
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: This is more complex, depends on speed of diving into it.
|
||||
// else{
|
||||
@ -383,6 +390,8 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Velocity handling here [concept: set vdistAbove.. almost always]?
|
||||
|
||||
// TODO: This might need max(0, for ydiff)
|
||||
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, to.getY() - data.getSetBackY() - vAllowedDistance);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user