Files
Diabolo/Demon_v0.19/mesh_walking_tests.gd
T

39 lines
2.3 KiB
GDScript
Raw Normal View History

extends RefCounted
var failures=0
func check(value,label):
if not value:failures+=1;push_error("MESH QA: "+label)
func run(g):
await g.get_tree().create_timer(.3).timeout
g.start_game();g.paused=true
var w=g.workshop;w.reset();w.unlock=5
var d=w.add_station(1,Vector3(2,0,0));w.rebuild_nav()
await g.get_tree().physics_frame;await g.get_tree().physics_frame
# Inside its construction footprint, outside the actual timber bed.
g.player.position=Vector3(3.35,0,-1)
w.mesh_walking.move_actor(g.player,Vector3(0,0,1))
check(g.player.position.z>-.1,"free movement inside unused construction cells")
g.player.position=Vector3(0,0,0)
w.mesh_walking.move_actor(g.player,Vector3(4,0,0))
check(g.player.position.x<1.1,"swept capsule cannot tunnel through timber bed")
var before=g.player.position
w.mesh_walking.move_actor(g.player,Vector3(.7,0,.5))
check(g.player.position.z>before.z+.2,"slides along mesh instead of stopping both axes")
d.device.rotation.y=PI/2;d.turns=1;w.rebuild_nav()
await g.get_tree().physics_frame;await g.get_tree().physics_frame
g.player.position=Vector3(2,0,-3)
w.mesh_walking.move_actor(g.player,Vector3(0,0,6))
check(g.player.position.z<-.9,"rotation moves mesh collision")
w.dispose_station(d);w.stations.clear();w.bars.clear();w.rebuild_nav()
await g.get_tree().physics_frame;await g.get_tree().physics_frame
g.player.position=Vector3(0,0,0);w.mesh_walking.move_actor(g.player,Vector3(4,0,0))
check(g.player.position.x>3.9,"removed apparatus leaves no invisible collision")
g.development.points=5;g.speed_level=1;w.automation=true;w.refresh()
for n in w.node_buttons:
if n.key in ["speed","auto"]:check(n.button.modulate==Color.WHITE and n.gems.filled==1,"learned upgrades stay bright and show a ruby")
g.say("Проверка диалога");check(g.life.hero_bubble.find_children("*","Polygon2D",true,false).is_empty(),"hero dialogue has no arrow")
w.add_station(0,Vector3(2,0,0));w.spawn();var soul=g.souls.back();soul.entering=false;g.set_soul_reveal(soul.visual,1)
g.development.speak(soul,"Проверка")
check(not is_instance_valid(g.development.bubble),"soul dialogue disabled")
if failures==0:print("ALL MESH WALKING TESTS PASSED: mesh clearance, sweep, slide, rotation, removal, learned UI and arrowless dialogue")
g.get_tree().quit(1 if failures else 0)