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; return PlanResult.EMPTY;
Vector position = getPosition(); Vector position = getPosition();
if(position.getY() == plannedPosition.getY()) if(position.getY() >= plannedPosition.getY())
return PlanResult.EMPTY; return PlanResult.EMPTY;
boolean falling = getEntity().getVelocity().getY() < 0; if(pathplanner.isLadder(plannedPosition) && getEntity().getVelocity().getY() >= -0.23)
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
return PlanResult.EMPTY; return PlanResult.EMPTY;
pathplanner.removePosition(plannedPosition); //obviously not walkable anymore 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)))); return new PlanResult(1000.0, () -> setTNT(position.subtract(new Vector(0, 1.0, 0))));
} else { } else {
position.setX(position.getBlockX() + 0.5); position.setX(position.getBlockX() + 0.5);
position.setZ(position.getBlockZ() + 0.5); position.setZ(position.getBlockZ() + 0.5);
pathplanner.addPosition(position); pathplanner.addPosition(position);
setPlannedPosition(position);
return PlanResult.EMPTY; return PlanResult.EMPTY;
} }
} }