95 lines
6.1 KiB
GDScript
95 lines
6.1 KiB
GDScript
extends RefCounted
|
|
var failures=0
|
|
var capture_folder=""
|
|
func check(ok,label):
|
|
if not ok:failures+=1;push_error("IRON MAIDEN QA: "+label)
|
|
func shot(g,name):
|
|
await RenderingServer.frame_post_draw
|
|
g.get_viewport().get_texture().get_image().save_png(capture_folder+"/"+name+".png")
|
|
func collision_check(g,d):
|
|
var subject=Node3D.new();g.add_child(subject)
|
|
await g.get_tree().physics_frame;await g.get_tree().physics_frame
|
|
subject.position=d.device.position+Vector3(0,.35,-3)
|
|
g.workshop.mesh_walking.move_actor(subject,Vector3(0,0,5),.25,1.18)
|
|
check(subject.position.z<d.device.position.z-.2,"simplified back shell blocks a swept capsule")
|
|
subject.position=d.device.position+Vector3(0,.35,2.5)
|
|
g.workshop.mesh_walking.move_actor(subject,Vector3(0,0,-2.5),.25,1.18)
|
|
check(absf(subject.position.z-d.device.position.z)<.15,"open doors preserve the hollow entrance above the base")
|
|
d.door.rotation.y=0;d.second_door.rotation.y=0
|
|
await g.get_tree().physics_frame;await g.get_tree().physics_frame
|
|
subject.position=d.device.position+Vector3(0,.35,2.5)
|
|
g.workshop.mesh_walking.move_actor(subject,Vector3(0,0,-3),.25,1.18)
|
|
check(subject.position.z>d.device.position.z+.2,"closed moving doors block entry")
|
|
d.door.rotation.y=-1.8;d.second_door.rotation.y=1.8
|
|
await g.get_tree().physics_frame;subject.queue_free()
|
|
func run(g):
|
|
await g.get_tree().create_timer(.3).timeout
|
|
g.start_game();g.set_process(false);g.reset_shift();g.game_started=true;g.paused=false
|
|
g.hud.hide();g.menu.show_page("")
|
|
capture_folder="res://captures/iron-maiden" if OS.has_feature("editor") else OS.get_executable_path().get_base_dir()+"/captures/iron-maiden"
|
|
DirAccess.make_dir_recursive_absolute(capture_folder)
|
|
var w=g.workshop;var d=w.add_station(3,Vector3(3,0,0))
|
|
check(d.device.get_meta("apparatus_model","")=="iron_maiden_v01","Meshy model selected")
|
|
check(d.door!=d.second_door and d.door.get_child_count()>0 and d.second_door.get_child_count()>0,"independent populated doors")
|
|
check(d.door.position.x<0 and d.second_door.position.x>0,"opposite side hinges")
|
|
check(d.door.find_child("InnerLeftDetail",true,false)!=null and d.second_door.find_child("InnerRightDetail",true,false)!=null,"interior trim follows both moving doors")
|
|
check(d.device.find_child("InnerBackDetail",true,false)!=null and d.device.find_child("InnerGrate",true,false)!=null,"reinforced back and solid grated floor")
|
|
var surfaces=d.device.find_children("*","MeshInstance3D",true,false)
|
|
var textured=0
|
|
for mesh in surfaces:
|
|
if mesh.get_meta("apparatus_restraint",false):continue
|
|
if mesh==d.flame:continue
|
|
if mesh.get_meta("no_walk_collision",false):
|
|
check(not mesh.has_node("MeshWalkingCollider"),"internal detail does not duplicate shell physics")
|
|
check(mesh.cast_shadow==GeometryInstance3D.SHADOW_CASTING_SETTING_OFF,"internal detail skips redundant shadows")
|
|
for i in range(mesh.mesh.get_surface_count()):
|
|
var mat=mesh.mesh.surface_get_material(i)
|
|
if mat is StandardMaterial3D and mat.albedo_texture!=null:textured+=1
|
|
check(mesh.material_override==null,"original surface material preserved")
|
|
for i in range(mesh.mesh.get_surface_count()):
|
|
check(mesh.get_surface_override_material(i) is ShaderMaterial,"PBR-preserving incandescence material")
|
|
check(textured>0,"Meshy textures present")
|
|
var outer=d.device.find_child("Body",true,false).get_active_material(0)
|
|
var inner=d.device.find_child("BodyLining",true,false).get_active_material(0)
|
|
for map_name in ["color_map","metal_map","rough_map","normal_map"]:
|
|
check(outer.get_shader_parameter(map_name)==inner.get_shader_parameter(map_name),"inner and outer share original PBR "+map_name)
|
|
g.camera.position=Vector3(5.8,3.5,3);g.camera.look_at(d.device.position+Vector3(0,1.5,0));g.camera.size=4.5
|
|
await shot(g,"open")
|
|
await collision_check(g,d)
|
|
for k in range(19):
|
|
d.door.rotation.y=-1.8+float(k)*.1;d.second_door.rotation.y=1.8-float(k)*.1
|
|
check(d.door.transform.is_finite() and d.second_door.transform.is_finite(),"finite hinge sweep")
|
|
if k==9:await shot(g,"half")
|
|
check(absf(d.door.rotation.y)<.0001 and absf(d.second_door.rotation.y)<.0001,"both doors reach closed pose")
|
|
await shot(g,"closed")
|
|
# Exercise the actual station state machine and heat without replacing PBR.
|
|
w.unlock=3;g.uid=0;w.spawn();var s=g.souls.back();s.required=[3];s.entering=false;s.entry_time=1
|
|
g.set_soul_reveal(s.visual,1);w.attach(s,0);w.step_station(d,.9,false)
|
|
for k in range(16):w.step_station(d,.1,true)
|
|
check(d.motion.heat>.3 and d.motion.heat<.6,"progressive red stage")
|
|
await shot(g,"warming")
|
|
for k in range(19):w.step_station(d,.1,true)
|
|
check(d.stage==1,"station advances through closure into heat")
|
|
check(d.motion.heat>.94 and d.motion.heat_light.light_energy>2.8,"full incandescence with reflected light")
|
|
await shot(g,"heated")
|
|
for k in range(100):
|
|
w.step_station(d,.1,true)
|
|
if d.soul<0:break
|
|
check(d.soul<0 and g.done==1,"completion releases soul and rewards once")
|
|
for k in range(40):w.step_station(d,.1,false)
|
|
check(is_equal_approx(d.door.rotation.y,-1.8) and is_equal_approx(d.second_door.rotation.y,1.8),"doors reopen after cooldown")
|
|
for k in range(25):w.step_station(d,.1,false)
|
|
check(d.motion.heat<.01 and d.motion.heat_light.light_energy<.01,"incandescence cools back to original metal")
|
|
check(not d.motion.heat_light.visible,"cooled heat light leaves rendering")
|
|
await shot(g,"cooled")
|
|
var other=w.add_station(3,Vector3(8,0,0))
|
|
var first_detail=d.device.find_child("InnerBackDetail",true,false).get_child(0)
|
|
var second_detail=other.device.find_child("InnerBackDetail",true,false).get_child(0)
|
|
check(first_detail.mesh==second_detail.mesh,"repeated devices reuse cached detail geometry")
|
|
check(first_detail.get_active_material(0)!=second_detail.get_active_material(0),"each device has independent heat material")
|
|
var before=other.motion.heat_materials[0].get_shader_parameter("heat")
|
|
d.motion.heat=.8;d.motion.apply_heat()
|
|
check(other.motion.heat_materials[0].get_shader_parameter("heat")==before,"heating one cached device does not heat its neighbour")
|
|
print("IRON MAIDEN QA ","PASSED" if failures==0 else "FAILED",": textured model, hinges, sweep, close/heat/reward/reopen")
|
|
g.get_tree().quit(1 if failures else 0)
|