feat: unify authored activity commands

This commit is contained in:
Rijad Zuzo
2026-08-13 00:08:30 +02:00
parent e5aecee0de
commit b3b98c6456
36 changed files with 3013 additions and 96 deletions
+16 -1
View File
@@ -197,6 +197,7 @@ func _test_wood_work_requires_material() -> void:
var safety_before: float = manager.village.safety
npc.set_task(SimulationIds.ACTION_PATROL, 1.0)
npc.target_id = SimulationIds.ACTIVITY_GUARD_POST
npc.start_working()
manager.simulate_tick()
_check(
@@ -227,13 +228,27 @@ func _test_wood_work_requires_material() -> void:
)
var knowledge_before: float = manager.village.knowledge
npc.set_task(SimulationIds.ACTION_STUDY, 1.0)
npc.target_id = SimulationIds.ACTIVITY_STUDY_DESK
npc.start_working()
manager.simulate_tick()
var completed_events: Array[EconomicEventRecord] = manager.get_npc_events(npc.id, 2)
var completed_event: EconomicEventRecord = (
completed_events.back() if not completed_events.is_empty() else null
)
_check(
(
is_equal_approx(woodpile.get_amount(SimulationIds.RESOURCE_WOOD), 1.0)
and manager.village.knowledge > knowledge_before
and completed_event != null
and (
StringName(completed_event.data["event_type"])
== SimulationIds.EVENT_ACTIVITY_COMPLETED
)
and StringName(completed_event.data["action_id"]) == SimulationIds.ACTION_STUDY
and StringName(completed_event.data["metric_id"]) == &"knowledge"
and StringName(completed_event.data["cost_item_id"]) == SimulationIds.RESOURCE_WOOD
and is_equal_approx(float(completed_event.data["cost_amount"]), 1.0)
),
"Funded study should consume one wood and produce knowledge"
"Funded study should consume one wood and produce one exact authored activity fact"
)
manager.free()