Addition of CorrectPlayerZ configuration.

This commit is contained in:
MobiusDevelopment
2021-01-08 00:35:14 +00:00
parent 4ace5904ce
commit d0e573e2a2
63 changed files with 351 additions and 116 deletions

View File

@@ -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

View File

@@ -938,6 +938,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;
@@ -2504,6 +2505,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);
}

View File

@@ -15447,6 +15447,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(() ->