spaceship/tests/_skill_menu_preview.gd
2026-08-14 11:54:31 +02:00

31 lines
1.2 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.
func _ready() -> void:
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.unlocked = ["shipyards", "logistics", "freight"]
var main: Node = load("res://Main.tscn").instantiate()
add_child(main)
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 = "freight"
bc._refresh_skill_menu("freight")