feat: derive capable opportunity helpers
This commit is contained in:
@@ -239,6 +239,8 @@ func _run() -> void:
|
||||
)
|
||||
await process_frame
|
||||
contributor = simulation_manager.npcs[contributor.id]
|
||||
witness = simulation_manager.npcs[witness.id]
|
||||
listener = simulation_manager.npcs[listener.id]
|
||||
contributor_visual = world_view.active_npc_visuals[contributor.id]
|
||||
player_opportunity = simulation_manager.get_active_opportunity()
|
||||
_check(
|
||||
@@ -277,15 +279,39 @@ func _run() -> void:
|
||||
SimulationIds.RESOURCE_WOOD, woodpile_state.get_amount(SimulationIds.RESOURCE_WOOD)
|
||||
)
|
||||
simulation_manager.economy.sync_resource(SimulationIds.RESOURCE_WOOD)
|
||||
var woodpile_node := (
|
||||
main_scene.get_node("JajceWorld/WorldObjects/StorageSites/VillageWoodpile") as StorageNode
|
||||
)
|
||||
contributor.position = woodpile_node.get_interaction_position()
|
||||
witness.position = contributor.position
|
||||
witness.profession = SimulationIds.PROFESSION_WOODCUTTER
|
||||
contributor.set_task(SimulationIds.ACTION_STUDY, 1.0)
|
||||
contributor.target_id = SimulationIds.STORAGE_VILLAGE_WOODPILE
|
||||
contributor.travel_target_position = contributor.position
|
||||
contributor.start_working()
|
||||
simulation_manager.simulate_tick()
|
||||
village_ui.selected_npc_index = contributor.id
|
||||
village_ui.call("_refresh_npc_inspector")
|
||||
var runtime_helper: OpportunityHelperResult = simulation_manager.get_active_opportunity_helper()
|
||||
_check(
|
||||
(
|
||||
runtime_helper != null
|
||||
and runtime_helper.helper_npc_id == witness.id
|
||||
and runtime_helper.action_id == SimulationIds.ACTION_GATHER_WOOD
|
||||
),
|
||||
"Runtime helper query should derive the informed trusted woodcutter"
|
||||
)
|
||||
var runtime_helper_reason := (
|
||||
"Knows the need; trust %.2f toward %s" % [runtime_helper.trust, contributor.npc_name]
|
||||
if runtime_helper != null
|
||||
else "missing helper"
|
||||
)
|
||||
_check(
|
||||
(
|
||||
"◆ Supply wood for blocked work" in village_stats_label.text
|
||||
and "could not finish Study" in village_stats_label.text
|
||||
and "Possible helper: %s — Gather Wood" % witness.npc_name in village_stats_label.text
|
||||
and runtime_helper_reason in village_stats_label.text
|
||||
and "◆ Find wood for Study" in inspector_label.text
|
||||
and not contributor_visual.get_node("OpportunityConcernRoot").visible
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user