spaceship/tests/_lab_menu_preview.gd
2026-09-03 00:12:08 +02:00

33 lines
1.4 KiB
GDScript

extends Node2D
# Preview, not a test - the ship lab at the real 720x1280 viewport, with a
# vessel selected, its upgrades listed, and active research in progress.
#
# bash tests/screenshot.sh res://tests/_lab_menu_preview.tscn /tmp/lab.png 25 720x1280
func _ready() -> void:
GameState.buildings.clear()
GameState.extractors.clear()
GameState.reset_progression()
GameState.bank_inventory.set_amount(GameState.RESOURCE_ORE, 310)
GameState.fleet_inventory.set_amount(GameState.RESOURCE_ORE, 47)
GameState.research_points = 4
GameState.build_time_scale = 1.0
var lab_id: int = GameState.add_building(GameState.BUILDING_SHIP_LAB,
Vector2.ZERO)
GameState.queue_lab_research(lab_id, "int_rate")
GameState.deposit_resource_to_building(lab_id, GameState.RESOURCE_ORE,
GameState.upgrade_cost("int_rate"))
GameState.call("_advance_lab_research", GameState.lab_research_time() * 0.42)
# Freeze the model so a slow software-rendered capture cannot finish the
# research before it takes the frame this preview exists to show.
GameState.set_process(false)
var main: Node = load("res://world/Main.tscn").instantiate()
add_child(main)
main.get_node("EnemySpawner").set_process(false)
main.get_node("AsteroidField").set_process(false)
var build: Node = main.get_node("BuildController")
build.lab_building_id = lab_id
build.lab_menu.open_for(lab_id)
build._refresh_lab()