spaceship/ui/DevWaveButton.gd

28 lines
862 B
GDScript3
Raw Normal View History

extends Control
# #110: a dev-only button that puts a wave on the board now.
#
# Waves are otherwise on a fifty-second clock, which makes anything that
# happens during one - the alert, the pathing, buildings taking damage, an
# outpost garrison actually earning its keep - slow to look at even once.
#
# Dev mode is the same gate the main menu already uses for the map editor:
# these are tools for building the game, and a player who installed a build
# has no use for them. The button does not exist outside it.
@onready var button: IconButton = get_node("Button")
func _ready() -> void:
button.pressed.connect(_on_pressed)
visible = false
func _process(_delta: float) -> void:
var show_it: bool = GameState.dev_mode and not GameState.intro_active
if show_it != visible:
visible = show_it
func _on_pressed() -> void:
GameState.force_wave_now()