Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
61 lines
5.2 KiB
GDScript
61 lines
5.2 KiB
GDScript
extends SceneTree
|
|
var checks:=0
|
|
var failures:=0
|
|
func expect(ok: bool,label: String) -> void:
|
|
checks+=1
|
|
if not ok: failures+=1;push_error(label)
|
|
func _initialize() -> void:call_deferred("run")
|
|
func run() -> void:
|
|
var runtime: Variant=load("res://autoload/simulation_runtime.gd").new()
|
|
var clock: Variant=load("res://autoload/game_clock.gd").new()
|
|
var state: Variant=load("res://autoload/game_state.gd").new()
|
|
clock.reset(1,6,0);state.reset();runtime.initialize(clock,state,42606);clock.set_paused(true)
|
|
var paths: Array[String]=FacilityCatalog.FACILITY_PATHS+FacilityCatalog.INFRASTRUCTURE_FACILITY_PATHS+FacilityCatalog.RESCUE_FACILITY_PATHS+FacilityCatalog.ORIGINAL_FACILITY_PATHS
|
|
expect(runtime.definition_registry.rebuild_from_paths(paths)[&"valid"],"staged chapel definition passes registry validation")
|
|
var definition: FacilityDefinition=runtime.definition_registry.get_facility(&"chapel")
|
|
expect(definition!=null and definition.footprint==Vector2i(4,3) and definition.layer==0,"original chapel dimensions and front layer")
|
|
expect(definition.construction_cost=={&"gold":1200,&"materials":12} and definition.build_minutes==180 and definition.maintenance_gold==6,"approved chapel construction and daily upkeep")
|
|
expect(definition.customer_capacity==8 and definition.staff_min==1 and definition.staff_max==2 and definition.required_roles==[&"cleric"],"approved dedicated customer capacity and cleric requirements")
|
|
expect(runtime.submit_command(&"build_facility",{&"definition_id":&"chapel",&"origin":Vector3i(-6,0,0)}).is_success(),"build staged chapel through normal construction command")
|
|
clock.advance_minutes(180)
|
|
var chapel: FacilityInstance
|
|
for facility: FacilityInstance in runtime.facility_service.get_instances():
|
|
if facility.definition_id==&"chapel":chapel=facility
|
|
expect(chapel!=null and chapel.state==FacilityInstance.State.NO_STAFF,"chapel cannot operate without staff")
|
|
if chapel==null:runtime.free();clock.free();state.free();quit(failures);return
|
|
# Staffing fixture only; normal cleric recruitment is a separate integration.
|
|
expect(runtime.submit_command(&"set_facility_conditions",{&"facility_id":chapel.instance_id,&"conditions":{&"active_staff_ids":[&"cleric_fixture"]}}).is_success(),"controlled staffed service boundary")
|
|
expect(runtime.submit_command(&"register_guest_wallet",{&"guest_id":&"worship_payer",&"gold":100}).is_success(),"fund worship payer")
|
|
expect(runtime.submit_command(&"create_service_request",{&"request_id":&"worship_once",&"facility_id":chapel.instance_id,&"guest_ids":[&"worship_payer"],&"service_type":&"worship"}).is_success(),"request worship")
|
|
clock.advance_one_minute()
|
|
var active: Array=runtime.facility_service.get_active_services(chapel.instance_id)
|
|
expect(active.size()==1,"worship starts with approved staffing")
|
|
if active.is_empty():runtime.free();clock.free();state.free();quit(failures);return
|
|
var service_id: StringName=active[0].service_id
|
|
clock.advance_minutes(30)
|
|
var saved: Dictionary=runtime.create_snapshot()
|
|
expect(state.get_resource(&"faith")==0 and runtime.economy_service.get_balance(&"GUEST_WALLET:worship_payer")==100,"unfinished worship grants neither faith nor sale")
|
|
expect(runtime.restore_snapshot(saved),"restore worship in progress")
|
|
clock.advance_minutes(31)
|
|
expect(runtime.facility_service.get_service(service_id).state==ServiceInstance.State.COMPLETED,"worship completes after restore")
|
|
expect(state.get_resource(&"faith")==1 and runtime.progression_service.metrics[&"faith_lifetime"]==1,"faith inventory and lifetime rank metric gain one together")
|
|
expect(runtime.economy_service.get_balance(&"GUEST_WALLET:worship_payer")==80 and runtime.economy_service.validate_ledger()[&"ok"],"one20G donation with balanced ledger")
|
|
var completed: Dictionary=runtime.create_snapshot()
|
|
expect(runtime.restore_snapshot(completed),"completed reward and ledger restore")
|
|
clock.advance_minutes(2)
|
|
expect(state.get_resource(&"faith")==1 and runtime.economy_service.get_balance(&"GUEST_WALLET:worship_payer")==80,"completed worship never repeats rewards after load")
|
|
expect(runtime.restore_snapshot(saved),"rewind to in-progress worship")
|
|
clock.advance_minutes(31)
|
|
expect(runtime.create_snapshot()==completed,"in-progress replay yields identical completion including faith and ledger")
|
|
expect(runtime.restore_snapshot(saved),"rewind for failed progression transaction")
|
|
runtime.progression_service.quarantined=true
|
|
clock.advance_minutes(31)
|
|
expect(runtime.facility_service.get_service(service_id).state!=ServiceInstance.State.COMPLETED,"unavailable progression prevents partial completion")
|
|
expect(state.get_resource(&"faith")==0 and runtime.economy_service.get_balance(&"GUEST_WALLET:worship_payer")==100,"faith failure rolls back guest payment and faith")
|
|
expect(runtime.economy_service.validate_ledger()[&"ok"],"failed faith reward leaves ledger balanced")
|
|
runtime.progression_service.quarantined=false
|
|
clock.advance_one_minute()
|
|
expect(runtime.facility_service.get_service(service_id).state==ServiceInstance.State.COMPLETED and state.get_resource(&"faith")==1 and runtime.economy_service.get_balance(&"GUEST_WALLET:worship_payer")==80,"recovered boundary retries with exactly one donation and reward")
|
|
runtime.free();clock.free();state.free()
|
|
print("Chapel service: %d checks, %d failures" % [checks,failures]);quit(failures)
|