feat: unify authored activity commands
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user