spaceship/tests/_fleet_upkeep_preview.gd

34 lines
1.5 KiB
GDScript3
Raw Normal View History

extends Node2D
# Preview, not a test - #220's upkeep readout with a fleet worth reading:
# several berths of different hulls, so the per-berth lines, the compounding
# multiplier and the per-minute total all have something to show.
#
# bash tests/screenshot.sh res://tests/_fleet_upkeep_preview.tscn shots/fleet_upkeep.png 3 720x1280
func _ready() -> void:
GameState.buildings.clear()
GameState.extractors.clear()
GameState.transporters.clear()
GameState.reset_progression()
GameState.intro_active = false
GameState.add_building(GameState.BUILDING_MOTHERSHIP, Vector2.ZERO)
var office_ids: Array = []
for i in range(5):
office_ids.append(GameState.add_building(GameState.BUILDING_FLEET_OFFICE,
Vector2(400.0 * float(i + 1), 300.0)))
var main: Node = load("res://world/Main.tscn").instantiate()
add_child(main)
main.get_node("AsteroidField").set_process(false)
main.get_node("EnemySpawner").set_process(false)
# Spawned for real rather than by writing fleet_vessel_types directly: the
# Fleet rewrites that from what is actually flying the moment it composes
# itself, so a value set beforehand is discarded.
main.get_node("Fleet").spawn_ships(6, Vector2.ZERO, PackedStringArray([
GameState.VESSEL_INTERCEPTOR, GameState.VESSEL_LASER,
GameState.VESSEL_GAS_BOMBER, GameState.VESSEL_DISTORDER,
GameState.VESSEL_LASER, GameState.VESSEL_SHIELD]))
# One office left unsupplied, so the unpaid marker is visible too.
GameState.find_building(int(office_ids[3])).starved = true
main.get_node("UI/FleetUpkeepMenu").open_for(int(office_ids[0]))