diff --git a/Scripts/DSL/Nodes/MoveNode.cs b/Scripts/DSL/Nodes/MoveNode.cs index 127f921..c21b6a9 100644 --- a/Scripts/DSL/Nodes/MoveNode.cs +++ b/Scripts/DSL/Nodes/MoveNode.cs @@ -12,10 +12,16 @@ public class MoveNode : ProgramNode } public override NodeResult Execute(Robot robot, double delta) { - pathPoints ??= new List(Pathfinding.GetPath(Pathfinding.GetClosestStartPoint(robot.Position), targetPosition)); + Vector3I closestPosition = Pathfinding.GetClosestStartPoint(robot.Position); + pathPoints ??= new List(Pathfinding.GetPath(closestPosition, targetPosition)); if (pathPoints.Count <= 0) { + if ((closestPosition - targetPosition).Length() == 0) + { + lastExecutionMessage = ""; + return NodeResult.SUCCESS; + } lastExecutionMessage = "No path available"; return NodeResult.FAILURE; } diff --git a/Scripts/Gameplay/Robots/Robot.cs b/Scripts/Gameplay/Robots/Robot.cs index 9f7c8c1..8dfadb6 100644 --- a/Scripts/Gameplay/Robots/Robot.cs +++ b/Scripts/Gameplay/Robots/Robot.cs @@ -112,6 +112,14 @@ public partial class Robot : Node3D currentMessage = "No script executing"; } + else + { + CoolDown( + delta, + GameData.robotStats.GetCoolingRate(IdleHeatLossPerSecond) + * TypeStats.CoolingMultiplier + ); + } Visible = Math.Round(Math.Abs(Position.Y / GameData.tileHeight), 0) == GameData.visibleLayer; }