summaryrefslogtreecommitdiff
path: root/Game/Network.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-10-20 12:09:48 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-10-20 12:09:48 +0200
commit6db6465d1b938ec494cd66c9984bff5cc14bde11 (patch)
tree9533b364e3e40ff813ef263ab05bd69ac31f8777 /Game/Network.gd
parente82990eeafdf0be5d42d8aaa9b7fb6091e0d8435 (diff)
next commit
Diffstat (limited to 'Game/Network.gd')
-rw-r--r--Game/Network.gd9
1 files changed, 5 insertions, 4 deletions
diff --git a/Game/Network.gd b/Game/Network.gd
index 5a435b7..be5bb20 100644
--- a/Game/Network.gd
+++ b/Game/Network.gd
@@ -114,10 +114,11 @@ func update_player(id: int, remote_data: Dictionary):
@rpc("any_peer")
#func destroy_tower(remote_tower: Dictionary):
-func destroy_tower(position: Vector2):
- var owner_id = multiplayer.get_remote_sender_id()
- var player = get_player(owner_id)
- var tower = player.towers.get(position)
+func destroy_tower(remote_data: Dictionary):
+ var data: Tower.NetworkData = dict_to_inst(remote_data)
+ var remote_tower = Tower.from_network_data(data)
+ var player = get_player(remote_tower.owner_id)
+ var tower = player.towers.get(remote_tower.global_position)
Client.current_stage.destroy_tower(tower)