spaceship/tests/_build_popup_preview.gd

31 lines
1 KiB
GDScript3
Raw Normal View History

extends Node2D
# Preview scene - NOT run by run_tests.sh (underscore prefix). Opens the
# build menu and shows a building's info popup, so the panel layout can be
# checked with real text in it. Uses the mothership-already-exists case on
# purpose: that is the longest message any option produces, so if it fits,
# the others do.
#
# bash tests/screenshot.sh res://tests/_build_popup_preview.tscn /tmp/out.png 40
const SHOW_POPUP: bool = true
func _ready() -> void:
GameState.buildings.clear()
GameState.extractors.clear()
GameState.rocks = 500
GameState.add_building(GameState.BUILDING_MOTHERSHIP, Vector2(-900.0, 0.0))
var main: Node = load("res://Main.tscn").instantiate()
add_child(main)
main.get_node("AsteroidField").set_process(false)
main.get_node("EnemySpawner").set_process(false)
var controller: Node = main.get_node("BuildController")
controller._on_build_pressed()
# Flip SHOW_POPUP to check the menu underneath
# instead of the popup that covers it.
if SHOW_POPUP:
controller._show_building_info(GameState.BUILDING_MOTHERSHIP)