57 lines
1.7 KiB
GDScript
57 lines
1.7 KiB
GDScript
extends SceneTree
|
|
|
|
var _failures: Array[String] = []
|
|
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("_run")
|
|
|
|
|
|
func _expect(condition: bool, message: String) -> void:
|
|
if not condition:
|
|
_failures.append(message)
|
|
|
|
|
|
func _run() -> void:
|
|
var host := Node3D.new()
|
|
root.add_child(host)
|
|
var jets := PlayerJetVFX.new()
|
|
host.add_child(jets)
|
|
await process_frame
|
|
|
|
_expect(jets.get_flame_count() == 4, "jet rig must contain exactly four flames")
|
|
jets.burst_double_jump()
|
|
jets._process(0.016)
|
|
var up_exhaust := jets.get_exhaust_direction()
|
|
_expect(up_exhaust.y < -0.95, "double-jump exhaust must point mostly down")
|
|
_expect(up_exhaust.z > 0.0, "double-jump exhaust needs a slight rear cant")
|
|
_expect(jets.visible, "double-jump burst must reveal the flames")
|
|
|
|
jets.set_dash(true, Vector2(0.0, 1.0))
|
|
jets._process(0.016)
|
|
var dash_exhaust := jets.get_exhaust_direction()
|
|
_expect(dash_exhaust.z > 0.90, "forward dash exhaust must point backward")
|
|
_expect(dash_exhaust.y < 0.0, "dash exhaust keeps a slight downward cant")
|
|
|
|
var humanoid := HumanoidModel.new()
|
|
host.add_child(humanoid)
|
|
await process_frame
|
|
humanoid.set_locomotion(0.0, -1.0, 0.0)
|
|
humanoid.update_state("ground", 9.0)
|
|
humanoid._process(0.1)
|
|
_expect(humanoid.root_pivot.rotation.x > 0.0,
|
|
"fallback model must lean backward while backpedalling")
|
|
humanoid.update_state("ground", 5.0)
|
|
humanoid._process(0.1)
|
|
_expect(humanoid._brake_left > 0.0, "deceleration must arm the braking pose")
|
|
_expect(absf(humanoid.thigh_r_pivot.rotation.x) > 0.05,
|
|
"braking pose must plant a lead foot")
|
|
|
|
if _failures.is_empty():
|
|
print("JET_POSE_TEST PASS: four flames, directional thrust, reverse lean, brake pose")
|
|
quit(0)
|
|
else:
|
|
for failure in _failures:
|
|
push_error("JET_POSE_TEST FAIL: " + failure)
|
|
quit(1)
|