feat: let opportunity helpers act autonomously

This commit is contained in:
Rijad Zuzo
2026-07-16 10:58:48 +02:00
parent eaa15c076c
commit 0332c57a89
14 changed files with 253 additions and 30 deletions
+24
View File
@@ -317,6 +317,30 @@ func _run() -> void:
),
"A real missing-wood fact should surface through wood-specific UI without a food cue"
)
witness.current_task = SimulationIds.ACTION_IDLE
witness.task_state = SimNPC.TASK_STATE_IDLE
witness.task_complete = true
witness.target_id = &""
witness.has_travel_target = false
witness.hunger = 20.0
witness.energy = 80.0
witness.mourning_ticks = 0
simulation_manager.simulate_tick()
var runtime_decision: ActionSelectionResult = simulation_manager.get_latest_decision(witness.id)
var helper_resource: ResourceStateRecord = simulation_manager.get_resource_state(
witness.target_id
)
_check(
(
runtime_decision != null
and runtime_decision.action_id == SimulationIds.ACTION_GATHER_WOOD
and "Responding to village need" in runtime_decision.reason
and witness.task_state == SimNPC.TASK_STATE_TRAVELING
and helper_resource != null
and helper_resource.get_reserved_by() == witness.id
),
"The runtime helper should autonomously enter normal target resolution and reservation"
)
contributor.add_inventory(SimulationIds.RESOURCE_WOOD, 1.0)
_check(
is_equal_approx(