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

@ -890,16 +890,10 @@ public class Config
// --------------------------------------------------
// GeoEngine
// --------------------------------------------------
/** Geodata */
public static String GEODATA_PATH;
public static int COORD_SYNCHRONIZE;
/** Path checking */
public static int PART_OF_CHARACTER_HEIGHT;
public static int MAX_OBSTACLE_HEIGHT;
/** Path finding */
public static boolean PATHFINDING;
public static String PATHFIND_BUFFERS;
public static int BASE_WEIGHT;
@ -907,6 +901,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;
/** Attribute System */
public static int S_WEAPON_STONE;
@ -2406,6 +2401,7 @@ public class Config
OBSTACLE_MULTIPLIER = GeoEngine.getInt("ObstacleMultiplier", 10);
HEURISTIC_WEIGHT = GeoEngine.getInt("HeuristicWeight", 20);
MAX_ITERATIONS = GeoEngine.getInt("MaxIterations", 3500);
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
// Load AllowedPlayerRaces config file (if exists)
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);

View File

@ -12523,6 +12523,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));
}
}
_fallingDamageTask.cancel(true);
}
_fallingDamageTask = ThreadPool.schedule(() ->