Files
TheTree_mock/tests/mvp/test_original_room_zones.gd
Takeshi 5dde0c5ec2 Record original-alignment implementation and traceability checkpoint
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.
2026-09-30 23:52:24 +09:00

42 lines
3.0 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,42571); clock.set_paused(true)
runtime.submit_command(&"change_resources", {&"deltas": {&"gold": 5000, &"materials": 100}})
runtime.submit_command(&"update_progression_metrics", {&"metrics": {&"reputation": 25}})
expect(runtime.submit_command(&"set_world_tree_rank", {&"rank":2}).is_success(), "fixture unlocks underground by rank command")
for id: StringName in [&"standard_room", &"premium_room", &"staff_dormitory"]:
var definition: FacilityDefinition = runtime.definition_registry.get_facility(id)
var origin := Vector3i(2,-1,definition.layer)
var report: PlacementReport = runtime.construction_service.validate_placement(definition,origin)
expect(report.zone_mismatch_cells.is_empty() and not report.unexcavated_cells.is_empty(), "%s permits underground but still requires excavation" % id)
expect(not runtime.submit_command(&"build_facility", {&"definition_id":id,&"origin":origin}).is_success(), "unexcavated build rejected")
var wrong: PlacementReport = runtime.construction_service.validate_placement(definition,Vector3i(2,-1,1-definition.layer))
expect(not wrong.layer_mismatch_cells.is_empty(), "%s preserves original layer restriction" % id)
for x in range(0,10):
expect(runtime.submit_command(&"start_excavation", {&"cell":Vector3i(x,-1,0)}).is_success(), "normal command excavates underground footprint")
clock.advance_minutes(60)
for x in range(0,10): expect(runtime.world_service.is_excavated(Vector3i(x,-1,0)), "excavation completes")
for item: Array in [[&"standard_room",Vector3i(1,-1,0)],[&"premium_room",Vector3i(4,-1,0)],[&"staff_dormitory",Vector3i(1,-1,1)]]:
var report: PlacementReport = runtime.construction_service.validate_placement(runtime.definition_registry.get_facility(item[0]),item[1])
expect(report.can_build, "%s underground placement is valid" % item[0])
var result: CommandResult = runtime.submit_command(&"build_facility", {&"definition_id":item[0],&"origin":item[1]})
expect(result.is_success(), "%s constructs in excavated underground: %s" % [item[0],result.message])
clock.advance_minutes(150)
for id: StringName in [&"standard_room", &"premium_room", &"staff_dormitory"]:
var found := false
for facility: FacilityInstance in runtime.facility_service.get_instances():
if facility.definition_id == id and facility.origin.y == -1: found = true
expect(found, "%s finishes as a real underground facility" % id)
expect(runtime.restore_snapshot(runtime.create_snapshot()), "underground rooms survive save restore")
runtime.free();clock.free();state.free()
print("Original room zones: %d checks, %d failures" % [checks,failures]);quit(failures)