Fixed load block command not arriving on target
This commit is contained in:
@@ -29,6 +29,8 @@ public class UnitCommand extends MappableContent{
|
|||||||
public boolean drawTarget = false;
|
public boolean drawTarget = false;
|
||||||
/** Whether to reset targets when switching to or from this command. */
|
/** Whether to reset targets when switching to or from this command. */
|
||||||
public boolean resetTarget = true;
|
public boolean resetTarget = true;
|
||||||
|
/** */
|
||||||
|
public boolean exactArrival = false;
|
||||||
/** Key to press for this command. */
|
/** Key to press for this command. */
|
||||||
public @Nullable Binding keybind = null;
|
public @Nullable Binding keybind = null;
|
||||||
|
|
||||||
@@ -101,6 +103,7 @@ public class UnitCommand extends MappableContent{
|
|||||||
switchToMove = false;
|
switchToMove = false;
|
||||||
drawTarget = true;
|
drawTarget = true;
|
||||||
resetTarget = false;
|
resetTarget = false;
|
||||||
|
exactArrival = true;
|
||||||
}};
|
}};
|
||||||
unloadPayloadCommand = new UnitCommand("unloadPayload", "download", Binding.unit_command_unload_payload, null){{
|
unloadPayloadCommand = new UnitCommand("unloadPayload", "download", Binding.unit_command_unload_payload, null){{
|
||||||
switchToMove = false;
|
switchToMove = false;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class CommandAI extends AIController{
|
|||||||
/** Stance, usually related to firing mode. */
|
/** Stance, usually related to firing mode. */
|
||||||
public UnitStance stance = UnitStance.shoot;
|
public UnitStance stance = UnitStance.shoot;
|
||||||
/** Current command this unit is following. */
|
/** Current command this unit is following. */
|
||||||
public @Nullable UnitCommand command;
|
public UnitCommand command = UnitCommand.moveCommand;
|
||||||
/** Current controller instance based on command. */
|
/** Current controller instance based on command. */
|
||||||
protected @Nullable AIController commandController;
|
protected @Nullable AIController commandController;
|
||||||
/** Last command type assigned. Used for detecting command changes. */
|
/** Last command type assigned. Used for detecting command changes. */
|
||||||
@@ -291,7 +291,7 @@ public class CommandAI extends AIController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//reached destination, end pathfinding
|
//reached destination, end pathfinding
|
||||||
if(attackTarget == null && unit.within(vecMovePos, Math.max(5f, unit.hitSize / 2f))){
|
if(attackTarget == null && unit.within(vecMovePos, command.exactArrival && commandQueue.size == 0 ? 1f : Math.max(5f, unit.hitSize / 2f))){
|
||||||
finishPath();
|
finishPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user