scene changers should be clearing all spawned objects on scene exit

This commit is contained in:
derek
2025-04-03 16:59:46 -05:00
parent 0c76ba47f7
commit 32b9efbd92
3 changed files with 6 additions and 4 deletions

View File

@@ -1,6 +1,5 @@
[gd_scene load_steps=22 format=3 uid="uid://uo43j7bomkf3"]
[gd_scene load_steps=21 format=3 uid="uid://uo43j7bomkf3"]
[ext_resource type="Script" uid="uid://b81yg4r8e5ecj" path="res://scripts/subscene.gd" id="1_ie2kr"]
[ext_resource type="PackedScene" uid="uid://cwy8iv8nlwqrc" path="res://assets/realtime_day_night_cycle.tscn" id="3_uc3ig"]
[ext_resource type="Script" uid="uid://12l74jckdnpl" path="res://scripts/room_manager.gd" id="4_iqtg8"]
[ext_resource type="PackedScene" uid="uid://djr7vnr1hcx82" path="res://assets/spider2.tscn" id="5_vb31s"]
@@ -30,8 +29,6 @@ albedo_color = Color(0.300579, 0.462784, 0.249767, 1)
size = Vector3(722.834, 289.347, 420.508)
[node name="Highwire" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0566635, 0.403625, 0.0430908)
script = ExtResource("1_ie2kr")
[node name="Realtime Day Night Cycle" parent="." instance=ExtResource("3_uc3ig")]
transform = Transform3D(0.510503, -0.00501647, 0.859861, 0.00982605, 0.999952, 1.08313e-09, -0.85982, 0.00844904, 0.510527, -41.021, 0, 40.533)

View File

@@ -19,6 +19,7 @@ var rot_amount : float
func _ready():
SignalBus.enemy_killed.connect(enemy_in_room_killed)
SignalBus.game_loaded.connect(assign_elements)
assign_elements()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):

View File

@@ -27,6 +27,10 @@ func _on_body_entered(body: Node3D) -> void:
for i in spawned_stuff:
i.queue_free()
func clear_spawned_objects():
for i in get_tree().current_scene:
if i.is_in_group("spawned"):
i.queue_free()
func _on_start_activation_timeout() -> void:
active = true