summaryrefslogtreecommitdiff
path: root/Game/Client.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-19 15:24:50 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-19 15:24:50 +0100
commit72863ffa31e27f4c6be862d80472cfb897fccaea (patch)
treece04be8d77b10c797c8ff854c8ff1a219eb1af46 /Game/Client.gd
parent63d2a59042fb9d90a586ad85d8364de7c38aea8e (diff)
next commitHEADmain
Diffstat (limited to 'Game/Client.gd')
-rw-r--r--Game/Client.gd21
1 files changed, 15 insertions, 6 deletions
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: