Addition of CorrectPlayerZ configuration.
This commit is contained in:
@@ -55,9 +55,12 @@ HeuristicWeight = 20
|
||||
MaxIterations = 3500
|
||||
|
||||
# =================================================================
|
||||
# Other
|
||||
# Other
|
||||
# =================================================================
|
||||
|
||||
# Correct player Z after falling through the ground.
|
||||
CorrectPlayerZ = False
|
||||
|
||||
# When a character falls, he takes damages.
|
||||
# Default: True
|
||||
FallDamage = True
|
||||
|
@@ -972,6 +972,7 @@ public class Config
|
||||
public static int HEURISTIC_WEIGHT;
|
||||
public static int OBSTACLE_MULTIPLIER;
|
||||
public static int MAX_ITERATIONS;
|
||||
public static boolean CORRECT_PLAYER_Z;
|
||||
public static boolean FALL_DAMAGE;
|
||||
public static boolean ALLOW_WATER;
|
||||
|
||||
@@ -2569,6 +2570,7 @@ public class Config
|
||||
OBSTACLE_MULTIPLIER = geoengineConfig.getInt("ObstacleMultiplier", 10);
|
||||
HEURISTIC_WEIGHT = geoengineConfig.getInt("HeuristicWeight", 20);
|
||||
MAX_ITERATIONS = geoengineConfig.getInt("MaxIterations", 3500);
|
||||
CORRECT_PLAYER_Z = geoengineConfig.getBoolean("CorrectPlayerZ", false);
|
||||
FALL_DAMAGE = geoengineConfig.getBoolean("FallDamage", false);
|
||||
ALLOW_WATER = geoengineConfig.getBoolean("AllowWater", false);
|
||||
}
|
||||
|
@@ -15813,6 +15813,14 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
if (_fallingDamageTask != null)
|
||||
{
|
||||
if (Config.CORRECT_PLAYER_Z)
|
||||
{
|
||||
final int nearestZ = GeoEngine.getInstance().getHeightNearest(getX(), getY(), getZ());
|
||||
if (getZ() < nearestZ)
|
||||
{
|
||||
teleToLocation(new Location(getX(), getY(), nearestZ), false);
|
||||
}
|
||||
}
|
||||
_fallingDamageTask.cancel(true);
|
||||
}
|
||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||
|
Reference in New Issue
Block a user