From 6db6465d1b938ec494cd66c9984bff5cc14bde11 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 20 Oct 2024 12:09:48 +0200 Subject: next commit --- Stages/Stage.gd | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Stages/Stage.gd') diff --git a/Stages/Stage.gd b/Stages/Stage.gd index cdffca9..a3608ee 100644 --- a/Stages/Stage.gd +++ b/Stages/Stage.gd @@ -4,6 +4,7 @@ extends Node signal path_grid_changed +static var maps: Array[TileMapLayer] static var map: TileMapLayer static var path_grid: AStarGrid2D static var last_solid_set_points: Array[Vector2] @@ -14,7 +15,8 @@ func _init() -> void: func _ready() -> void: - map = get_node("%Map") + maps = [get_node("%Map")] + map = maps[0] path_grid = AStarGrid2D.new() path_grid.region = map.get_used_rect() @@ -26,10 +28,12 @@ func _ready() -> void: assert(get_node("%StateManager"), "StateManager missing") assert(get_node("%StateManager").get_children().size() > 0, "StateManager has no States") - for cell in map.get_used_cells(): - var tile_data = map.get_cell_tile_data(cell) - if tile_data.get_collision_polygons_count(0) > 0: - path_grid.set_point_solid(cell, true) + @warning_ignore("shadowed_variable") + for map in maps: + for cell in map.get_used_cells(): + var tile_data = map.get_cell_tile_data(cell) + if tile_data.get_collision_polygons_count(0) > 0: + path_grid.set_point_solid(cell, true) func place_tower(_remote_data: Dictionary) -> void: @@ -81,8 +85,8 @@ func _spawn_unit(parent: Node2D, unit: Unit): parent.add_child(unit, true) -func transform_players(script: Script): - for player in Network.get_node("%Players").get_children(): +func set_player_script(script: Script): + for player in Network.get_players(): var previous_values := {} var property_list = player.get_script().get_script_property_list().filter(func(item): return item.type != 0 -- cgit v1.2.3