fix(@projects/@magic-civilization): 🐛 update renderer sync logic
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
9763b4b374
commit
00b157ecfc
1 changed files with 12 additions and 10 deletions
|
|
@ -94,23 +94,25 @@ func _ready() -> void:
|
|||
var empty_fog: Array[Vector2i] = []
|
||||
hex.update_fog(all_positions, empty_fog)
|
||||
|
||||
# Aggregate every player's units / cities and feed them into the
|
||||
# renderers via their canonical sync_* surfaces.
|
||||
var all_units: Array = []
|
||||
var all_cities: Array = []
|
||||
for p: Variant in GameState.players:
|
||||
if p is PlayerScript:
|
||||
all_units.append_array((p as PlayerScript).units)
|
||||
all_cities.append_array((p as PlayerScript).cities)
|
||||
|
||||
var units: Node2D = UnitRendererScript.new()
|
||||
units.name = "UnitRenderer"
|
||||
add_child(units)
|
||||
if units.has_method("setup_visibility"):
|
||||
units.call("setup_visibility", 0, game_map)
|
||||
if units.has_method("render_units"):
|
||||
units.call("render_units", game_map)
|
||||
elif units.has_method("refresh"):
|
||||
units.call("refresh")
|
||||
units.call("setup_visibility", 0, game_map)
|
||||
units.call("sync_units", all_units)
|
||||
|
||||
var cities: Node2D = CityRendererScript.new()
|
||||
cities.name = "CityRenderer"
|
||||
add_child(cities)
|
||||
if cities.has_method("refresh"):
|
||||
cities.call("refresh")
|
||||
elif cities.has_method("render_cities"):
|
||||
cities.call("render_cities")
|
||||
cities.call("sync_cities", all_cities)
|
||||
|
||||
# Camera centred on the actual pixel-bbox of the rendered tiles. The
|
||||
# axial→pixel transform isn't a simple linear scale (flat-top hex offset
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue