52 lines
1.7 KiB
GDScript
52 lines
1.7 KiB
GDScript
extends SceneTree
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("run")
|
|
|
|
func capture(label: String) -> void:
|
|
for frame in 4: await process_frame
|
|
await RenderingServer.frame_post_draw
|
|
root.get_texture().get_image().save_png("res://logs/operator-game-" + label + ".png")
|
|
print("CAPTURE ", label)
|
|
|
|
func run() -> void:
|
|
create_timer(100).timeout.connect(func(): quit(1))
|
|
var game: Node3D = load("res://scenes/main.tscn").instantiate()
|
|
root.add_child(game)
|
|
while not game.ready_for_play: await process_frame
|
|
game.ui.controls_menu()
|
|
await capture("controls")
|
|
game.ui.operator_menu()
|
|
await create_timer(0.5).timeout
|
|
await capture("gallery")
|
|
game.port = 27978
|
|
game.host({"server_name": "Operator render", "mode": "TDM", "max_players": 2, "bots": 1, "score_limit": 100, "time_limit": 600})
|
|
game.set_physics_process(false)
|
|
game.set_process_unhandled_input(false)
|
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
|
for actor: Fighter in game.players.values(): actor.set_physics_process(false)
|
|
var player: Fighter = game.players[1]
|
|
player.reset_at(Vector3(0.2, 0.1, 24))
|
|
player.protection = 0
|
|
for variant: String in ["steve", "gas_mask"]:
|
|
player.operator_id = variant
|
|
player.life += 1
|
|
player.weapon = 0
|
|
player.reload_left = 0
|
|
player.aiming = false
|
|
await create_timer(0.5).timeout
|
|
await capture(variant + "-hip")
|
|
player.aiming = true
|
|
await create_timer(0.5).timeout
|
|
await capture(variant + "-ads")
|
|
player.reload_left = float(player.weapon_stats().reload) * 0.55
|
|
await create_timer(0.2).timeout
|
|
await capture(variant + "-reload")
|
|
player.weapon = 4
|
|
player.reload_left = 0
|
|
await create_timer(0.5).timeout
|
|
await capture("pistol")
|
|
game.leave()
|
|
await process_frame
|
|
quit()
|