From 22413fabd58dfb239c35d297db9e25feed4019da Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Sun, 25 Oct 2026 15:03:59 -0500 Subject: [PATCH] Setup debug coloring for spawners --- autoloads/globals.gd | 8 ++++ game.tscn | 3 ++ scripts/controllers/spawn_system/spawner.gd | 17 ++++++++- scripts/controllers/spawn_system/spawner.tscn | 38 ++++++++++++++----- 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/autoloads/globals.gd b/autoloads/globals.gd index 33603b8..25e6f98 100644 --- a/autoloads/globals.gd +++ b/autoloads/globals.gd @@ -1,12 +1,20 @@ extends Node +const debugging: bool = true + enum Faction { ALLIES, AXIS, NEUTRAL } +const FactionColor = { + Faction.ALLIES: Color(0.281, 0.493, 0.989, 1.0), + Faction.AXIS: Color(1.0, 0.274, 0.213, 1.0), + Faction.NEUTRAL: Color(0.71, 0.584, 0.0, 1.0) +} + enum ControllerCommand { NONE, PULL_UP, diff --git a/game.tscn b/game.tscn index b3f4bc4..bac1a9f 100644 --- a/game.tscn +++ b/game.tscn @@ -38,3 +38,6 @@ faction = 1 [node name="game_controller" parent="controller_manager" instance=ExtResource("7_vef74")] [node name="game_mode" parent="controller_manager/game_controller" instance=ExtResource("3_fc0e3")] + +[node name="spawner" parent="." instance=ExtResource("5_ryrav")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 84.06215, 2.5178223, -76.95647) diff --git a/scripts/controllers/spawn_system/spawner.gd b/scripts/controllers/spawn_system/spawner.gd index 29f40c6..f660346 100644 --- a/scripts/controllers/spawn_system/spawner.gd +++ b/scripts/controllers/spawn_system/spawner.gd @@ -8,7 +8,22 @@ var delay_timer: Timer = null func _ready() -> void: - pass + _debug_setup() + + +func _debug_setup() -> void: + if not Globals.debugging: + visible = false + return + + var timer = get_tree().create_timer(0.200) + await timer.timeout + + visible = true + var visual_node: MeshInstance3D = get_node("visual") + var visual_node2: MeshInstance3D = get_node("visual_direction") + visual_node.mesh.material.albedo_color = Globals.FactionColor[faction] + visual_node2.mesh.material.albedo_color = Globals.FactionColor[faction] func _on_area_body_entered(_body: Jet) -> void: if delay_timer: diff --git a/scripts/controllers/spawn_system/spawner.tscn b/scripts/controllers/spawn_system/spawner.tscn index 3070b46..0e6d3bf 100644 --- a/scripts/controllers/spawn_system/spawner.tscn +++ b/scripts/controllers/spawn_system/spawner.tscn @@ -1,20 +1,38 @@ -[gd_scene load_steps=3 format=3 uid="uid://bgrku2wvaadgg"] +[gd_scene load_steps=7 format=3 uid="uid://bgrku2wvaadgg"] [ext_resource type="Script" uid="uid://2xevacik8ja4" path="res://scripts/controllers/spawn_system/spawner.gd" id="1_yd0ab"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_yd0ab"] +resource_local_to_scene = true + +[sub_resource type="BoxMesh" id="BoxMesh_7k17k"] +resource_local_to_scene = true +material = SubResource("StandardMaterial3D_yd0ab") +size = Vector3(20, 10, 25) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7k17k"] +resource_local_to_scene = true + +[sub_resource type="BoxMesh" id="BoxMesh_8iah5"] +resource_local_to_scene = true +material = SubResource("StandardMaterial3D_7k17k") +size = Vector3(12, 1, 4) + [sub_resource type="BoxShape3D" id="BoxShape3D_7k17k"] size = Vector3(20, 10, 25) [node name="spawner" type="Area3D"] script = ExtResource("1_yd0ab") -[node name="detector" type="CollisionShape3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9008179, 0) -shape = SubResource("BoxShape3D_7k17k") +[node name="visual" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) +mesh = SubResource("BoxMesh_7k17k") -[node name="ray" type="RayCast3D" parent="."] -transform = Transform3D(1, 0, 0, 0, -4.3711385e-08, -0.99999994, 0, 0.99999994, -4.3711385e-08, 0, 0, -12.65) -top_level = true -enabled = false -hit_back_faces = false -collide_with_bodies = false +[node name="visual_direction" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, -14.107723) +mesh = SubResource("BoxMesh_8iah5") +skeleton = NodePath("../visual") + +[node name="detector" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) +shape = SubResource("BoxShape3D_7k17k")