ShitboxInfinity/tests/screenshot.gd
type-two eb7c189c9f Gameplay systems + procedural Blender car fleet
Modes: Cruise / Crash Mode (60s damage dollars) / Race (3 laps, rubber-banded
rivals). Burnout loop: boost earned by drift, near miss, smash; takedowns refill
and grow the meter to 4x; hard crashes shed det_* panels and trigger Impact Time
slow-mo. Traffic follows the level RacePath frozen-kinematic and goes dynamic
when whacked. tools/build_cars.py builds six Aussie shitbox GLBs (profile
extrusion + detachable doors/mirrors/bumpers/bonnet/boot). Smoke test covers
all three modes headless.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-27 21:29:42 +10:00

28 lines
1.0 KiB
GDScript

extends SceneTree
## Boot straight into the game and save a viewport screenshot (needs a window, not --headless):
## Godot --path . --script tests/screenshot.gd -- car=datto_120y mode=cruise out=shot.png frames=90 throttle=1
## Defaults: first car, cruise, screenshot.png, 90 physics frames, throttle held.
func _initialize() -> void:
_run()
func _run() -> void:
var opts := {}
for a in OS.get_cmdline_user_args():
var kv := a.split("=")
if kv.size() == 2:
opts[kv[0]] = kv[1]
var cars := Registry.cars()
Game.car_path = cars.get(opts.get("car", ""), cars.values()[0])
Game.level_path = Registry.levels().values()[0]
Game.mode = opts.get("mode", "cruise")
root.add_child((load("res://src/game.tscn") as PackedScene).instantiate())
await process_frame
if opts.get("throttle", "1") == "1":
Input.action_press("throttle")
for i in int(opts.get("frames", "90")):
await physics_frame
root.get_texture().get_image().save_png("res://" + opts.get("out", "screenshot.png"))
print("screenshot saved")
quit(0)