Finished first EA Version #1

Merged
Nicola merged 110 commits from dev into main 2026-05-19 20:01:13 +02:00
18 changed files with 57 additions and 11 deletions
Showing only changes of commit 287cb4df78 - Show all commits
+1 -1
View File
@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://ck10wk10me3tx"]
[ext_resource type="Script" path="res://Scripts/Helpers/Layer.cs" id="1_trar1"]
[ext_resource type="Script" path="res://Scripts/WorldGeneration/Layer.cs" id="1_trar1"]
[node name="Node3D" type="Node3D" unique_id=724642284]
script = ExtResource("1_trar1")
+21 -5
View File
@@ -1,11 +1,11 @@
[gd_scene format=3 uid="uid://cgsmfi2s51cbd"]
[ext_resource type="Script" uid="uid://br2udyi6t8yvf" path="res://Scripts/World.cs" id="1_kldst"]
[ext_resource type="Script" uid="uid://dqrdb3bvws6b6" path="res://Scripts/SteamworksHandler.cs" id="2_b2bpf"]
[ext_resource type="Script" 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://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="Texture2D" uid="uid://bmcpkt6mae2qi" path="res://Assets/AlarmSign.png" id="5_b2bpf"]
[ext_resource type="Script" uid="uid://bsd6n6b06a4pe" path="res://Scripts/CodingWindow.cs" id="6_7lihs"]
[ext_resource type="Script" uid="uid://bsd6n6b06a4pe" path="res://Scripts/DSL/CodingWindow.cs" id="6_7lihs"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
@@ -27,10 +27,16 @@ bg_color = Color(0.053073194, 0.053073194, 0.053073194, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7lihs"]
bg_color = Color(0, 0, 0, 0.7647059)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fgofq"]
bg_color = Color(0.64705884, 0.58431375, 0.79607844, 0.5176471)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2irst"]
bg_color = Color(0.44442034, 0.29004335, 0.54089326, 1)
[node name="Main" type="Node3D" unique_id=234207355]
[node name="World" type="Node3D" parent="." unique_id=770208789]
script = ExtResource("1_kldst")
script = ExtResource("1_7lihs")
[node name="SteamworksHandler" type="Node" parent="." unique_id=1183440473]
script = ExtResource("2_b2bpf")
@@ -106,7 +112,6 @@ layout_mode = 2
size_flags_vertical = 3
[node name="CodingWindow" type="PanelContainer" parent="Control/MainUI/Content" unique_id=1576652491]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@@ -123,6 +128,7 @@ size_flags_vertical = 3
[node name="CodeBlocks" type="ScrollContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=1196874464]
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/CodeBlocks" unique_id=1751038712]
layout_mode = 2
@@ -134,9 +140,19 @@ theme_override_constants/separation = 10
layout_mode = 2
size_flags_horizontal = 3
[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")
[node name="Robotlist" type="ScrollContainer" parent="Control/MainUI/Content/CodingWindow/HBoxContainer" unique_id=592644944]
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
+1 -1
View File
@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://dlommaelbbw2b"]
[ext_resource type="Script" uid="uid://dda0bhhqspbr0" path="res://Scripts/MainMenu.cs" id="1_tt5f1"]
[ext_resource type="Script" uid="uid://dda0bhhqspbr0" path="res://Scripts/Menus/MainMenu.cs" id="1_tt5f1"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bnhvo"]
bg_color = Color(0.24115604, 0.24115607, 0.24115595, 1)
@@ -12,7 +12,14 @@ public partial class CodingWindow : PanelContainer
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
if (Input.IsActionJustPressed("codingwindow")) Visible = !Visible;
if (Input.IsActionJustPressed("codingwindow"))
{
Visible = !Visible;
if (Visible)
{
ReloadRobots();
}
}
}
//Move, Harvest, Craft
@@ -31,4 +38,23 @@ public partial class CodingWindow : PanelContainer
node3.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = "Craft";
GetNode<VBoxContainer>("./HBoxContainer/CodeBlocks/VBoxContainer").AddChild(node3);
}
public void ReloadRobots()
{
VBoxContainer robotList = GetNode<VBoxContainer>("./HBoxContainer/Robotlist/VBoxContainer");
foreach(Node node in robotList.GetChildren())
{
robotList.RemoveChild(node);
node.QueueFree();
}
PackedScene nodePrefab = ResourceLoader.LoadProgramNodePrefab();
Control robot;
foreach (Robot robotObject in GameData.robots)
{
robot = nodePrefab.Instantiate<Control>();
robot.GetNode<RichTextLabel>("./Node/NodeContainer/NodeText").Text = robotObject.Position.ToString();
GetNode<VBoxContainer>("./HBoxContainer/Robotlist/VBoxContainer").AddChild(robot);
}
}
}
+4
View File
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using Godot;
public partial class GameData
@@ -8,6 +9,9 @@ public partial class GameData
public static int visibleLayer = 0;
//Determines if the player can move the camera or not (Necessary for input and options menu)
public static bool canMove = true;
public static int maxRobotCount = 1000;
public static List<Robot> robots = new List<Robot>();
//--- PLAYER ADJUSTABLE VALUES ---
//Color used in primary objects (e.g. Robots)
public static Color primaryColor = new Color("#276ac2");
@@ -84,12 +84,12 @@ public partial class World : Node3D
visibleLayer = currentLayer;
}
if (Input.IsActionJustPressed("spawn_robot"))
if (Input.IsActionJustPressed("spawn_robot") && robots.Count < maxRobotCount)
{
Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate<Robot>();
robot.Position = map[0].tiles[1, 1].Position;
robot.Position -= new Vector3(0, 1.5f, 0);
robot.Position = map[0].tiles[rand.Next(layerSize), rand.Next(layerSize)].Position;
AddChild(robot);
robots.Add(robot);
}
}