sprint cleanup: corpse_cremated signal, recipe_count, save_system

D: Workbench._last_consumed_ingredient transient field captures the
carried item before queue_free so cremation_pyre.on_craft_complete can
emit corpse_cremated with the real ref. Falls back to proximity scan.
Pawn._on_corpse_cremated null-guarded.

E: removed redundant r.ingredient_count = 0 from recipe_catalog. Field
kept on Recipe for save round-trip compat; nothing reads it functionally.

F: save_system._spawn_workbench simplified from 15 lines to 6 — let
from_dict do all field restoration. Fixed workbench.from_dict to call
_complete() instead of bare _completed=true, which was skipping light
enable + beauty register + designation clear.

Stale ingredient1/2 buffering comment in job_runner._tick_craft fixed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-16 18:23:22 +01:00
parent 2afca16299
commit cc6d60d044
6 changed files with 29 additions and 18 deletions

View file

@ -524,10 +524,14 @@ func _tick_craft(t) -> void:
# Consume ingredients.
# Single-ingredient: pawn.carried_item holds the only input — free it.
# Two-ingredient: pawn.carried_item is ingredient2; ingredient1 was buffered
# Two-ingredient: pawn.carried_item is ingredient (primary); ingredient2 was buffered
# in wb.deposited_inputs by _tick_deposit_at_wb — remove it from the buffer.
# No-ingredient: carried_item is null; nothing to consume.
var ingredient = pawn.carried_item
# Expose the consumed ingredient to on_craft_complete() via a transient field
# so overrides (e.g. CremationPyre) can retrieve it by reference instead of
# relying on a proximity scan. Cleared below after on_craft_complete returns.
wb._last_consumed_ingredient = ingredient
pawn.carried_item = null
if ingredient != null and is_instance_valid(ingredient):
ingredient.queue_free()
@ -551,6 +555,8 @@ func _tick_craft(t) -> void:
# Record completion on the bill and reset workbench state.
wb.on_craft_complete()
# Clear transient ingredient ref now that on_craft_complete overrides have run.
wb._last_consumed_ingredient = null
Audit.log(
"job_runner",

View file

@ -118,7 +118,6 @@ static func quarry_stone() -> Recipe:
r.id = &"quarry_stone"
r.label = "Quarry stone"
r.ingredient_type = &"" # no input
r.ingredient_count = 0
r.output_type = Item.TYPE_STONE
r.work_ticks = 300
r.required_skill = &"manual_labor"