mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-03-11 06:03:34 +01:00
Corrections and adaptions for moving.vehicle.envelope and boats.
* Set-back handling: Use the last safe-medium set back for now. * Parameters/magic.
This commit is contained in:
parent
ab5ca5c9dc
commit
25499d2f0e
@ -42,7 +42,7 @@ public class MagicVehicle {
|
||||
public static final double maxAscend = 0.27;
|
||||
|
||||
public static final double boatGravityMin = Magic.GRAVITY_MIN / 2.0;
|
||||
public static final double boatGravityMax = Magic.GRAVITY_MAX + Magic.GRAVITY_SPAN;
|
||||
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;
|
||||
public static final double boatMaxBackToSurfaceAscend = 3.25;
|
||||
@ -75,11 +75,12 @@ public class MagicVehicle {
|
||||
private static boolean oddInAirDescend(final VehicleMoveData thisMove, final double minDescend, final double maxDescend, final MovingData data) {
|
||||
// TODO: Guard by past move tracking, instead of minDescend and maxDescend.
|
||||
// (Try individual if this time, let JIT do the rest.)
|
||||
if (thisMove.vDistance < 2.0 * minDescend && thisMove.vDistance > 2.0 * maxDescend
|
||||
if (data.sfJumpPhase > 54 && thisMove.vDistance < 2.0 * minDescend && thisMove.vDistance > 2.0 * maxDescend
|
||||
// TODO: Past move tracking.
|
||||
// TODO: Fall distances?
|
||||
&& data.ws.use(WRPT.W_M_V_ENV_INAIR_SKIP)
|
||||
) {
|
||||
// (In-air count usually > 60.)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -84,12 +84,12 @@ public class VehicleEnvelope extends Check {
|
||||
final ViolationData vd = new ViolationData(this, player, data.vehicleEnvelopeVL, 1, cc.vehicleEnvelopeActions);
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
if (executeActions(vd).willCancel()) {
|
||||
return data.vehicleSetBacks.getValidMidTermEntry();
|
||||
return data.vehicleSetBacks.getValidSafeMediumEntry();
|
||||
}
|
||||
}
|
||||
else {
|
||||
data.vehicleEnvelopeVL *= 0.99; // Random cool down for now.
|
||||
data.vehicleSetBacks.setSafeMediumEntry(to); // TODO: Set only if it is safe to set. Set on monitor rather.
|
||||
// Do not set a set-back here.
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -211,6 +211,7 @@ public class VehicleEnvelope extends Check {
|
||||
final boolean toIsSafeMedium = to.isInWater() || to.isOnGround() || to.isInWeb();
|
||||
final boolean inAir = !fromIsSafeMedium && !toIsSafeMedium;
|
||||
// TODO: Split code to methods.
|
||||
// TODO: Get extended liquid specs (allow confine to certain flags, here: water). Contains info if water is only flowing down, surface properties (non liquid blocks?), still water.
|
||||
if (from.isInWeb()) {
|
||||
// TODO: Check anything?
|
||||
if (data.debug) {
|
||||
@ -276,11 +277,11 @@ public class VehicleEnvelope extends Check {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// Slow falling (vdist).
|
||||
// Enforce falling speed (vdist) envelope by in-air phase count.
|
||||
// Slow falling (vdist), do not bind to descending in general.
|
||||
final double minDescend = -MagicVehicle.boatGravityMin * data.sfJumpPhase;
|
||||
final double maxDescend = -MagicVehicle.boatGravityMax * data.sfJumpPhase - 0.5;
|
||||
if (data.sfJumpPhase > 1 && thisMove.vDistance > -MagicVehicle.boatVerticalFallTarget
|
||||
&& thisMove.vDistance > minDescend) {
|
||||
if (data.sfJumpPhase > 1 && thisMove.vDistance > Math.max(minDescend, -MagicVehicle.boatVerticalFallTarget)) {
|
||||
tags.add("slow_fall_vdist");
|
||||
violation = true;
|
||||
}
|
||||
@ -295,6 +296,10 @@ public class VehicleEnvelope extends Check {
|
||||
violation = false;
|
||||
checkDescendMuch = checkAscendMuch = false; // (Full envelope has been checked.)
|
||||
}
|
||||
if (data.debug) {
|
||||
debugDetails.add("minDescend: " + minDescend);
|
||||
debugDetails.add("maxDescend: " + maxDescend);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -302,7 +307,8 @@ public class VehicleEnvelope extends Check {
|
||||
if (data.debug) {
|
||||
debugDetails.add("?-?");
|
||||
}
|
||||
// TODO: Something needed here?
|
||||
// TODO: Clearly overlaps other cases.
|
||||
// TODO: Skipped vehicle move events happen here as well (...).
|
||||
if (!toIsSafeMedium) {
|
||||
// TODO: At least do something here?
|
||||
}
|
||||
@ -340,8 +346,6 @@ public class VehicleEnvelope extends Check {
|
||||
data.ws.resetConditions(WRPT.G_RESET_NOTINAIR);
|
||||
}
|
||||
data.vehicleSetBacks.setLastMoveEntry(to);
|
||||
// TODO: Workaround - reset moving set-backs.
|
||||
|
||||
}
|
||||
|
||||
return violation;
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.util.Vector;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.location.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
|
||||
|
||||
public class TeleportUtil {
|
||||
|
||||
@ -65,7 +66,8 @@ public class TeleportUtil {
|
||||
data.prepareSetBack(location);
|
||||
playerTeleported = player.teleport(LocUtil.clone(location));
|
||||
data.resetTeleported(); // Just in case.
|
||||
// TODO: Consider resetting player set-backs.
|
||||
// Workarounds.
|
||||
data.ws.resetConditions(WRPT.G_RESET_NOTINAIR); // Allow re-use of certain workarounds. Hack/shouldbedoneelsewhere?
|
||||
player.setVelocity(new Vector(0.0, 0.0, 0.0)); // TODO: Likely not relevant, should remove.
|
||||
// TODO: Magic 1.0, plus is this valid with horse, dragon...
|
||||
if (playerIsPassenger && playerTeleported && vehicleTeleported && player.getLocation().distance(vehicle.getLocation(useLoc)) < 1.0) {
|
||||
|
Loading…
Reference in New Issue
Block a user