28 lines
2.1 KiB
Diff
28 lines
2.1 KiB
Diff
--- a/tests/fixtures/p08-02/mixed_world.gd
|
|
+++ b/tests/fixtures/p08-02/mixed_world.gd
|
|
@@ -76,8 +76,24 @@
|
|
for member: String in MEMBERS: hashes[suffix+"/"+member] = FileAccess.get_sha256(ProjectSettings.globalize_path(slot+suffix).path_join(member))
|
|
return hashes
|
|
func observe(event: SimulationDomainEvent) -> void: events.append(event.to_dictionary())
|
|
+## Diagnostic budget derived from actual definitions; no production balance change.
|
|
+func prepare_diagnostic_budget() -> bool:
|
|
+ var planned: Array[StringName] = [&"warehouse",&"kitchen",&"infirmary",&"staff_door",&"reception",&"reception",&"guest_elevator",&"staff_dormitory",&"premium_room",&"premium_room",&"service_stairs",&"service_stairs",&"service_stairs",&"guest_stairs",&"guest_stairs",&"guest_stairs"]
|
|
+ var needed := {&"gold":0,&"materials":0}
|
|
+ for id: StringName in planned:
|
|
+ var definition: FacilityDefinition = runtime.definition_registry.get_facility(id)
|
|
+ if not expect(definition != null,"budget definition "+String(id)): return false
|
|
+ for resource: StringName in needed: needed[resource] += int(definition.construction_cost.get(resource,0))
|
|
+ var staff_input: Dictionary = runtime.mvp_content_catalog.staff_hire_payload(&"staff_gina")
|
|
+ needed[&"gold"] += int(staff_input.get(&"signing_cost",0)) + 8 * int(SupplyCatalog.get_item(SupplyCatalog.RAW_FOOD)[&"unit_price"])
|
|
+ var deltas := {}
|
|
+ for resource: StringName in needed:
|
|
+ var deficit: int = maxi(0,int(needed[resource])-state.get_resource(resource))
|
|
+ if deficit > 0: deltas[resource] = deficit
|
|
+ return deltas.is_empty() or command(&"change_resources",{&"deltas":deltas})
|
|
func setup(operations: bool) -> bool:
|
|
registry(true)
|
|
+ if not prepare_diagnostic_budget(): return false
|
|
if operations and not expect(runtime.enable_production_operations().get(&"ok",false),"Operations enabled at Day 1 06:00"): return false
|
|
for row: Array in [[&"warehouse",Vector3i(-8,0,1)],[&"kitchen",Vector3i(2,0,1)],[&"infirmary",Vector3i(6,0,1)],[&"staff_door",Vector3i(0,0,1)],[&"reception",Vector3i(-6,0,0)],[&"reception",Vector3i(5,0,0)],[&"guest_elevator",Vector3i.ZERO]]:
|
|
if not build(row[0],row[1],false): return false
|