Clear designation tile-highlight when jobs complete
Each entity completion handler (wall/floor/door/bed/torch/workbench/crate /tree/rock/big_rock/grave_slot) now calls World.clear_designation_at(tile) so the orange/blue/etc. highlight overlay disappears with the job. BigRock iterates its footprint to clear all four tiles. World.designation_ctl is set during the scene boot wire-up; the helper no-ops when the controller is absent (e.g. headless tests).
This commit is contained in:
parent
6abd53c6f5
commit
f67c12c51f
13 changed files with 29 additions and 0 deletions
|
|
@ -28,6 +28,11 @@ var stockpiles: Array = [] # Array of StorageDestination (StockpileZone for
|
|||
# its _ready(). Don't access before the world scene is mounted.
|
||||
var pathfinder = null
|
||||
|
||||
## Reference to the in-scene Designation controller. Wired by world.gd _ready
|
||||
## so entities completing a job can call World.clear_designation_at(tile) to
|
||||
## remove the lingering ghost paint without depending on the scene tree path.
|
||||
var designation_ctl = null
|
||||
|
||||
# Phase 5 — build queue. Holds Wall/Floor/Door/Crate ghost entities (not yet
|
||||
# completed). ConstructionProvider iterates this for the nearest buildable site.
|
||||
# Entities call register_build_site() in _ready and unregister_build_site() when
|
||||
|
|
@ -83,6 +88,14 @@ var grave_markers: Array = []
|
|||
var items_needing_haul: Dictionary = {}
|
||||
|
||||
|
||||
## Clear the designation ghost at `tile`, if any. Entities call this from
|
||||
## their _complete / fell / mined handlers so the visual highlight disappears
|
||||
## once the job is done. Safe no-op if designation_ctl isn't wired (headless).
|
||||
func clear_designation_at(tile: Vector2i) -> void:
|
||||
if designation_ctl != null:
|
||||
designation_ctl.clear_cell(tile)
|
||||
|
||||
|
||||
func register_work_provider(wp) -> void:
|
||||
assert(wp != null, "World.register_work_provider: provider is null")
|
||||
if not work_providers.has(wp):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue