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):
|
||||
|
|
|
|||
|
|
@ -279,6 +279,7 @@ func _complete() -> void:
|
|||
if sprite != null:
|
||||
sprite.modulate.a = 1.0
|
||||
queue_redraw()
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("bed", "%s built at %s" % [label_text, tile])
|
||||
# Phase 13 — notify BeautySystem so nearby tile beauty scores update.
|
||||
var bs = World.get("beauty_system")
|
||||
|
|
|
|||
|
|
@ -149,6 +149,9 @@ func mined() -> void:
|
|||
Audit.log("big_rock", "mined 2×2 at %s; %d stone drops" % [origin_tile, STONE_DROPS_ON_MINE])
|
||||
if Audio != null:
|
||||
Audio.play_sfx(&"mine_tick")
|
||||
# BigRocks span 2×2 — clear the designation stamp from every footprint tile.
|
||||
for ft in footprint_tiles():
|
||||
World.clear_designation_at(ft)
|
||||
queue_free()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -181,4 +181,5 @@ func _complete() -> void:
|
|||
if sprite != null:
|
||||
sprite.modulate.a = 1.0
|
||||
queue_redraw()
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("door", "door completed at %s" % tile)
|
||||
|
|
|
|||
|
|
@ -172,4 +172,5 @@ func _complete() -> void:
|
|||
# Floors do NOT block pathfinding — no pathfinder call here.
|
||||
World.mark_floor_tile(tile, floor_material)
|
||||
queue_redraw()
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("floor", "%s floor completed at %s" % [floor_material, tile])
|
||||
|
|
|
|||
|
|
@ -224,4 +224,5 @@ func from_dict(d: Dictionary) -> void:
|
|||
func _complete_dig() -> void:
|
||||
_dug = true
|
||||
queue_redraw()
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("grave_slot", "grave dug at %s (ready for burial)" % tile)
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ func mined() -> void:
|
|||
Audit.log("rock", "mined at %s; %d stone drop" % [tile, STONE_DROPS_ON_MINE])
|
||||
if Audio != null:
|
||||
Audio.play_sfx(&"mine_tick")
|
||||
World.clear_designation_at(tile)
|
||||
queue_free()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ func _complete() -> void:
|
|||
if _light != null:
|
||||
_light.enabled = _is_on
|
||||
queue_redraw()
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("torch", "built at %s" % tile)
|
||||
# Phase 13 — notify BeautySystem so nearby tile beauty scores update.
|
||||
var bs = World.get("beauty_system")
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ func fell() -> void:
|
|||
Audit.log("tree", "felled at %s; %d wood drops" % [tile, drops_count])
|
||||
if Audio != null:
|
||||
Audio.play_sfx(&"tree_fell")
|
||||
World.clear_designation_at(tile)
|
||||
queue_free()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -241,4 +241,5 @@ func _complete() -> void:
|
|||
queue_redraw()
|
||||
|
||||
queue_redraw()
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("wall", "%s wall completed at %s" % [wall_material, tile])
|
||||
|
|
|
|||
|
|
@ -419,6 +419,7 @@ func _complete() -> void:
|
|||
if _light != null:
|
||||
_light.enabled = is_on()
|
||||
queue_redraw()
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("workbench", "%s built at %s" % [label_text, tile])
|
||||
# Phase 13 — notify BeautySystem so nearby tile beauty scores update.
|
||||
# Hearth gets base beauty 4 (warm glow); other benches get 1.
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ func on_build_tick() -> void:
|
|||
if build_progress >= BUILD_TICKS:
|
||||
_completed = true
|
||||
emit_signal("contents_changed")
|
||||
World.clear_designation_at(tile)
|
||||
Audit.log("crate", "built at %s (capacity %d)" % [tile, CAPACITY])
|
||||
queue_redraw()
|
||||
|
||||
|
|
|
|||
|
|
@ -185,6 +185,9 @@ func _ready() -> void:
|
|||
|
||||
# Designation: bind the paint surface + the Selection guard.
|
||||
designation_ctl.bind(designation_layer, selection)
|
||||
# Expose on the autoload so entities can clear their ghost stamp on
|
||||
# completion (Tree.fell, Wall._complete, etc.).
|
||||
World.designation_ctl = designation_ctl
|
||||
|
||||
# Register all 10 providers — Decision iterates by .priority desc.
|
||||
# doctor=9 > sleep=8 > eat=7 > construction=6 > chop=5 ≈ plant=5 > mine=4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue