spaceship/tests/_skill_menu_preview.gd
2026-08-16 20:14:29 +02:00

40 lines
1.4 KiB
GDScript

extends Node2D
# Preview, not a test. Opens the SkillMenu so its layout can be checked on a
# real viewport - the tree lost vertical room to the shared resource header
# (#24), and whether it still fits is a thing only pixels can answer.
#
# bash tests/screenshot.sh res://tests/_skill_menu_preview.tscn /tmp/m.png 20 720x1280
# ... and again at 720x960 to check a shorter screen format.
var configured: bool = false
func _process(_delta: float) -> void:
if configured:
return
configured = true
GameState.buildings.clear()
GameState.extractors.clear()
GameState.transporters.clear()
GameState.rocks = 180
GameState.gas = 36
GameState.fleet_cargo = 24
GameState.fleet_gas_cargo = 12
GameState.research_points = 0
GameState.unlocked = ["shipyards"]
var main: Node = load("res://Main.tscn").instantiate()
add_child(main)
main.get_node("EnemySpawner").set_process(false)
main.get_node("AsteroidField").set_process(false)
main.get_node("BuildingField").place(GameState.BUILDING_MOTHERSHIP, Vector2(400.0, 0.0))
var mothership_id: int = int(GameState.buildings[-1].id)
var bc: Node = main.get_node("BuildController")
for bar in bc.resource_bars:
bar.building_id = mothership_id
main.get_node("UI/SkillMenu").visible = true
# Select a node so the description, price and status all have text - an
# empty description cannot collide with anything.
bc.skill_tree.selected_id = "coordination"
bc._refresh_skill_menu("coordination")