From f67c12c51f4c6441d23dfff492884e39f52294de Mon Sep 17 00:00:00 2001 From: megaproxy Date: Fri, 15 May 2026 19:31:55 +0100 Subject: [PATCH] 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). --- autoload/world.gd | 13 +++++++++++++ scenes/entities/bed.gd | 1 + scenes/entities/big_rock.gd | 3 +++ scenes/entities/door.gd | 1 + scenes/entities/floor.gd | 1 + scenes/entities/grave_slot.gd | 1 + scenes/entities/rock.gd | 1 + scenes/entities/torch.gd | 1 + scenes/entities/tree.gd | 1 + scenes/entities/wall.gd | 1 + scenes/entities/workbench.gd | 1 + scenes/world/crate.gd | 1 + scenes/world/world.gd | 3 +++ 13 files changed, 29 insertions(+) diff --git a/autoload/world.gd b/autoload/world.gd index 93a0c92..9169dac 100644 --- a/autoload/world.gd +++ b/autoload/world.gd @@ -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): diff --git a/scenes/entities/bed.gd b/scenes/entities/bed.gd index aca6e25..47cb226 100644 --- a/scenes/entities/bed.gd +++ b/scenes/entities/bed.gd @@ -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") diff --git a/scenes/entities/big_rock.gd b/scenes/entities/big_rock.gd index cf567c7..93123c6 100644 --- a/scenes/entities/big_rock.gd +++ b/scenes/entities/big_rock.gd @@ -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() diff --git a/scenes/entities/door.gd b/scenes/entities/door.gd index 9fc1556..2cf6516 100644 --- a/scenes/entities/door.gd +++ b/scenes/entities/door.gd @@ -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) diff --git a/scenes/entities/floor.gd b/scenes/entities/floor.gd index 1c5210b..f447c71 100644 --- a/scenes/entities/floor.gd +++ b/scenes/entities/floor.gd @@ -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]) diff --git a/scenes/entities/grave_slot.gd b/scenes/entities/grave_slot.gd index 178a63f..87650ea 100644 --- a/scenes/entities/grave_slot.gd +++ b/scenes/entities/grave_slot.gd @@ -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) diff --git a/scenes/entities/rock.gd b/scenes/entities/rock.gd index 656cd57..3dc4ea6 100644 --- a/scenes/entities/rock.gd +++ b/scenes/entities/rock.gd @@ -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() diff --git a/scenes/entities/torch.gd b/scenes/entities/torch.gd index f189cfc..7c73013 100644 --- a/scenes/entities/torch.gd +++ b/scenes/entities/torch.gd @@ -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") diff --git a/scenes/entities/tree.gd b/scenes/entities/tree.gd index 61b1acb..52177bf 100644 --- a/scenes/entities/tree.gd +++ b/scenes/entities/tree.gd @@ -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() diff --git a/scenes/entities/wall.gd b/scenes/entities/wall.gd index 425531e..dd7d85e 100644 --- a/scenes/entities/wall.gd +++ b/scenes/entities/wall.gd @@ -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]) diff --git a/scenes/entities/workbench.gd b/scenes/entities/workbench.gd index 9d330b6..51af0fd 100644 --- a/scenes/entities/workbench.gd +++ b/scenes/entities/workbench.gd @@ -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. diff --git a/scenes/world/crate.gd b/scenes/world/crate.gd index dfabf6a..8ab464e 100644 --- a/scenes/world/crate.gd +++ b/scenes/world/crate.gd @@ -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() diff --git a/scenes/world/world.gd b/scenes/world/world.gd index 1d36b7a..4d0137f 100644 --- a/scenes/world/world.gd +++ b/scenes/world/world.gd @@ -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