From 72863ffa31e27f4c6be862d80472cfb897fccaea Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 19 Nov 2024 15:24:50 +0100 Subject: next commit --- Game/Client.gd | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'Game/Client.gd') diff --git a/Game/Client.gd b/Game/Client.gd index 7ca26ec..13fae56 100644 --- a/Game/Client.gd +++ b/Game/Client.gd @@ -6,7 +6,7 @@ signal stage_state_changed(state: State) @warning_ignore("unused_signal") signal placed_tower(tower: Tower) -signal multi_select_finished +signal multi_select_finished(nodes) var state: State : @@ -24,10 +24,11 @@ var player: Player: func initialize_stage(stage: Stage): + current_stage = stage + +func ready_stage(_stage: Stage): selection = preload("res://Game/Selection/SelectionManager.tscn").instantiate() add_child(selection) - - current_stage = stage func place_tower(tower: Tower): @@ -72,7 +73,7 @@ func multi_select(layer: int): selection_area.select.connect(func(nodes): for node in nodes: Client.select_tower(node) - multi_select_finished.emit() + multi_select_finished.emit(nodes) ) get_tree().current_scene.add_child(selection_area) @@ -91,8 +92,8 @@ func spawn_unit(unit: Unit, spawn: Spawn, overwrite_target: PathNode = null): unit.global_position = spawn.spawn_position unit.target = spawn.next_node - unit.hp = randi_range(5, 10) #20000b - unit.base_speed = randi_range(50, 150) + #unit.hp = randi_range(5, 10) #20000b + #unit.base_speed = randi_range(50, 150) if overwrite_target: unit.target = overwrite_target @@ -105,6 +106,14 @@ func update_unit(path: NodePath, data: Unit.NetworkData): Network.update_unit.rpc(path, inst_to_dict(data)) +func change_scene_to_instance(scene: Node): + (func(): + get_tree().current_scene.queue_free() + get_tree().root.add_child(scene) + get_tree().current_scene = scene + ).call_deferred() + + func array_intersect(first, second): var compare = {} for value in first: -- cgit v1.2.3