SteamWar/FightSystem
Archiviert
13
1

Emergency Movement fixes
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2024-01-17 21:15:38 +01:00
Ursprung 6fa873204b
Commit 6177050548

Datei anzeigen

@ -134,30 +134,20 @@ public class LixfelAI extends AI {
return PlanResult.EMPTY;
Vector position = getPosition();
if(position.getY() == plannedPosition.getY())
if(position.getY() >= plannedPosition.getY())
return PlanResult.EMPTY;
boolean falling = getEntity().getVelocity().getY() < 0;
if(position.getY() > plannedPosition.getY()) {
if(!falling) { //Update grid accordingly
pathplanner.removePosition(plannedPosition);
position.setX(position.getBlockX() + 0.5);
position.setZ(position.getBlockZ() + 0.5);
pathplanner.addPosition(position);
}
return PlanResult.EMPTY;
}
if(pathplanner.isLadder(plannedPosition) && getEntity().getVelocity().getY() >= -0.23) //alternative measure: falling speed
if(pathplanner.isLadder(plannedPosition) && getEntity().getVelocity().getY() >= -0.23)
return PlanResult.EMPTY;
pathplanner.removePosition(plannedPosition); //obviously not walkable anymore
if(falling) {
if(!getEntity().isOnGround()) {
return new PlanResult(1000.0, () -> setTNT(position.subtract(new Vector(0, 1.0, 0))));
} else {
position.setX(position.getBlockX() + 0.5);
position.setZ(position.getBlockZ() + 0.5);
pathplanner.addPosition(position);
setPlannedPosition(position);
return PlanResult.EMPTY;
}
}