summaryrefslogtreecommitdiff
path: root/Towers
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-10-12 23:09:56 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-10-12 23:09:56 +0200
commit0697f674ec33f8381ba68cf064732ee40e6e584f (patch)
tree89334f288356390d193fa327bb3895fa366985b5 /Towers
parent647e2e1812c00e29337a61560644f7aa91d0eb0f (diff)
next commit
Diffstat (limited to 'Towers')
-rw-r--r--Towers/Tower.gd9
1 files changed, 6 insertions, 3 deletions
diff --git a/Towers/Tower.gd b/Towers/Tower.gd
index 10753eb..30af802 100644
--- a/Towers/Tower.gd
+++ b/Towers/Tower.gd
@@ -63,7 +63,7 @@ func _ready():
func _draw():
if is_selected:
draw_circle(
- Client.stage.map.tile_set.tile_size,
+ Client.current_stage.map.tile_set.tile_size,
8 + attack_range,
Color(1, 1, 1, 0.75),
false,
@@ -73,7 +73,7 @@ func _draw():
elif is_hovered:
if Client.state is StateDefault:
draw_circle(
- Client.stage.map.tile_set.tile_size,
+ Client.current_stage.map.tile_set.tile_size,
8 + attack_range,
Color(1, 1, 1, 0.5),
false,
@@ -162,7 +162,7 @@ func redraw_components():
func is_melee_range():
- return attack_range <= (Client.stage.map.tile_set.tile_size.x * 2)
+ return attack_range <= (Client.current_stage.map.tile_set.tile_size.x * 2)
func shoot():
@@ -249,6 +249,7 @@ func _on_h_box_container_2_gui_input(event: InputEvent) -> void:
class NetworkData extends Resource:
var name: String
+ var owner_id: int
var position: Vector2
var components: Array
@@ -259,6 +260,7 @@ func to_network_data() -> NetworkData:
var data = NetworkData.new()
data.name = name
+ data.owner_id = owner_id
data.position = global_position
data.components = components.map(func(item: TowerComponent):
return item.name
@@ -284,6 +286,7 @@ static func from_network_data(data: NetworkData) -> Tower:
var tower: Tower = preload("res://Towers/Tower.tscn").instantiate()
tower.name = data.name
+ tower.owner_id = data.owner_id
tower.global_position = data.position
return tower