summaryrefslogtreecommitdiff
path: root/Game/Network.gd
diff options
context:
space:
mode:
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)