Finished first EA Version #1

Merged
Nicola merged 110 commits from dev into main 2026-05-19 20:01:13 +02:00
22 changed files with 293 additions and 45 deletions
Showing only changes of commit b926be307e - Show all commits
+24
View File
@@ -0,0 +1,24 @@
[gd_scene format=3 uid="uid://cpdfm3wluj3a6"]
[node name="CraftNode" type="PanelContainer" unique_id=1839537826]
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=945032897]
layout_mode = 2
alignment = 1
[node name="Flavour" type="RichTextLabel" parent="HBoxContainer" unique_id=1994560318]
layout_mode = 2
text = "Craft: "
fit_content = true
autowrap_mode = 0
horizontal_alignment = 1
vertical_alignment = 1
[node name="Item" type="OptionButton" parent="HBoxContainer" unique_id=117577134]
layout_mode = 2
[node name="Amount" type="SpinBox" parent="HBoxContainer" unique_id=1195061461]
layout_mode = 2
rounded = true
alignment = 1
prefix = "x"
+24
View File
@@ -0,0 +1,24 @@
[gd_scene format=3 uid="uid://com0ou37wj2xo"]
[node name="HarvestNode" type="PanelContainer" unique_id=970168969]
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=793343398]
layout_mode = 2
alignment = 1
[node name="Flavour" type="RichTextLabel" parent="HBoxContainer" unique_id=1393328640]
layout_mode = 2
text = "Harvest: "
fit_content = true
autowrap_mode = 0
horizontal_alignment = 1
vertical_alignment = 1
[node name="Item" type="OptionButton" parent="HBoxContainer" unique_id=912931137]
layout_mode = 2
[node name="Amount" type="SpinBox" parent="HBoxContainer" unique_id=1234084123]
layout_mode = 2
rounded = true
alignment = 1
prefix = "x"
+33
View File
@@ -0,0 +1,33 @@
[gd_scene format=3 uid="uid://by0khq5dmxjvm"]
[node name="MoveNode" type="PanelContainer" unique_id=245583237]
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=1629099069]
layout_mode = 2
alignment = 1
[node name="Flavour" type="RichTextLabel" parent="HBoxContainer" unique_id=1497013575]
layout_mode = 2
text = "Move to: "
fit_content = true
autowrap_mode = 0
horizontal_alignment = 1
vertical_alignment = 1
[node name="CoordinateX" type="SpinBox" parent="HBoxContainer" unique_id=485214217]
layout_mode = 2
rounded = true
alignment = 1
prefix = "X"
[node name="CoordinateY" type="SpinBox" parent="HBoxContainer" unique_id=724940645]
layout_mode = 2
rounded = true
alignment = 1
prefix = "Y"
[node name="CoordinateZ" type="SpinBox" parent="HBoxContainer" unique_id=578943647]
layout_mode = 2
rounded = true
alignment = 1
prefix = "Z"
+39 -35
View File
@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://cgsmfi2s51cbd"] [gd_scene format=3 uid="uid://cgsmfi2s51cbd"]
[ext_resource type="Script" path="res://Scripts/WorldGeneration/World.cs" id="1_7lihs"] [ext_resource type="Script" uid="uid://br2udyi6t8yvf" path="res://Scripts/WorldGeneration/World.cs" id="1_7lihs"]
[ext_resource type="Script" uid="uid://dqrdb3bvws6b6" path="res://Scripts/Helpers/SteamworksHandler.cs" id="2_b2bpf"] [ext_resource type="Script" uid="uid://dqrdb3bvws6b6" path="res://Scripts/Helpers/SteamworksHandler.cs" id="2_b2bpf"]
[ext_resource type="Script" uid="uid://c7khr6oist3ku" path="res://Scripts/Camera3d.cs" id="3_7lihs"] [ext_resource type="Script" uid="uid://c7khr6oist3ku" path="res://Scripts/Camera3d.cs" id="3_7lihs"]
[ext_resource type="Script" uid="uid://bm7knir4552j5" path="res://Scripts/Helpers/UIHandler.cs" id="4_fgofq"] [ext_resource type="Script" uid="uid://bm7knir4552j5" path="res://Scripts/Helpers/UIHandler.cs" id="4_fgofq"]
@@ -31,7 +31,7 @@ bg_color = Color(0, 0, 0, 0.7647059)
bg_color = Color(0.64705884, 0.58431375, 0.79607844, 0.5176471) bg_color = Color(0.64705884, 0.58431375, 0.79607844, 0.5176471)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2irst"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2irst"]
bg_color = Color(0.44442034, 0.29004335, 0.54089326, 1) bg_color = Color(0.58647984, 0.27039978, 0.75118285, 1)
[node name="Main" type="Node3D" unique_id=234207355] [node name="Main" type="Node3D" unique_id=234207355]
@@ -49,7 +49,10 @@ script = ExtResource("3_7lihs")
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=377970686] [node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=377970686]
environment = SubResource("Environment_sb48q") environment = SubResource("Environment_sb48q")
[node name="Control" type="Control" parent="." unique_id=1713248285] [node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1558432386]
follow_viewport_enabled = true
[node name="Control" type="Control" parent="CanvasLayer" unique_id=1713248285]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@@ -62,7 +65,7 @@ size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
script = ExtResource("4_fgofq") script = ExtResource("4_fgofq")
[node name="MainUI" type="VBoxContainer" parent="Control" unique_id=1437975209] [node name="MainUI" type="VBoxContainer" parent="CanvasLayer/Control" unique_id=1437975209]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@@ -70,94 +73,95 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="HeaderContainer" type="PanelContainer" parent="Control/MainUI" unique_id=1744492333] [node name="HeaderContainer" type="PanelContainer" parent="CanvasLayer/Control/MainUI" unique_id=1744492333]
layout_mode = 2 layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_b2bpf") theme_override_styles/panel = SubResource("StyleBoxFlat_b2bpf")
[node name="Header" type="HBoxContainer" parent="Control/MainUI/HeaderContainer" unique_id=1048237062] [node name="Header" type="HBoxContainer" parent="CanvasLayer/Control/MainUI/HeaderContainer" unique_id=1048237062]
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 200 theme_override_constants/separation = 200
alignment = 1 alignment = 1
[node name="Robotcount" type="RichTextLabel" parent="Control/MainUI/HeaderContainer/Header" unique_id=1955918671] [node name="Robotcount" type="RichTextLabel" parent="CanvasLayer/Control/MainUI/HeaderContainer/Header" unique_id=1955918671]
layout_mode = 2 layout_mode = 2
text = "Roboter: 0/0" text = "Roboter: 0/0"
fit_content = true fit_content = true
autowrap_mode = 0 autowrap_mode = 0
[node name="RobotWarning" type="TextureRect" parent="Control/MainUI/HeaderContainer/Header" unique_id=759915558] [node name="RobotWarning" type="TextureRect" parent="CanvasLayer/Control/MainUI/HeaderContainer/Header" unique_id=759915558]
layout_mode = 2 layout_mode = 2
texture = ExtResource("5_b2bpf") texture = ExtResource("5_b2bpf")
expand_mode = 2 expand_mode = 2
[node name="DayCount" type="RichTextLabel" parent="Control/MainUI/HeaderContainer/Header" unique_id=1228850272] [node name="DayCount" type="RichTextLabel" parent="CanvasLayer/Control/MainUI/HeaderContainer/Header" unique_id=1228850272]
layout_mode = 2 layout_mode = 2
text = "Tag 1" text = "Tag 1"
fit_content = true fit_content = true
autowrap_mode = 0 autowrap_mode = 0
[node name="Time" type="RichTextLabel" parent="Control/MainUI/HeaderContainer/Header" unique_id=1457538761] [node name="Time" type="RichTextLabel" parent="CanvasLayer/Control/MainUI/HeaderContainer/Header" unique_id=1457538761]
layout_mode = 2 layout_mode = 2
text = "19:20" text = "19:20"
fit_content = true fit_content = true
autowrap_mode = 0 autowrap_mode = 0
[node name="LightColor" type="ColorPickerButton" parent="Control/MainUI/HeaderContainer/Header" unique_id=395026790] [node name="LightColor" type="ColorPickerButton" parent="CanvasLayer/Control/MainUI/HeaderContainer/Header" unique_id=395026790]
layout_mode = 2 layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1) theme_override_colors/font_color = Color(1, 1, 1, 1)
text = "Choose Color..." text = "Choose Color..."
[node name="Content" type="Control" parent="Control/MainUI" unique_id=45665557] [node name="Content" type="Control" parent="CanvasLayer/Control/MainUI" unique_id=45665557]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
[node name="CodingWindow" type="PanelContainer" parent="Control/MainUI/Content" unique_id=1576652491] [node name="CodingWindow" type="PanelContainer" parent="CanvasLayer/Control/MainUI/Content" unique_id=1576652491]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 11
anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 offset_left = -684.0
grow_horizontal = 0
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_7lihs") theme_override_styles/panel = SubResource("StyleBoxFlat_7lihs")
script = ExtResource("6_7lihs") script = ExtResource("6_7lihs")
[node name="HBoxContainer" type="HBoxContainer" parent="Control/MainUI/Content/CodingWindow" unique_id=1934932205] [node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow" unique_id=1934932205]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
[node name="CodeBlocks" type="ScrollContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=1196874464] [node name="CodeBlocks" type="ScrollContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=1196874464]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_fgofq") theme_override_styles/panel = SubResource("StyleBoxFlat_fgofq")
[node name="VBoxContainer" type="VBoxContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer/CodeBlocks" unique_id=1751038712] [node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/CodeBlocks" unique_id=1751038712]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
theme_override_constants/separation = 10 theme_override_constants/separation = 10
[node name="EditorWindow" type="Control" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=1904418643] [node name="EditorWindow" type="ScrollContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=2045306791]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 2.0
[node name="Panel" type="Panel" parent="Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=1694893754]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_2irst") theme_override_styles/panel = SubResource("StyleBoxFlat_2irst")
[node name="Robotlist" type="ScrollContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=592644944] [node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=632191528]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_fgofq")
[node name="VBoxContainer" type="VBoxContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer/Robotlist" unique_id=963718788]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
theme_override_constants/separation = 10 theme_override_constants/separation = 10
[connection signal="color_changed" from="Control/MainUI/HeaderContainer/Header/LightColor" to="Control" method="ChangeColor"] [node name="Robotlist" type="ScrollContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=592644944]
layout_mode = 2
size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_fgofq")
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control/MainUI/Content/CodingWindow/HBoxContainer/Robotlist" unique_id=963718788]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 10
[connection signal="color_changed" from="CanvasLayer/Control/MainUI/HeaderContainer/Header/LightColor" to="CanvasLayer/Control" method="ChangeColor"]
+1
View File
@@ -11,6 +11,7 @@ public partial class Camera3d : Camera3D
public override void _Process(double delta) public override void _Process(double delta)
{ {
if(!canMove) return;
float d = (float)delta; float d = (float)delta;
var rotation = RotationDegrees; var rotation = RotationDegrees;
+29 -10
View File
@@ -3,9 +3,16 @@ using System;
public partial class CodingWindow : PanelContainer public partial class CodingWindow : PanelContainer
{ {
public PackedScene movePrefab;
public PackedScene craftPrefab;
public PackedScene harvestPrefab;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
public override void _Ready() public override void _Ready()
{ {
movePrefab = ResourceLoader.LoadMoveNodePrefab();
craftPrefab = ResourceLoader.LoadCraftNodePrefab();
harvestPrefab = ResourceLoader.LoadHarvestNodePrefab();
GenerateCodingBlocks(); GenerateCodingBlocks();
} }
@@ -15,6 +22,7 @@ public partial class CodingWindow : PanelContainer
if (Input.IsActionJustPressed("codingwindow")) if (Input.IsActionJustPressed("codingwindow"))
{ {
Visible = !Visible; Visible = !Visible;
GameData.canMove = !Visible;
if (Visible) if (Visible)
{ {
ReloadRobots(); ReloadRobots();
@@ -25,18 +33,29 @@ public partial class CodingWindow : PanelContainer
//Move, Harvest, Craft //Move, Harvest, Craft
public void GenerateCodingBlocks() public void GenerateCodingBlocks()
{ {
PackedScene nodePrefab = ResourceLoader.LoadProgramNodePrefab(); VBoxContainer codingBlocks = GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer");
Control node1 = nodePrefab.Instantiate<Control>();
node1.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Move";
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node1);
Control node2 = nodePrefab.Instantiate<Control>(); NodeDisplay node = new NodeDisplay();
node2.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Harvest"; MoveNode move = new MoveNode();
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node2); move.editorDisplay = movePrefab;
node.SetNode(move);
node.SetupUIElement();
codingBlocks.AddChild(node);
Control node3 = nodePrefab.Instantiate<Control>();
node3.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Craft"; node = new NodeDisplay();
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node3); CraftNode craft = new CraftNode();
craft.editorDisplay = craftPrefab;
node.SetNode(craft);
node.SetupUIElement();
codingBlocks.AddChild(node);
node = new NodeDisplay();
HarvestNode harvest = new HarvestNode();
harvest.editorDisplay = harvestPrefab;
node.SetNode(harvest);
node.SetupUIElement();
codingBlocks.AddChild(node);
} }
public void ReloadRobots() public void ReloadRobots()
+52
View File
@@ -0,0 +1,52 @@
using System;
using Godot;
public partial class NodeDisplay : RichTextLabel
{
ProgramNode node;
bool isHovering = false;
bool isDragging = false;
public void SetNode(ProgramNode node)
{
this.node = node;
}
public void SetupUIElement()
{
Text = node.DisplayText;
FitContent = true;
HorizontalAlignment = HorizontalAlignment.Center;
AutowrapMode = TextServer.AutowrapMode.Off;
GuiInput += HandleInput;
StyleBoxFlat styleBox = new StyleBoxFlat
{
BorderColor = new Color(1, 1, 1),
BgColor = new Color(0, 0, 0, 0.5f)
};
styleBox.SetBorderWidthAll(2);
styleBox.SetCornerRadiusAll(6);
AddThemeStyleboxOverride("normal", styleBox);
}
public override void _Ready()
{
}
public override void _Process(double delta)
{
if (Input.IsActionJustPressed("left_click"))
{
}
}
public void HandleInput(InputEvent input)
{
if (input is InputEventMouseButton mouseEvent && mouseEvent.ButtonIndex == MouseButton.Left && mouseEvent.IsReleased())
{
GetNode<Control>("../../../EditorWindow/VBoxContainer").AddChild(node.editorDisplay.Instantiate());
}
}
}
+1
View File
@@ -0,0 +1 @@
uid://b6kxwmuhmruul
+14
View File
@@ -0,0 +1,14 @@
using Godot;
public class CraftNode : ProgramNode
{
public CraftNode()
{
DisplayText = "Craft";
}
public override void Execute(Robot robot)
{
GD.Print("Craft");
nextNode.Execute(robot);
}
}
+1
View File
@@ -0,0 +1 @@
uid://dcm23bpi37va
+14
View File
@@ -0,0 +1,14 @@
using Godot;
public class HarvestNode : ProgramNode
{
public HarvestNode()
{
DisplayText = "Harvest";
}
public override void Execute(Robot robot)
{
GD.Print("Harvest");
nextNode.Execute(robot);
}
}
+1
View File
@@ -0,0 +1 @@
uid://bb8g5ukg7xnw
+16
View File
@@ -0,0 +1,16 @@
using Godot;
public class MoveNode : ProgramNode
{
public Vector3 startPosition;
public Vector3 targetPosition;
public MoveNode()
{
DisplayText = "Move";
}
public override void Execute(Robot robot)
{
robot.Position = targetPosition;
nextNode.Execute(robot);
}
}
+1
View File
@@ -0,0 +1 @@
uid://c1yd2vdej67q3
+18
View File
@@ -0,0 +1,18 @@
using Godot;
public abstract class ProgramNode
{
protected ProgramNode nextNode;
public string DisplayText;
public PackedScene editorDisplay;
public ProgramNode()
{
}
public abstract void Execute(Robot robot);
public void LinkNode(ProgramNode nextNode)
{
this.nextNode = nextNode;
}
}
+1
View File
@@ -0,0 +1 @@
uid://hc0yntn2d358
View File
+1
View File
@@ -0,0 +1 @@
uid://hui5wolo5rbr
View File
+1
View File
@@ -0,0 +1 @@
uid://dcxom1paffp0p
+15
View File
@@ -19,6 +19,21 @@ public partial class ResourceLoader
{ {
return GD.Load<PackedScene>($"res://Prefabs/ProgramNode.tscn"); return GD.Load<PackedScene>($"res://Prefabs/ProgramNode.tscn");
} }
public static PackedScene LoadMoveNodePrefab()
{
return GD.Load<PackedScene>($"res://Prefabs/DSL/MoveNode.tscn");
}
public static PackedScene LoadHarvestNodePrefab()
{
return GD.Load<PackedScene>($"res://Prefabs/DSL/HarvestNode.tscn");
}
public static PackedScene LoadCraftNodePrefab()
{
return GD.Load<PackedScene>($"res://Prefabs/DSL/CraftNode.tscn");
}
public static Dictionary<string, MeshInstance3D> LoadTiles() public static Dictionary<string, MeshInstance3D> LoadTiles()
{ {
+7
View File
@@ -21,6 +21,8 @@ config/icon="res://icon.svg"
[display] [display]
window/size/viewport_width=1920
window/size/viewport_height=1080
window/size/mode=2 window/size/mode=2
window/size/initial_position_type=3 window/size/initial_position_type=3
window/size/borderless=true window/size/borderless=true
@@ -80,6 +82,11 @@ codingwindow={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null)
] ]
} }
left_click={
"deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(394, 15),"global_position":Vector2(403, 63),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
[layer_names] [layer_names]