65 lines
4.0 KiB
GDScript
65 lines
4.0 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 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==d.flame:continue
|
|
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")
|
|
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")
|
|
await shot(g,"cooled")
|
|
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)
|