Reworked node display and worked on DSL interpretation

This commit is contained in:
=
2026-04-29 12:12:58 +02:00
parent 2cc6e31157
commit 2f922b5e04
14 changed files with 270 additions and 54 deletions
+9 -2
View File
@@ -6,9 +6,16 @@ public class CraftNode : ProgramNode
{
DisplayText = "Craft";
}
public override void Execute(Robot robot)
public override bool Execute(Robot robot)
{
GD.Print("Craft");
nextNode.Execute(robot);
if (nextNode != null)
{
return nextNode.Execute(robot);
}
else
{
return true;
}
}
}
+9 -2
View File
@@ -6,9 +6,16 @@ public class HarvestNode : ProgramNode
{
DisplayText = "Harvest";
}
public override void Execute(Robot robot)
public override bool Execute(Robot robot)
{
GD.Print("Harvest");
nextNode.Execute(robot);
if (nextNode != null)
{
return nextNode.Execute(robot);
}
else
{
return true;
}
}
}
+9 -2
View File
@@ -8,9 +8,16 @@ public class MoveNode : ProgramNode
{
DisplayText = "Move";
}
public override void Execute(Robot robot)
public override bool Execute(Robot robot)
{
robot.Position = targetPosition;
nextNode.Execute(robot);
if (nextNode != null)
{
return nextNode.Execute(robot);
}
else
{
return true;
}
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ public abstract class ProgramNode
}
public abstract void Execute(Robot robot);
public abstract bool Execute(Robot robot);
public void LinkNode(ProgramNode nextNode)
{
this.nextNode = nextNode;