Added cooldown to robots not executing scripts, fixed movement bug where robots don't execute script if on the same tile.

This commit is contained in:
2026-05-11 20:09:41 +02:00
parent 9a35a11df4
commit 979595959b
2 changed files with 15 additions and 1 deletions
+7 -1
View File
@@ -12,10 +12,16 @@ public class MoveNode : ProgramNode
}
public override NodeResult Execute(Robot robot, double delta)
{
pathPoints ??= new List<Vector3>(Pathfinding.GetPath(Pathfinding.GetClosestStartPoint(robot.Position), targetPosition));
Vector3I closestPosition = Pathfinding.GetClosestStartPoint(robot.Position);
pathPoints ??= new List<Vector3>(Pathfinding.GetPath(closestPosition, targetPosition));
if (pathPoints.Count <= 0)
{
if ((closestPosition - targetPosition).Length() == 0)
{
lastExecutionMessage = "";
return NodeResult.SUCCESS;
}
lastExecutionMessage = "No path available";
return NodeResult.FAILURE;
}