diff --git a/Prefabs/DSL/CraftNode.tscn b/Prefabs/DSL/CraftNode.tscn index ef6e6d3..6ee81bc 100644 --- a/Prefabs/DSL/CraftNode.tscn +++ b/Prefabs/DSL/CraftNode.tscn @@ -1,69 +1,39 @@ [gd_scene format=3 uid="uid://cinn18bl736rk"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_qemp1"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_loic7"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_wgwvo"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_uva8b"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/CraftNodeDisplay.cs" id="1_qemp1"] -[node name="Craft" type="PanelContainer" unique_id=247502695 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="Craft" type="GraphNode" unique_id=908155742] +offset_right = 158.0 +offset_bottom = 86.0 +title = "Craft" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true script = ExtResource("1_qemp1") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=1839537826] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="VBoxContainer" type="VBoxContainer" parent="EditorDisplay" unique_id=2050461070] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=945032897] +[node name="Values" type="HBoxContainer" parent="." unique_id=1811897037] layout_mode = 2 alignment = 1 -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=1994560318] +[node name="RichTextLabel" type="RichTextLabel" parent="Values" unique_id=1387569824] layout_mode = 2 -size_flags_horizontal = 3 -text = "Craft: " +text = "Craft" fit_content = true autowrap_mode = 0 horizontal_alignment = 1 vertical_alignment = 1 -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=479938935] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_loic7") - -[node name="TextureButton2" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=1763195616] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_wgwvo") - -[node name="TextureButton3" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=1118894442] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_uva8b") - -[node name="Values" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=1811897037] -layout_mode = 2 -alignment = 1 - -[node name="Item" type="OptionButton" parent="EditorDisplay/VBoxContainer/Values" unique_id=2066235567] +[node name="Item" type="OptionButton" parent="Values" unique_id=2066235567] layout_mode = 2 size_flags_horizontal = 3 -[node name="Amount" type="SpinBox" parent="EditorDisplay/VBoxContainer/Values" unique_id=827307108] +[node name="Amount" type="SpinBox" parent="Values" unique_id=827307108] layout_mode = 2 size_flags_horizontal = 3 rounded = true @@ -71,12 +41,10 @@ alignment = 1 prefix = "x" select_all_on_focus = true -[node name="ListDisplay" type="Button" parent="." unique_id=200731038] -visible = false +[node name="RichTextLabel2" type="RichTextLabel" parent="Values" unique_id=83986734] layout_mode = 2 -tooltip_text = "Crafts the amount of the selected item." -text = "Craft" - -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/TextureButton2" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/TextureButton3" to="." method="MoveNodeDown"] +text = "times" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 diff --git a/Prefabs/DSL/ElseNode.tscn b/Prefabs/DSL/ElseNode.tscn deleted file mode 100644 index 7444a4f..0000000 --- a/Prefabs/DSL/ElseNode.tscn +++ /dev/null @@ -1,63 +0,0 @@ -[gd_scene format=3 uid="uid://drcb0eqe78k0p"] - -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_rl00f"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_swrbs"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] - -[node name="Else" type="PanelContainer" unique_id=247502695 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1_rl00f") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") - -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=1839537826] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay" unique_id=945032897] -layout_mode = 2 -alignment = 1 - -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=1994560318] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Else" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/HBoxContainer" unique_id=479938935] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_swrbs") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="ListDisplay" type="Button" parent="." unique_id=200731038] -visible = false -layout_mode = 2 -tooltip_text = "Stops skipping from If-nodes" -text = "Else" - -[connection signal="pressed" from="EditorDisplay/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] diff --git a/Prefabs/DSL/ExploreNode.tscn b/Prefabs/DSL/ExploreNode.tscn index 7c84453..aefadfe 100644 --- a/Prefabs/DSL/ExploreNode.tscn +++ b/Prefabs/DSL/ExploreNode.tscn @@ -1,62 +1,21 @@ [gd_scene format=3 uid="uid://dit4u45jegwv0"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_3kgh4"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_6eg2n"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/ExploreNodeDisplay.cs" id="1_3kgh4"] -[node name="Explore" type="PanelContainer" unique_id=1474470717 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 +[node name="Editor" type="GraphNode" unique_id=2133945133] +offset_right = 67.0 +offset_bottom = 55.0 +title = "Explore" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true script = ExtResource("1_3kgh4") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=245583237] +[node name="Control" type="Control" parent="." unique_id=869568380] layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay" unique_id=1629099069] -layout_mode = 2 -alignment = 1 - -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=1497013575] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Randomly explore" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/HBoxContainer" unique_id=57412049] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_6eg2n") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="ListDisplay" type="Button" parent="." unique_id=347942160] -layout_mode = 2 -tooltip_text = "Randomly explores the available ruin" -text = "Explore" - -[connection signal="pressed" from="EditorDisplay/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] diff --git a/Prefabs/DSL/ForNode.tscn b/Prefabs/DSL/ForNode.tscn index 6287b9c..56582fa 100644 --- a/Prefabs/DSL/ForNode.tscn +++ b/Prefabs/DSL/ForNode.tscn @@ -1,65 +1,47 @@ [gd_scene format=3 uid="uid://co7op7et6is8p"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_xshi5"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_mtk18"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/ForNodeDisplay.cs" id="1_xshi5"] -[node name="Craft" type="PanelContainer" unique_id=247502695 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="For" type="GraphNode" unique_id=1235671673] +offset_right = 229.0 +offset_bottom = 129.0 +theme_override_constants/separation = 20 +title = "For" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true +slot/1/left_enabled = true +slot/1/left_type = 0 +slot/1/left_color = Color(1, 1, 1, 1) +slot/1/left_icon = null +slot/1/right_enabled = true +slot/1/right_type = 0 +slot/1/right_color = Color(1, 1, 1, 1) +slot/1/right_icon = null +slot/1/draw_stylebox = true script = ExtResource("1_xshi5") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=1839537826] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="VBoxContainer" type="VBoxContainer" parent="EditorDisplay" unique_id=914671634] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=945032897] +[node name="Values" type="HBoxContainer" parent="." unique_id=1896004369] layout_mode = 2 alignment = 1 -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=1994560318] +[node name="RichTextLabel" type="RichTextLabel" parent="Values" unique_id=1832504365] layout_mode = 2 size_flags_horizontal = 3 -text = "For:" +size_flags_stretch_ratio = 0.3 +text = "Repeat" fit_content = true autowrap_mode = 0 horizontal_alignment = 1 vertical_alignment = 1 -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=479938935] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_mtk18") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="Values" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=1896004369] -layout_mode = 2 -alignment = 1 - -[node name="Amount" type="SpinBox" parent="EditorDisplay/VBoxContainer/Values" unique_id=1393892745] +[node name="Amount" type="SpinBox" parent="Values" unique_id=1393892745] layout_mode = 2 size_flags_horizontal = 3 rounded = true @@ -67,12 +49,19 @@ alignment = 1 prefix = "x" select_all_on_focus = true -[node name="ListDisplay" type="Button" parent="." unique_id=200731038] -visible = false +[node name="RichTextLabel2" type="RichTextLabel" parent="Values" unique_id=1394844571] layout_mode = 2 -tooltip_text = "Repeats the following blocks to the next for, until or while block the selected amount of times." -text = "For" +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.3 +text = "times" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] +[node name="RichTextLabel" type="RichTextLabel" parent="." unique_id=1677882951] +layout_mode = 2 +text = "Until" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 diff --git a/Prefabs/DSL/HarvestNode.tscn b/Prefabs/DSL/HarvestNode.tscn index 00846b7..c762e67 100644 --- a/Prefabs/DSL/HarvestNode.tscn +++ b/Prefabs/DSL/HarvestNode.tscn @@ -1,62 +1,21 @@ [gd_scene format=3 uid="uid://com0ou37wj2xo"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_ve3v1"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_u1say"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/HarvestNodeDisplay.cs" id="1_ve3v1"] -[node name="Harvest" type="PanelContainer" unique_id=1323721153 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 +[node name="Harvest" type="GraphNode" unique_id=139025740] +offset_right = 69.0 +offset_bottom = 55.0 +title = "Harvest" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true script = ExtResource("1_ve3v1") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=970168969] +[node name="Control" type="Control" parent="." unique_id=2044911208] layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay" unique_id=793343398] -layout_mode = 2 -alignment = 1 - -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=1393328640] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Harvest" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/HBoxContainer" unique_id=661274351] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_u1say") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="ListDisplay" type="Button" parent="." unique_id=884865258] -layout_mode = 2 -tooltip_text = "Harvests the resource from the tile the robot is currently standing on." -text = "Harvest" - -[connection signal="pressed" from="EditorDisplay/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] diff --git a/Prefabs/DSL/IfNode.tscn b/Prefabs/DSL/IfNode.tscn index 866bebd..3a8415a 100644 --- a/Prefabs/DSL/IfNode.tscn +++ b/Prefabs/DSL/IfNode.tscn @@ -1,69 +1,51 @@ [gd_scene format=3 uid="uid://ctmad6foidkvp"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_ygi5c"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_a5cwv"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs" id="1_ygi5c"] -[node name="If" type="PanelContainer" unique_id=247502695 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="If" type="GraphNode" unique_id=821127877] +offset_right = 468.0 +offset_bottom = 129.0 +theme_override_constants/separation = 20 +title = "If" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true +slot/1/left_enabled = true +slot/1/left_type = 0 +slot/1/left_color = Color(1, 1, 1, 1) +slot/1/left_icon = null +slot/1/right_enabled = true +slot/1/right_type = 0 +slot/1/right_color = Color(1, 1, 1, 1) +slot/1/right_icon = null +slot/1/draw_stylebox = true script = ExtResource("1_ygi5c") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=1839537826] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="VBoxContainer" type="VBoxContainer" parent="EditorDisplay" unique_id=1137776934] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=945032897] +[node name="Values" type="HBoxContainer" parent="." unique_id=149543652] layout_mode = 2 alignment = 1 -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=1994560318] +[node name="RichTextLabel" type="RichTextLabel" parent="Values" unique_id=1884502843] layout_mode = 2 size_flags_horizontal = 3 -text = "If:" +size_flags_stretch_ratio = 0.2 +text = "if" fit_content = true autowrap_mode = 0 horizontal_alignment = 1 vertical_alignment = 1 -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=479938935] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_a5cwv") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="Values" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=149543652] -layout_mode = 2 -alignment = 1 - -[node name="Item" type="OptionButton" parent="EditorDisplay/VBoxContainer/Values" unique_id=635450884] +[node name="Item" type="OptionButton" parent="Values" unique_id=635450884] layout_mode = 2 size_flags_horizontal = 3 -[node name="Comparator" type="OptionButton" parent="EditorDisplay/VBoxContainer/Values" unique_id=691603757] +[node name="Comparator" type="OptionButton" parent="Values" unique_id=691603757] layout_mode = 2 size_flags_horizontal = 3 item_count = 6 @@ -80,7 +62,7 @@ popup/item_4/id = 4 popup/item_5/text = "is bigger than or equal to" popup/item_5/id = 5 -[node name="Amount" type="SpinBox" parent="EditorDisplay/VBoxContainer/Values" unique_id=561942124] +[node name="Amount" type="SpinBox" parent="Values" unique_id=561942124] layout_mode = 2 size_flags_horizontal = 3 rounded = true @@ -88,12 +70,22 @@ alignment = 1 prefix = "x" select_all_on_focus = true -[node name="ListDisplay" type="Button" parent="." unique_id=200731038] -visible = false +[node name="RichTextLabel2" type="RichTextLabel" parent="Values" unique_id=947350412] layout_mode = 2 -tooltip_text = "Allows branching in the code with a condition based on item in your inventory. (Skips everything until another If or Else block if condition is false)" -text = "If" +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.2 +text = "execute" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] +[node name="RichTextLabel" type="RichTextLabel" parent="." unique_id=798764628] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.2 +text = "Else" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 diff --git a/Prefabs/DSL/MaintainNode.tscn b/Prefabs/DSL/MaintainNode.tscn index 3fbae81..e870fbc 100644 --- a/Prefabs/DSL/MaintainNode.tscn +++ b/Prefabs/DSL/MaintainNode.tscn @@ -1,62 +1,21 @@ [gd_scene format=3 uid="uid://fe7so4543q4x"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_maintain"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_trash"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/MaintainNodeDisplay.cs" id="1_maintain"] -[node name="Maintain" type="PanelContainer" unique_id=346305609 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 +[node name="Maintain" type="GraphNode" unique_id=472534776] +offset_right = 77.0 +offset_bottom = 55.0 +title = "Maintain" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true script = ExtResource("1_maintain") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=237286109] +[node name="Control" type="Control" parent="." unique_id=7171189] layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay" unique_id=222639319] -layout_mode = 2 -alignment = 1 - -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=50532719] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Maintain" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/HBoxContainer" unique_id=1753994239] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_trash") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="ListDisplay" type="Button" parent="." unique_id=991375625] -layout_mode = 2 -tooltip_text = "Repairs the robot by 10% and consumes one matching gear." -text = "Maintain" - -[connection signal="pressed" from="EditorDisplay/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] diff --git a/Prefabs/DSL/MoveNode.tscn b/Prefabs/DSL/MoveNode.tscn index 9f3f070..4bd75b1 100644 --- a/Prefabs/DSL/MoveNode.tscn +++ b/Prefabs/DSL/MoveNode.tscn @@ -1,65 +1,38 @@ [gd_scene format=3 uid="uid://by0khq5dmxjvm"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_mexpj"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_5ujwv"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/MoveNodeDisplay.cs" id="1_mexpj"] -[node name="Move" type="PanelContainer" unique_id=1474470717 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 +[node name="Move" type="GraphNode" unique_id=1386049718] +offset_right = 373.0 +offset_bottom = 86.0 +title = "Move" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true script = ExtResource("1_mexpj") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=245583237] -layout_mode = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="EditorDisplay" unique_id=2004713919] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=1629099069] +[node name="Values" type="HBoxContainer" parent="." unique_id=1288550105] layout_mode = 2 alignment = 1 -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=1497013575] +[node name="RichTextLabel" type="RichTextLabel" parent="Values" unique_id=1529203020] layout_mode = 2 size_flags_horizontal = 3 -text = "Move to: " +size_flags_stretch_ratio = 0.2 +text = "Move to:" fit_content = true autowrap_mode = 0 horizontal_alignment = 1 vertical_alignment = 1 +justification_flags = 161 -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=753598237] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_5ujwv") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="Values" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=1288550105] -layout_mode = 2 -alignment = 1 - -[node name="CoordinateX" type="SpinBox" parent="EditorDisplay/VBoxContainer/Values" unique_id=2062502281] +[node name="CoordinateX" type="SpinBox" parent="Values" unique_id=2062502281] layout_mode = 2 size_flags_horizontal = 3 rounded = true @@ -67,7 +40,7 @@ alignment = 1 prefix = "X" select_all_on_focus = true -[node name="CoordinateY" type="SpinBox" parent="EditorDisplay/VBoxContainer/Values" unique_id=211509452] +[node name="CoordinateY" type="SpinBox" parent="Values" unique_id=211509452] layout_mode = 2 size_flags_horizontal = 3 rounded = true @@ -75,19 +48,10 @@ alignment = 1 prefix = "Y" select_all_on_focus = true -[node name="CoordinateZ" type="SpinBox" parent="EditorDisplay/VBoxContainer/Values" unique_id=832152386] +[node name="CoordinateZ" type="SpinBox" parent="Values" unique_id=832152386] layout_mode = 2 size_flags_horizontal = 3 rounded = true alignment = 1 prefix = "Z" select_all_on_focus = true - -[node name="ListDisplay" type="Button" parent="." unique_id=347942160] -layout_mode = 2 -tooltip_text = "Moves the robot to the selected coordinate" -text = "Move" - -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] diff --git a/Prefabs/DSL/SacrificeNode.tscn b/Prefabs/DSL/SacrificeNode.tscn index 597d19c..6b3e40b 100644 --- a/Prefabs/DSL/SacrificeNode.tscn +++ b/Prefabs/DSL/SacrificeNode.tscn @@ -1,62 +1,21 @@ [gd_scene format=3 uid="uid://bxph44i8mad1i"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_sacrifice"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_trash"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/SacrificeNodeDisplay.cs" id="1_sacrifice"] -[node name="Sacrifice" type="PanelContainer" unique_id=442348941 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 +[node name="Sacrifice" type="GraphNode" unique_id=530315031] +offset_right = 73.0 +offset_bottom = 55.0 +title = "Sacrifice" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true script = ExtResource("1_sacrifice") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=1064798043] +[node name="Control" type="Control" parent="." unique_id=632650905] layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay" unique_id=1195324631] -layout_mode = 2 -alignment = 1 - -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=1628437503] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Sacrifice" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/HBoxContainer" unique_id=1813377435] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_trash") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="ListDisplay" type="Button" parent="." unique_id=2140824916] -layout_mode = 2 -tooltip_text = "Sacrifices the robot and makes the resource on this tile endless." -text = "Sacrifice" - -[connection signal="pressed" from="EditorDisplay/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] diff --git a/Prefabs/DSL/UntilNode.tscn b/Prefabs/DSL/UntilNode.tscn deleted file mode 100644 index 03ee1d2..0000000 --- a/Prefabs/DSL/UntilNode.tscn +++ /dev/null @@ -1,63 +0,0 @@ -[gd_scene format=3 uid="uid://ypfwubnl4oju"] - -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_kmf0m"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_71nn3"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] - -[node name="Craft" type="PanelContainer" unique_id=247502695 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1_kmf0m") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") - -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=1839537826] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay" unique_id=945032897] -layout_mode = 2 -alignment = 1 - -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=1994560318] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Until" -fit_content = true -autowrap_mode = 0 -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/HBoxContainer" unique_id=479938935] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_71nn3") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="ListDisplay" type="Button" parent="." unique_id=200731038] -visible = false -layout_mode = 2 -tooltip_text = "Stops any while- or for-loop and returns to their node position." -text = "Until" - -[connection signal="pressed" from="EditorDisplay/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] diff --git a/Prefabs/DSL/WhileNode.tscn b/Prefabs/DSL/WhileNode.tscn index 6816e53..7eaf651 100644 --- a/Prefabs/DSL/WhileNode.tscn +++ b/Prefabs/DSL/WhileNode.tscn @@ -1,69 +1,51 @@ [gd_scene format=3 uid="uid://bwiaqvl0d4x8v"] -[ext_resource type="Script" uid="uid://b6kxwmuhmruul" path="res://Scripts/UI/DSL/NodeDisplay.cs" id="1_q0rc7"] -[ext_resource type="Texture2D" uid="uid://wq8yc0u0ee33" path="res://Assets/Images/TrashSymbol.png" id="2_yhncq"] -[ext_resource type="Texture2D" uid="uid://djxwweinn5c4i" path="res://Assets/Images/ArrowUp.png" id="3_arrow_up"] -[ext_resource type="Texture2D" uid="uid://66yiv4g7kfpv" path="res://Assets/Images/ArrowDown.png" id="4_arrow_down"] +[ext_resource type="Script" path="res://Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs" id="1_q0rc7"] -[node name="While" type="PanelContainer" unique_id=247502695 node_paths=PackedStringArray("editorDisplay", "listDisplay")] -anchors_preset = 14 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -offset_bottom = 31.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="While" type="GraphNode" unique_id=2040226700] +offset_right = 499.0 +offset_bottom = 129.0 +theme_override_constants/separation = 20 +title = "While" +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color(1, 1, 1, 1) +slot/0/left_icon = null +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color(1, 1, 1, 1) +slot/0/right_icon = null +slot/0/draw_stylebox = true +slot/1/left_enabled = true +slot/1/left_type = 0 +slot/1/left_color = Color(1, 1, 1, 1) +slot/1/left_icon = null +slot/1/right_enabled = true +slot/1/right_type = 0 +slot/1/right_color = Color(1, 1, 1, 1) +slot/1/right_icon = null +slot/1/draw_stylebox = true script = ExtResource("1_q0rc7") -editorDisplay = NodePath("EditorDisplay") -listDisplay = NodePath("ListDisplay") -[node name="EditorDisplay" type="PanelContainer" parent="." unique_id=1839537826] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="VBoxContainer" type="VBoxContainer" parent="EditorDisplay" unique_id=1034731324] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=1646219600] +[node name="Values" type="HBoxContainer" parent="." unique_id=945032897] layout_mode = 2 alignment = 1 -[node name="Flavour" type="RichTextLabel" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=1184858872] +[node name="RichTextLabel" type="RichTextLabel" parent="Values" unique_id=336538401] layout_mode = 2 size_flags_horizontal = 3 -text = "While:" +size_flags_stretch_ratio = 0.2 +text = "while" fit_content = true autowrap_mode = 0 horizontal_alignment = 1 vertical_alignment = 1 -[node name="TextureButton" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer" unique_id=479938935] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("2_yhncq") - -[node name="MoveUp" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("3_arrow_up") - -[node name="MoveDown" type="TextureButton" parent="EditorDisplay/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.1 -texture_normal = ExtResource("4_arrow_down") - -[node name="Values" type="HBoxContainer" parent="EditorDisplay/VBoxContainer" unique_id=945032897] -layout_mode = 2 -alignment = 1 - -[node name="Item" type="OptionButton" parent="EditorDisplay/VBoxContainer/Values" unique_id=117577134] +[node name="Item" type="OptionButton" parent="Values" unique_id=117577134] layout_mode = 2 size_flags_horizontal = 3 -[node name="Comparator" type="OptionButton" parent="EditorDisplay/VBoxContainer/Values" unique_id=539633915] +[node name="Comparator" type="OptionButton" parent="Values" unique_id=539633915] layout_mode = 2 size_flags_horizontal = 3 item_count = 6 @@ -80,7 +62,7 @@ popup/item_4/id = 4 popup/item_5/text = "is bigger than or equal to" popup/item_5/id = 5 -[node name="Amount" type="SpinBox" parent="EditorDisplay/VBoxContainer/Values" unique_id=1195061461] +[node name="Amount" type="SpinBox" parent="Values" unique_id=1195061461] layout_mode = 2 size_flags_horizontal = 3 rounded = true @@ -88,12 +70,20 @@ alignment = 1 prefix = "x" select_all_on_focus = true -[node name="ListDisplay" type="Button" parent="." unique_id=200731038] -visible = false +[node name="RichTextLabel2" type="RichTextLabel" parent="Values" unique_id=345047084] layout_mode = 2 -tooltip_text = "Allows repetition in the code with a condition based on item in your inventory. (Skips everything until another while, for or until block if condition is false)" -text = "While" +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.2 +text = "execute" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/TextureButton" to="." method="DeleteNodePressed"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveUp" to="." method="MoveNodeUp"] -[connection signal="pressed" from="EditorDisplay/VBoxContainer/HBoxContainer/MoveDown" to="." method="MoveNodeDown"] +[node name="RichTextLabel" type="RichTextLabel" parent="." unique_id=1571031910] +layout_mode = 2 +text = "Until" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 diff --git a/Scenes/Game.tscn b/Scenes/Game.tscn index bd8c1ff..a63f018 100644 --- a/Scenes/Game.tscn +++ b/Scenes/Game.tscn @@ -48,9 +48,6 @@ bg_color = Color(0, 0, 0, 0.7647059) [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fgofq"] bg_color = Color(0.36567047, 0.46785766, 0.7000103, 0.5176471) -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2irst"] -bg_color = Color(0.30085096, 0.39694247, 0.6216495, 0.5176471) - [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bf53h"] bg_color = Color(0.3106171, 0.31061712, 0.310617, 1) @@ -228,7 +225,6 @@ layout_mode = 2 size_flags_vertical = 3 [node name="CodingWindow" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=1576652491 node_paths=PackedStringArray("codeBlocks", "editorWindow", "availableScripts", "scriptName", "nameInput")] -visible = false layout_mode = 1 anchors_preset = 11 anchor_left = 1.0 @@ -240,7 +236,7 @@ grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_7lihs") script = ExtResource("6_7lihs") codeBlocks = NodePath("VBoxContainer/Scripting/CodeBlocks/VBoxContainer") -editorWindow = NodePath("VBoxContainer/Scripting/EditorWindow/CodeContainer/VBoxContainer") +editorWindow = NodePath("VBoxContainer/Scripting/EditorWindow/CodeContainer") availableScripts = NodePath("VBoxContainer/Scripting/EditorWindow/Load") scriptName = NodePath("VBoxContainer/Scripting/EditorWindow/Saving/ScriptName") nameInput = NodePath("VBoxContainer/Renaming/LineEdit") @@ -302,19 +298,10 @@ layout_mode = 2 size_flags_horizontal = 3 size_flags_stretch_ratio = 2.0 -[node name="CodeContainer" type="ScrollContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=2045306791] +[node name="CodeContainer" type="GraphEdit" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=1600198848] layout_mode = 2 -size_flags_horizontal = 3 size_flags_vertical = 3 -size_flags_stretch_ratio = 2.0 -theme_override_styles/panel = SubResource("StyleBoxFlat_2irst") -horizontal_scroll_mode = 0 - -[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" unique_id=632191528] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -theme_override_constants/separation = 10 +right_disconnects = true [node name="Buttons" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=265797151] layout_mode = 2 @@ -697,6 +684,8 @@ text = "Next" [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer/UnlockLayer" to="CanvasLayer/UIHandler" method="UnlockLayer"] [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Renaming/Button" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="SaveRobotName"] +[connection signal="connection_request" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="OnNodeConnect"] +[connection signal="disconnection_request" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="OnNodeDisconnect"] [connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Clear" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="ClearWindow"] [connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Compile" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="CompileProgram"] [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Saving/Save" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="SaveProgram"] diff --git a/Scripts/Core/ResourceLoader.cs b/Scripts/Core/ResourceLoader.cs index b8f344d..8aa2544 100644 --- a/Scripts/Core/ResourceLoader.cs +++ b/Scripts/Core/ResourceLoader.cs @@ -71,8 +71,6 @@ public partial class ResourceLoader { new CraftNode(), GD.Load("res://Prefabs/DSL/CraftNode.tscn") }, { new ExploreNode(), GD.Load("res://Prefabs/DSL/ExploreNode.tscn") }, { new IfNode(), GD.Load("res://Prefabs/DSL/IfNode.tscn") }, - { new ElseNode(), GD.Load("res://Prefabs/DSL/ElseNode.tscn") }, - { new UntilNode(), GD.Load("res://Prefabs/DSL/UntilNode.tscn") }, { new ForNode(), GD.Load("res://Prefabs/DSL/ForNode.tscn") }, { new WhileNode(), GD.Load("res://Prefabs/DSL/WhileNode.tscn") }, { new MaintainNode(), GD.Load("res://Prefabs/DSL/MaintainNode.tscn") }, diff --git a/Scripts/DSL/Nodes/CraftNode.cs b/Scripts/DSL/Nodes/CraftNode.cs index ba142db..aa53d45 100644 --- a/Scripts/DSL/Nodes/CraftNode.cs +++ b/Scripts/DSL/Nodes/CraftNode.cs @@ -40,18 +40,6 @@ public class CraftNode : ProgramNode return NodeResult.RUNNING; } - public override void ReadParameters(NodeDisplay display) - { - HBoxContainer valueContainer = display.GetNode("./EditorDisplay/VBoxContainer/Values"); - OptionButton items = valueContainer.GetNode("./Item"); - string readableItem = items.GetItemText(items.GetSelectedId()).Split(":")[0]; - if (GameData.availableItems.ContainsKey(ItemData.GetIndex(readableItem))) - { - selectedItem = new Item { data = GameData.availableItems[ItemData.GetIndex(readableItem)] }; - } - amount = (int)valueContainer.GetNode("./Amount").Value; - } - public override ProgramNode Duplicate() { CraftNode duplicate = new CraftNode() @@ -62,32 +50,6 @@ public class CraftNode : ProgramNode return duplicate; } - public override void Setup(NodeDisplay display) - { - OptionButton options = display.GetNode("./EditorDisplay/VBoxContainer/Values/Item"); - options.AddItem("Select item..."); - foreach (ItemData item in GameData.availableItems.Values) - { - if (GameData.availableResearch[item.Research].state != ResearchState.RESEARCHED) continue; - if (item.Inputs.Count > 0) - { - options.AddItem(item.GetCraftingDisplay()); - } - } - - if (selectedItem != null) - { - for (int i = 0; i < options.ItemCount; i++) - { - if (ItemData.GetIndex(options.GetItemText(i).Split(":")[0]) == selectedItem.data.Id) - { - options.Select(i); - break; - } - } - } - } - public override string Save() { return $"Name: {DisplayText}, Item: {(selectedItem == null ? "Empty" : selectedItem.data.Id)}, Amount: {amount}"; diff --git a/Scripts/DSL/Nodes/ElseNode.cs b/Scripts/DSL/Nodes/ElseNode.cs deleted file mode 100644 index 27bfcc2..0000000 --- a/Scripts/DSL/Nodes/ElseNode.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Godot; - -public class ElseNode : ProgramNode -{ - public ElseNode() - { - DisplayText = "Else"; - } - public override NodeResult Execute(Robot robot, double delta) - { - return NodeResult.SUCCESS; - } - - public override void ReadParameters(NodeDisplay display) - { - } - - public override ProgramNode Duplicate() - { - ElseNode duplicate = new ElseNode(); - return duplicate; - } - - public override void Setup(NodeDisplay display) - { - - } - - public override string Save() - { - return $"Name: {DisplayText}"; - } -} diff --git a/Scripts/DSL/Nodes/ElseNode.cs.uid b/Scripts/DSL/Nodes/ElseNode.cs.uid deleted file mode 100644 index aeed4df..0000000 --- a/Scripts/DSL/Nodes/ElseNode.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dxpf6nsijqq1d diff --git a/Scripts/DSL/Nodes/ExploreNode.cs b/Scripts/DSL/Nodes/ExploreNode.cs index f064a97..d50428e 100644 --- a/Scripts/DSL/Nodes/ExploreNode.cs +++ b/Scripts/DSL/Nodes/ExploreNode.cs @@ -86,14 +86,6 @@ public class ExploreNode : ProgramNode return duplicate; } - public override void ReadParameters(NodeDisplay display) - { - } - - public override void Setup(NodeDisplay display) - { - } - public override string Save() { return $"Name: {DisplayText}"; diff --git a/Scripts/DSL/Nodes/ForNode.cs b/Scripts/DSL/Nodes/ForNode.cs index 7461059..b82a948 100644 --- a/Scripts/DSL/Nodes/ForNode.cs +++ b/Scripts/DSL/Nodes/ForNode.cs @@ -20,12 +20,6 @@ public class ForNode : ProgramNode return amountExecuted < amount; } - public override void ReadParameters(NodeDisplay display) - { - HBoxContainer valueContainer = display.GetNode("./EditorDisplay/VBoxContainer/Values"); - amount = (int)valueContainer.GetNode("./Amount").Value; - } - public override ProgramNode Duplicate() { ForNode duplicate = new ForNode() @@ -36,11 +30,6 @@ public class ForNode : ProgramNode return duplicate; } - public override void Setup(NodeDisplay display) - { - - } - public override string Save() { return $"Name: {DisplayText}, AmountExecuted: {amountExecuted}, Amount: {amount}"; diff --git a/Scripts/DSL/Nodes/HarvestNode.cs b/Scripts/DSL/Nodes/HarvestNode.cs index f45a96b..954e3f4 100644 --- a/Scripts/DSL/Nodes/HarvestNode.cs +++ b/Scripts/DSL/Nodes/HarvestNode.cs @@ -39,20 +39,12 @@ public class HarvestNode : ProgramNode return NodeResult.RUNNING; } - public override void ReadParameters(NodeDisplay display) - { - } - public override ProgramNode Duplicate() { HarvestNode duplicate = new HarvestNode(); return duplicate; } - public override void Setup(NodeDisplay display) - { - } - public override string Save() { return $"Name: {DisplayText}"; diff --git a/Scripts/DSL/Nodes/IfNode.cs b/Scripts/DSL/Nodes/IfNode.cs index 514ec33..8ab209e 100644 --- a/Scripts/DSL/Nodes/IfNode.cs +++ b/Scripts/DSL/Nodes/IfNode.cs @@ -41,21 +41,6 @@ public class IfNode : ProgramNode } } - public override void ReadParameters(NodeDisplay display) - { - HBoxContainer valueContainer = display.GetNode("./EditorDisplay/VBoxContainer/Values"); - OptionButton items = valueContainer.GetNode("./Item"); - string readableItem = items.GetItemText(items.GetSelectedId()).Split(":")[0]; - if (GameData.availableItems.ContainsKey(ItemData.GetIndex(readableItem))) - { - selectedItem = new Item { data = GameData.availableItems[ItemData.GetIndex(readableItem)] }; - } - amount = (int)valueContainer.GetNode("./Amount").Value; - - OptionButton comparators = valueContainer.GetNode("./Comparator"); - comparator = comparators.GetItemText(comparators.GetSelectedId()); - } - public override ProgramNode Duplicate() { IfNode duplicate = new IfNode() @@ -67,43 +52,6 @@ public class IfNode : ProgramNode return duplicate; } - public override void Setup(NodeDisplay display) - { - OptionButton options = display.GetNode("./EditorDisplay/VBoxContainer/Values/Item"); - options.AddItem("Select item..."); - foreach (ItemData item in GameData.availableItems.Values) - { - if (GameData.availableResearch[item.Research].state != ResearchState.RESEARCHED) continue; - options.AddItem(item.GetReadableName()); - } - - if (selectedItem != null) - { - for (int i = 0; i < options.ItemCount; i++) - { - if (ItemData.GetIndex(options.GetItemText(i).Split(":")[0]) == selectedItem.data.Id) - { - options.Select(i); - break; - } - } - } - - OptionButton comparators = display.GetNode("./EditorDisplay/VBoxContainer/Values/Comparator"); - - if (comparator != null) - { - for (int i = 0; i < comparators.ItemCount; i++) - { - if (comparators.GetItemText(i) == comparator) - { - comparators.Select(i); - break; - } - } - } - } - public override string Save() { return $"Name: {DisplayText}, Item: {(selectedItem == null ? "Empty" : selectedItem.data.Id)}, Comparator: {comparator}, Amount: {amount}"; diff --git a/Scripts/DSL/Nodes/MaintainNode.cs b/Scripts/DSL/Nodes/MaintainNode.cs index b50a076..0c4e953 100644 --- a/Scripts/DSL/Nodes/MaintainNode.cs +++ b/Scripts/DSL/Nodes/MaintainNode.cs @@ -24,20 +24,12 @@ public class MaintainNode : ProgramNode return NodeResult.SUCCESS; } - public override void ReadParameters(NodeDisplay display) - { - } - public override ProgramNode Duplicate() { MaintainNode duplicate = new MaintainNode(); return duplicate; } - public override void Setup(NodeDisplay display) - { - } - public override string Save() { return $"Name: {DisplayText}"; diff --git a/Scripts/DSL/Nodes/MoveNode.cs b/Scripts/DSL/Nodes/MoveNode.cs index c21b6a9..c85451f 100644 --- a/Scripts/DSL/Nodes/MoveNode.cs +++ b/Scripts/DSL/Nodes/MoveNode.cs @@ -64,15 +64,6 @@ public class MoveNode : ProgramNode return NodeResult.RUNNING; } - public override void ReadParameters(NodeDisplay display) - { - HBoxContainer valueContainer = display.GetNode("./EditorDisplay/VBoxContainer/Values"); - int posX = (int)valueContainer.GetNode("./CoordinateX").Value; - int posY = (int)valueContainer.GetNode("./CoordinateY").Value; - int posZ = (int)valueContainer.GetNode("./CoordinateZ").Value; - targetPosition = new Vector3I(posX, posY, posZ); - } - public override ProgramNode Duplicate() { MoveNode duplicate = new MoveNode @@ -82,14 +73,6 @@ public class MoveNode : ProgramNode return duplicate; } - public override void Setup(NodeDisplay display) - { - HBoxContainer valueContainer = display.GetNode("./EditorDisplay/VBoxContainer/Values"); - valueContainer.GetNode("./CoordinateX").MaxValue = GameData.layerSize; - valueContainer.GetNode("./CoordinateY").MaxValue = GameData.ruinSize; - valueContainer.GetNode("./CoordinateZ").MaxValue = GameData.layerSize; - } - public override string Save() { return $"Name: {DisplayText}, Position: ({targetPosition.X}|{targetPosition.Y}|{targetPosition.Z})"; diff --git a/Scripts/DSL/Nodes/ProgramNode.cs b/Scripts/DSL/Nodes/ProgramNode.cs index ae57f0b..c5afb1b 100644 --- a/Scripts/DSL/Nodes/ProgramNode.cs +++ b/Scripts/DSL/Nodes/ProgramNode.cs @@ -7,9 +7,7 @@ public abstract class ProgramNode public string DisplayText; public string lastExecutionMessage; - public abstract void Setup(NodeDisplay display); public abstract NodeResult Execute(Robot robot, double delta); - public abstract void ReadParameters(NodeDisplay display); public abstract ProgramNode Duplicate(); public abstract string Save(); -} \ No newline at end of file +} diff --git a/Scripts/DSL/Nodes/SacrificeNode.cs b/Scripts/DSL/Nodes/SacrificeNode.cs index 70d1ad0..3ecd526 100644 --- a/Scripts/DSL/Nodes/SacrificeNode.cs +++ b/Scripts/DSL/Nodes/SacrificeNode.cs @@ -31,20 +31,12 @@ public class SacrificeNode : ProgramNode return NodeResult.SUCCESS; } - public override void ReadParameters(NodeDisplay display) - { - } - public override ProgramNode Duplicate() { SacrificeNode duplicate = new SacrificeNode(); return duplicate; } - public override void Setup(NodeDisplay display) - { - } - public override string Save() { return $"Name: {DisplayText}"; diff --git a/Scripts/DSL/Nodes/UntilNode.cs b/Scripts/DSL/Nodes/UntilNode.cs deleted file mode 100644 index f4a76ae..0000000 --- a/Scripts/DSL/Nodes/UntilNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Godot; - -public class UntilNode : ProgramNode -{ - public UntilNode() - { - DisplayText = "Until"; - } - public override NodeResult Execute(Robot robot, double delta) - { - return NodeResult.SUCCESS; - } - - public override void ReadParameters(NodeDisplay display) - { - } - - public override ProgramNode Duplicate() - { - UntilNode duplicate = new UntilNode(); - return duplicate; - } - - public override void Setup(NodeDisplay display) - { - } - - public override string Save() - { - return $"Name: {DisplayText}"; - } -} diff --git a/Scripts/DSL/Nodes/UntilNode.cs.uid b/Scripts/DSL/Nodes/UntilNode.cs.uid deleted file mode 100644 index f32e926..0000000 --- a/Scripts/DSL/Nodes/UntilNode.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://cq0j38wd84pc7 diff --git a/Scripts/DSL/Nodes/WhileNode.cs b/Scripts/DSL/Nodes/WhileNode.cs index 5571568..21862cd 100644 --- a/Scripts/DSL/Nodes/WhileNode.cs +++ b/Scripts/DSL/Nodes/WhileNode.cs @@ -42,22 +42,6 @@ public class WhileNode : ProgramNode } } - public override void ReadParameters(NodeDisplay display) - { - HBoxContainer valueContainer = display.GetNode("./EditorDisplay/VBoxContainer/Values"); - OptionButton items = valueContainer.GetNode("./Item"); - - string readableItem = items.GetItemText(items.GetSelectedId()).Split(":")[0]; - if (GameData.availableItems.ContainsKey(ItemData.GetIndex(readableItem))) - { - selectedItem = new Item { data = GameData.availableItems[ItemData.GetIndex(readableItem)] }; - } - amount = (int)valueContainer.GetNode("./Amount").Value; - - OptionButton comparators = valueContainer.GetNode("./Comparator"); - comparator = comparators.GetItemText(comparators.GetSelectedId()); - } - public override ProgramNode Duplicate() { WhileNode duplicate = new WhileNode() @@ -69,43 +53,6 @@ public class WhileNode : ProgramNode return duplicate; } - public override void Setup(NodeDisplay display) - { - OptionButton options = display.GetNode("./EditorDisplay/VBoxContainer/Values/Item"); - options.AddItem("Select item..."); - foreach (ItemData item in GameData.availableItems.Values) - { - if (GameData.availableResearch[item.Research].state != ResearchState.RESEARCHED) continue; - options.AddItem(item.GetReadableName()); - } - - if (selectedItem != null) - { - for (int i = 0; i < options.ItemCount; i++) - { - if (ItemData.GetIndex(options.GetItemText(i).Split(":")[0]) == selectedItem.data.Id) - { - options.Select(i); - break; - } - } - } - - OptionButton comparators = display.GetNode("./EditorDisplay/VBoxContainer/Values/Comparator"); - - if (comparator != null) - { - for (int i = 0; i < comparators.ItemCount; i++) - { - if (comparators.GetItemText(i) == comparator) - { - comparators.Select(i); - break; - } - } - } - } - public override string Save() { return $"Name: {DisplayText}, Item: {(selectedItem == null ? "Empty" : selectedItem.data.Id)}, Comparator: {comparator}, Amount: {amount}"; diff --git a/Scripts/UI/DSL/CodingWindow.cs b/Scripts/UI/DSL/CodingWindow.cs index 9c1508c..8db1d02 100644 --- a/Scripts/UI/DSL/CodingWindow.cs +++ b/Scripts/UI/DSL/CodingWindow.cs @@ -1,4 +1,5 @@ using Godot; +using Godot.Collections; using System.Collections.Generic; public partial class CodingWindow : PanelContainer @@ -6,12 +7,12 @@ public partial class CodingWindow : PanelContainer private Robot robot; [Export] VBoxContainer codeBlocks; - [Export] VBoxContainer editorWindow; + [Export] GraphEdit editorWindow; [Export] OptionButton availableScripts; [Export] LineEdit scriptName; [Export] LineEdit nameInput; - public Dictionary DSLNodes; + public System.Collections.Generic.Dictionary DSLNodes; public override void _Ready() { @@ -63,48 +64,57 @@ public partial class CodingWindow : PanelContainer public void GenerateCodingBlocks() { - NodeDisplay nodeDisplay; + Button nodeListButton; foreach (ProgramNode nodeTemplate in DSLNodes.Keys) { - nodeDisplay = DSLNodes[nodeTemplate].Instantiate(); - nodeDisplay.node = nodeTemplate; - codeBlocks.AddChild(nodeDisplay); - nodeDisplay.ShowListDisplay(); - nodeDisplay.listDisplay.Pressed += () => + nodeListButton = new Button { - AddEditorNode(DSLNodes[nodeTemplate], nodeTemplate.Duplicate()); + Name = nodeTemplate.DisplayText, + Text = nodeTemplate.DisplayText }; + nodeListButton.Pressed += () => + { + AddEditorNode(nodeTemplate); + }; + codeBlocks.AddChild(nodeListButton); } } - private void AddEditorNode(PackedScene prefab, ProgramNode node) + private void AddEditorNode(ProgramNode node) { - NodeDisplay editorDisplay = prefab.Instantiate(); - editorDisplay.node = node; + NodeDisplay editorDisplay = DSLNodes[node].Instantiate(); editorWindow.AddChild(editorDisplay); - editorDisplay.ShowEditorDisplay(); + RegisterEditorNode(editorDisplay); + } + + private void RegisterEditorNode(NodeDisplay editorDisplay) + { editorDisplay.OnDeleteNode += () => { editorWindow.RemoveChild(editorDisplay); editorDisplay.QueueFree(); }; - editorDisplay.OnMoveNode += (int direction) => - { - int targetIndex = Mathf.Clamp( - editorDisplay.GetIndex() + direction, - 0, - editorWindow.GetChildCount() - 1 - ); - editorWindow.MoveChild(editorDisplay, targetIndex); - }; } public void ClearWindow() { - foreach (Node node in editorWindow.GetChildren()) + foreach (Dictionary connection in editorWindow.GetConnectionList()) { - editorWindow.RemoveChild(node); - node.QueueFree(); + editorWindow.DisconnectNode( + connection["from_node"].AsStringName(), + (int)connection["from_port"], + connection["to_node"].AsStringName(), + (int)connection["to_port"] + ); + } + + foreach (Node child in editorWindow.GetChildren()) + { + if (child is GraphNode) + { + editorWindow.RemoveChild(child); + child.QueueFree(); + } } scriptName.Text = ""; } @@ -115,16 +125,20 @@ public partial class CodingWindow : PanelContainer for (int i = 0; i < editorWindow.GetChildCount(); i++) { - NodeDisplay nodeDisplay = editorWindow.GetChild(i); - nodeDisplay.node.ReadParameters(nodeDisplay); - nodes.Add(nodeDisplay.node.Duplicate()); - if (i != 0) + NodeDisplay nodeDisplay = editorWindow.GetChild(i) as NodeDisplay; + if (nodeDisplay == null) continue; + + nodeDisplay.ReadParameters(); + ProgramNode executableNode = nodeDisplay.node.Duplicate(); + nodes.Add(executableNode); + + if (nodes.Count > 1) { - nodes[i - 1].nextNode = nodes[i]; + nodes[nodes.Count - 2].nextNode = executableNode; } - if (i > 0) + if (nodes.Count > 1) { - nodes[i].previousNode = nodes[i-1]; + executableNode.previousNode = nodes[nodes.Count - 2]; } } @@ -151,12 +165,7 @@ public partial class CodingWindow : PanelContainer if (nodeDisplay != null) { editorWindow.AddChild(nodeDisplay); - nodeDisplay.ShowEditorDisplay(); - nodeDisplay.OnDeleteNode += () => - { - editorWindow.RemoveChild(nodeDisplay); - nodeDisplay.QueueFree(); - }; + RegisterEditorNode(nodeDisplay); } } scriptName.Text = availableScripts.GetItemText(index); @@ -184,21 +193,7 @@ public partial class CodingWindow : PanelContainer if (nodeDisplay != null) { editorWindow.AddChild(nodeDisplay); - nodeDisplay.ShowEditorDisplay(); - nodeDisplay.OnDeleteNode += () => - { - editorWindow.RemoveChild(nodeDisplay); - nodeDisplay.QueueFree(); - }; - nodeDisplay.OnMoveNode += (int direction) => - { - int targetIndex = Mathf.Clamp( - nodeDisplay.GetIndex() + direction, - 0, - editorWindow.GetChildCount() - 1 - ); - editorWindow.MoveChild(nodeDisplay, targetIndex); - }; + RegisterEditorNode(nodeDisplay); } nodeToLoad = nodeToLoad.nextNode; @@ -228,8 +223,10 @@ public partial class CodingWindow : PanelContainer string result = ""; for (int i = 0; i < editorWindow.GetChildCount(); i++) { - NodeDisplay nodeDisplay = editorWindow.GetChild(i); - nodeDisplay.node.ReadParameters(nodeDisplay); + NodeDisplay nodeDisplay = editorWindow.GetChild(i) as NodeDisplay; + if (nodeDisplay == null) continue; + + nodeDisplay.ReadParameters(); result += nodeDisplay.node.Save(); result += ";\r\n"; } @@ -238,4 +235,23 @@ public partial class CodingWindow : PanelContainer FileHandler.SaveProgram(filename, result); SetupScriptOptions(); } + + public void OnNodeConnect(StringName from, int fromPort, StringName to, int toPort) + { + GD.Print($"From {fromPort} to {toPort}"); + if (to == from) return; + + foreach (Dictionary connection in editorWindow.GetConnectionList()) + { + if (connection["to_node"].AsStringName() == to && (int)connection["to_port"] == toPort) return; + if (connection["from_node"].AsStringName() == from && (int)connection["from_port"] == fromPort) return; + } + + editorWindow.ConnectNode(from, fromPort, to, toPort); + } + + public void OnNodeDisconnect(StringName from, int fromPort, StringName to, int toPort) + { + editorWindow.DisconnectNode(from, fromPort, to, toPort); + } } diff --git a/Scripts/UI/DSL/NodeDisplay.cs b/Scripts/UI/DSL/NodeDisplay.cs index 8768e16..95b016c 100644 --- a/Scripts/UI/DSL/NodeDisplay.cs +++ b/Scripts/UI/DSL/NodeDisplay.cs @@ -1,39 +1,23 @@ -using System; using System.Collections.Generic; using Godot; -public partial class NodeDisplay : PanelContainer + +public partial class NodeDisplay : GraphNode { - [Export] PanelContainer editorDisplay; - [Export] public Button listDisplay; public ProgramNode node; [Signal] public delegate void OnDeleteNodeEventHandler(); - [Signal] - public delegate void OnMoveNodeEventHandler(int direction); - - public void SetNode(ProgramNode node) - { - this.node = node; - } public override void _Ready() { + if (node == null) + { + node = CreateProgramNode(); + } + if (node == null) return; - node.Setup(this); - } - - public void ShowListDisplay() - { - editorDisplay.Visible = false; - listDisplay.Visible = true; - } - - public void ShowEditorDisplay() - { - editorDisplay.Visible = true; - listDisplay.Visible = false; + SetupDisplay(); } public void DeleteNodePressed() @@ -51,119 +35,31 @@ public partial class NodeDisplay : PanelContainer if (prefab == null) return null; NodeDisplay result = prefab.Instantiate(); - - switch (nodeName) - { - case "move": - result.node = new MoveNode(); - result.LoadMove(nodeSanitized); - break; - case "harvest": - result.node = new HarvestNode(); - result.LoadHarvest(nodeSanitized); - break; - case "explore": - result.node = new ExploreNode(); - result.LoadExplore(nodeSanitized); - break; - case "craft": - result.node = new CraftNode(); - result.LoadCraft(nodeSanitized); - break; - case "while": - result.node = new WhileNode(); - result.LoadWhile(nodeSanitized); - break; - case "until": - result.node = new UntilNode(); - result.LoadUntil(nodeSanitized); - break; - case "for": - result.node = new ForNode(); - result.LoadFor(nodeSanitized); - break; - case "if": - result.node = new IfNode(); - result.LoadIf(nodeSanitized); - break; - case "else": - result.node = new ElseNode(); - result.LoadElse(nodeSanitized); - break; - case "maintain": - result.node = new MaintainNode(); - result.LoadMaintain(nodeSanitized); - break; - case "sacrifice": - result.node = new SacrificeNode(); - result.LoadSacrifice(nodeSanitized); - break; - default: - result.QueueFree(); - return null; - } + result.node = result.CreateProgramNode(); + result.LoadContent(result, nodeSanitized); return result; } - private void LoadElse(string content) { } - - private void LoadMaintain(string content) { } - - private void LoadSacrifice(string content) { } - - private void LoadIf(string content) + protected virtual ProgramNode CreateProgramNode() { - HBoxContainer valueContainer = GetNode("./EditorDisplay/VBoxContainer/Values"); - string[] parts = content.Split(","); - string itemString = parts[1].Replace("Item:", "").Trim(); - string comparatorString = parts[2].Replace("Comparator:", "").Trim(); - if (itemString.ToLower() != "empty") - { - IfNode ifNode = node as IfNode; - if (ifNode != null) - { - ifNode.selectedItem = new Item { data = GameData.availableItems[itemString] }; - ifNode.comparator = comparatorString; - } - } - string amountString = parts[3].Replace("Amount:", "").Trim(); - valueContainer.GetNode("./Amount").Value = int.Parse(amountString); + return null; } - private void LoadFor(string content) + protected virtual void LoadContent(NodeDisplay display, string content) { } + + public virtual void SetupDisplay() { } + + public virtual void ReadParameters() { } + + public HBoxContainer GetValueContainer() { - HBoxContainer valueContainer = GetNode("./EditorDisplay/VBoxContainer/Values"); - string[] parts = content.Split(","); - string amountExecuted = parts[1].Replace("AmountExecuted:", "").Trim(); - ForNode forNode = node as ForNode; - if (forNode != null) - { - forNode.amountExecuted = int.Parse(amountExecuted); - } - string amountString = parts[2].Replace("Amount:", "").Trim(); - valueContainer.GetNode("./Amount").Value = int.Parse(amountString); + return GetNode("./Values"); } - private void LoadUntil(string content) { } - - private void LoadWhile(string content) + protected HBoxContainer GetValueContainer(NodeDisplay display) { - HBoxContainer valueContainer = GetNode("./EditorDisplay/VBoxContainer/Values"); - string[] parts = content.Split(","); - string itemString = parts[1].Replace("Item:", "").Trim(); - string comparatorString = parts[2].Replace("Comparator:", "").Trim(); - if (itemString.ToLower() != "empty") - { - WhileNode whileNode = node as WhileNode; - if (whileNode != null) - { - whileNode.selectedItem = new Item { data = GameData.availableItems[itemString] }; - whileNode.comparator = comparatorString; - } - } - string amountString = parts[3].Replace("Amount:", "").Trim(); - valueContainer.GetNode("./Amount").Value = int.Parse(amountString); + return display.GetValueContainer(); } private static PackedScene GetPrefab(string nodeName, Dictionary DSLNodes) @@ -178,54 +74,4 @@ public partial class NodeDisplay : PanelContainer return null; } - - public void LoadHarvest(string content) { } - - public void LoadMove(string content) - { - HBoxContainer valueContainer = GetNode("./EditorDisplay/VBoxContainer/Values"); - string[] parts = content.Split(","); - string positionValues = parts[1].Replace("Position:", "").Replace("(", "").Replace(")", "").Trim(); - int posX = int.Parse(positionValues.Split("|")[0]); - int posY = int.Parse(positionValues.Split("|")[1]); - int posZ = int.Parse(positionValues.Split("|")[2]); - valueContainer.GetNode("./CoordinateX").Value = posX; - valueContainer.GetNode("./CoordinateY").Value = posY; - valueContainer.GetNode("./CoordinateZ").Value = posZ; - - MoveNode moveNode = node as MoveNode; - if (moveNode != null) - { - moveNode.targetPosition = new Vector3I(posX, posY, posZ); - } - } - - public void LoadExplore(string content) { } - - public void LoadCraft(string content) - { - HBoxContainer valueContainer = GetNode("./EditorDisplay/VBoxContainer/Values"); - string[] parts = content.Split(","); - string itemString = parts[1].Replace("Item:", "").Trim(); - if (itemString.ToLower() != "empty") - { - CraftNode craftNode = node as CraftNode; - if (craftNode != null) - { - craftNode.selectedItem = new Item { data = GameData.availableItems[itemString] }; - } - } - string amountString = parts[2].Replace("Amount:", "").Trim(); - valueContainer.GetNode("./Amount").Value = int.Parse(amountString); - } - - public void MoveNodeUp() - { - EmitSignal(SignalName.OnMoveNode, -1); - } - - public void MoveNodeDown() - { - EmitSignal(SignalName.OnMoveNode, 1); - } } diff --git a/Scripts/UI/DSL/NodeDisplays/CraftNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/CraftNodeDisplay.cs new file mode 100644 index 0000000..4090deb --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/CraftNodeDisplay.cs @@ -0,0 +1,71 @@ +using Godot; + +public partial class CraftNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new CraftNode(); + } + + protected override void LoadContent(NodeDisplay display, string content) + { + HBoxContainer valueContainer = GetValueContainer(display); + string[] parts = content.Split(","); + string itemString = parts[1].Replace("Item:", "").Trim(); + if (itemString.ToLower() != "empty") + { + CraftNode craftNode = display.node as CraftNode; + if (craftNode != null) + { + craftNode.selectedItem = new Item { data = GameData.availableItems[itemString] }; + } + } + string amountString = parts[2].Replace("Amount:", "").Trim(); + valueContainer.GetNode("./Amount").Value = int.Parse(amountString); + } + + public override void ReadParameters() + { + CraftNode craftNode = node as CraftNode; + if (craftNode == null) return; + + HBoxContainer valueContainer = GetValueContainer(); + OptionButton items = valueContainer.GetNode("./Item"); + string readableItem = items.GetItemText(items.GetSelectedId()).Split(":")[0]; + if (GameData.availableItems.ContainsKey(ItemData.GetIndex(readableItem))) + { + craftNode.selectedItem = new Item { data = GameData.availableItems[ItemData.GetIndex(readableItem)] }; + } + craftNode.amount = (int)valueContainer.GetNode("./Amount").Value; + } + + public override void SetupDisplay() + { + CraftNode craftNode = node as CraftNode; + if (craftNode == null) return; + + OptionButton options = GetValueContainer().GetNode("./Item"); + options.Clear(); + options.AddItem("Select item..."); + foreach (ItemData item in GameData.availableItems.Values) + { + if (GameData.availableResearch[item.Research].state != ResearchState.RESEARCHED) continue; + if (item.Inputs.Count > 0) + { + options.AddItem(item.GetCraftingDisplay()); + } + } + + if (craftNode.selectedItem != null) + { + for (int i = 0; i < options.ItemCount; i++) + { + if (ItemData.GetIndex(options.GetItemText(i).Split(":")[0]) == craftNode.selectedItem.data.Id) + { + options.Select(i); + break; + } + } + } + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/CraftNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/CraftNodeDisplay.cs.uid new file mode 100644 index 0000000..ea1247a --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/CraftNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://bfosue8mejnr5 diff --git a/Scripts/UI/DSL/NodeDisplays/ExploreNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/ExploreNodeDisplay.cs new file mode 100644 index 0000000..6c2b2b6 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/ExploreNodeDisplay.cs @@ -0,0 +1,7 @@ +public partial class ExploreNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new ExploreNode(); + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/ExploreNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/ExploreNodeDisplay.cs.uid new file mode 100644 index 0000000..335bcb6 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/ExploreNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://bbju8q0es5rcf diff --git a/Scripts/UI/DSL/NodeDisplays/ForNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/ForNodeDisplay.cs new file mode 100644 index 0000000..ae4e268 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/ForNodeDisplay.cs @@ -0,0 +1,31 @@ +using Godot; + +public partial class ForNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new ForNode(); + } + + protected override void LoadContent(NodeDisplay display, string content) + { + HBoxContainer valueContainer = GetValueContainer(display); + string[] parts = content.Split(","); + string amountExecuted = parts[1].Replace("AmountExecuted:", "").Trim(); + ForNode forNode = display.node as ForNode; + if (forNode != null) + { + forNode.amountExecuted = int.Parse(amountExecuted); + } + string amountString = parts[2].Replace("Amount:", "").Trim(); + valueContainer.GetNode("./Amount").Value = int.Parse(amountString); + } + + public override void ReadParameters() + { + ForNode forNode = node as ForNode; + if (forNode == null) return; + + forNode.amount = (int)GetValueContainer().GetNode("./Amount").Value; + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/ForNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/ForNodeDisplay.cs.uid new file mode 100644 index 0000000..300f58d --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/ForNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://gptqyjv5swwc diff --git a/Scripts/UI/DSL/NodeDisplays/HarvestNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/HarvestNodeDisplay.cs new file mode 100644 index 0000000..4e758d4 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/HarvestNodeDisplay.cs @@ -0,0 +1,7 @@ +public partial class HarvestNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new HarvestNode(); + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/HarvestNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/HarvestNodeDisplay.cs.uid new file mode 100644 index 0000000..ac794f9 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/HarvestNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://u2y14qj6oxyy diff --git a/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs new file mode 100644 index 0000000..261f248 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs @@ -0,0 +1,88 @@ +using Godot; + +public partial class IfNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new IfNode(); + } + + protected override void LoadContent(NodeDisplay display, string content) + { + HBoxContainer valueContainer = GetValueContainer(display); + string[] parts = content.Split(","); + string itemString = parts[1].Replace("Item:", "").Trim(); + string comparatorString = parts[2].Replace("Comparator:", "").Trim(); + if (itemString.ToLower() != "empty") + { + IfNode ifNode = display.node as IfNode; + if (ifNode != null) + { + ifNode.selectedItem = new Item { data = GameData.availableItems[itemString] }; + ifNode.comparator = comparatorString; + } + } + string amountString = parts[3].Replace("Amount:", "").Trim(); + valueContainer.GetNode("./Amount").Value = int.Parse(amountString); + } + + public override void ReadParameters() + { + IfNode ifNode = node as IfNode; + if (ifNode == null) return; + + HBoxContainer valueContainer = GetValueContainer(); + OptionButton items = valueContainer.GetNode("./Item"); + string readableItem = items.GetItemText(items.GetSelectedId()).Split(":")[0]; + if (GameData.availableItems.ContainsKey(ItemData.GetIndex(readableItem))) + { + ifNode.selectedItem = new Item { data = GameData.availableItems[ItemData.GetIndex(readableItem)] }; + } + ifNode.amount = (int)valueContainer.GetNode("./Amount").Value; + + OptionButton comparators = valueContainer.GetNode("./Comparator"); + ifNode.comparator = comparators.GetItemText(comparators.GetSelectedId()); + } + + public override void SetupDisplay() + { + IfNode ifNode = node as IfNode; + if (ifNode == null) return; + + HBoxContainer valueContainer = GetValueContainer(); + OptionButton options = valueContainer.GetNode("./Item"); + options.Clear(); + options.AddItem("Select item..."); + foreach (ItemData item in GameData.availableItems.Values) + { + if (GameData.availableResearch[item.Research].state != ResearchState.RESEARCHED) continue; + options.AddItem(item.GetReadableName()); + } + + if (ifNode.selectedItem != null) + { + for (int i = 0; i < options.ItemCount; i++) + { + if (ItemData.GetIndex(options.GetItemText(i).Split(":")[0]) == ifNode.selectedItem.data.Id) + { + options.Select(i); + break; + } + } + } + + OptionButton comparators = valueContainer.GetNode("./Comparator"); + + if (ifNode.comparator != null) + { + for (int i = 0; i < comparators.ItemCount; i++) + { + if (comparators.GetItemText(i) == ifNode.comparator) + { + comparators.Select(i); + break; + } + } + } + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs.uid new file mode 100644 index 0000000..d326aba --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://cngxwfcrim746 diff --git a/Scripts/UI/DSL/NodeDisplays/MaintainNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/MaintainNodeDisplay.cs new file mode 100644 index 0000000..4f5e35f --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/MaintainNodeDisplay.cs @@ -0,0 +1,7 @@ +public partial class MaintainNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new MaintainNode(); + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/MaintainNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/MaintainNodeDisplay.cs.uid new file mode 100644 index 0000000..a07b8a2 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/MaintainNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://wfsar5uiexvn diff --git a/Scripts/UI/DSL/NodeDisplays/MoveNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/MoveNodeDisplay.cs new file mode 100644 index 0000000..ed9e2e0 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/MoveNodeDisplay.cs @@ -0,0 +1,48 @@ +using Godot; + +public partial class MoveNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new MoveNode(); + } + + protected override void LoadContent(NodeDisplay display, string content) + { + HBoxContainer valueContainer = GetValueContainer(display); + string[] parts = content.Split(","); + string positionValues = parts[1].Replace("Position:", "").Replace("(", "").Replace(")", "").Trim(); + int posX = int.Parse(positionValues.Split("|")[0]); + int posY = int.Parse(positionValues.Split("|")[1]); + int posZ = int.Parse(positionValues.Split("|")[2]); + valueContainer.GetNode("./CoordinateX").Value = posX; + valueContainer.GetNode("./CoordinateY").Value = posY; + valueContainer.GetNode("./CoordinateZ").Value = posZ; + + MoveNode moveNode = display.node as MoveNode; + if (moveNode != null) + { + moveNode.targetPosition = new Vector3I(posX, posY, posZ); + } + } + + public override void ReadParameters() + { + MoveNode moveNode = node as MoveNode; + if (moveNode == null) return; + + HBoxContainer valueContainer = GetValueContainer(); + int posX = (int)valueContainer.GetNode("./CoordinateX").Value; + int posY = (int)valueContainer.GetNode("./CoordinateY").Value; + int posZ = (int)valueContainer.GetNode("./CoordinateZ").Value; + moveNode.targetPosition = new Vector3I(posX, posY, posZ); + } + + public override void SetupDisplay() + { + HBoxContainer valueContainer = GetValueContainer(); + valueContainer.GetNode("./CoordinateX").MaxValue = GameData.layerSize; + valueContainer.GetNode("./CoordinateY").MaxValue = GameData.ruinSize; + valueContainer.GetNode("./CoordinateZ").MaxValue = GameData.layerSize; + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/MoveNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/MoveNodeDisplay.cs.uid new file mode 100644 index 0000000..8b07eb7 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/MoveNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://bucamlwjs0mm2 diff --git a/Scripts/UI/DSL/NodeDisplays/SacrificeNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/SacrificeNodeDisplay.cs new file mode 100644 index 0000000..608efb9 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/SacrificeNodeDisplay.cs @@ -0,0 +1,7 @@ +public partial class SacrificeNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new SacrificeNode(); + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/SacrificeNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/SacrificeNodeDisplay.cs.uid new file mode 100644 index 0000000..d270ce1 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/SacrificeNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://cu1nghtcsenfs diff --git a/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs new file mode 100644 index 0000000..b3bca16 --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs @@ -0,0 +1,88 @@ +using Godot; + +public partial class WhileNodeDisplay : NodeDisplay +{ + protected override ProgramNode CreateProgramNode() + { + return new WhileNode(); + } + + protected override void LoadContent(NodeDisplay display, string content) + { + HBoxContainer valueContainer = GetValueContainer(display); + string[] parts = content.Split(","); + string itemString = parts[1].Replace("Item:", "").Trim(); + string comparatorString = parts[2].Replace("Comparator:", "").Trim(); + if (itemString.ToLower() != "empty") + { + WhileNode whileNode = display.node as WhileNode; + if (whileNode != null) + { + whileNode.selectedItem = new Item { data = GameData.availableItems[itemString] }; + whileNode.comparator = comparatorString; + } + } + string amountString = parts[3].Replace("Amount:", "").Trim(); + valueContainer.GetNode("./Amount").Value = int.Parse(amountString); + } + + public override void ReadParameters() + { + WhileNode whileNode = node as WhileNode; + if (whileNode == null) return; + + HBoxContainer valueContainer = GetValueContainer(); + OptionButton items = valueContainer.GetNode("./Item"); + string readableItem = items.GetItemText(items.GetSelectedId()).Split(":")[0]; + if (GameData.availableItems.ContainsKey(ItemData.GetIndex(readableItem))) + { + whileNode.selectedItem = new Item { data = GameData.availableItems[ItemData.GetIndex(readableItem)] }; + } + whileNode.amount = (int)valueContainer.GetNode("./Amount").Value; + + OptionButton comparators = valueContainer.GetNode("./Comparator"); + whileNode.comparator = comparators.GetItemText(comparators.GetSelectedId()); + } + + public override void SetupDisplay() + { + WhileNode whileNode = node as WhileNode; + if (whileNode == null) return; + + HBoxContainer valueContainer = GetValueContainer(); + OptionButton options = valueContainer.GetNode("./Item"); + options.Clear(); + options.AddItem("Select item..."); + foreach (ItemData item in GameData.availableItems.Values) + { + if (GameData.availableResearch[item.Research].state != ResearchState.RESEARCHED) continue; + options.AddItem(item.GetReadableName()); + } + + if (whileNode.selectedItem != null) + { + for (int i = 0; i < options.ItemCount; i++) + { + if (ItemData.GetIndex(options.GetItemText(i).Split(":")[0]) == whileNode.selectedItem.data.Id) + { + options.Select(i); + break; + } + } + } + + OptionButton comparators = valueContainer.GetNode("./Comparator"); + + if (whileNode.comparator != null) + { + for (int i = 0; i < comparators.ItemCount; i++) + { + if (comparators.GetItemText(i) == whileNode.comparator) + { + comparators.Select(i); + break; + } + } + } + } +} diff --git a/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs.uid b/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs.uid new file mode 100644 index 0000000..c5fccfc --- /dev/null +++ b/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs.uid @@ -0,0 +1 @@ +uid://d3npiur46icru