spaceship/MainMenu.gd
Loïc Wisniewski df2f252970 Add the planet setup map editor (#48)
PlanetSetupEditor authors PlanetSetup resources: pick a surface
profile (drives the real lunar_surface background, not a blank
sheet), place/move/delete capture points and enemies from a palette
generated straight off EnemyDefinitions.all() (a new enemy definition
shows up with no editor change), pan/pinch-zoom the canvas with the
same touch idiom as GameController, then save to
res://PlanetSetups/<id>.tres via ResourceSaver - reachable now from
the main menu's Map Editor button. The mutation methods
(new_setup/load_setup/add_*/move_*/remove_*/save_setup) are the whole
model and work standalone, which is what lets
tests/test_setup_editor.gd drive placement/move/delete/save/reload
directly without simulating touch input.

Every cross-file reference is a preloaded script const rather than a
bare global class name, matching #42/#44's load-order notes - this
file is instantiated from other scripts' function bodies, never as a
script-mode test entry point itself, so it wasn't at risk the same way
the test files were, but the pattern is kept consistent throughout.

Part of the #40 conquest-mechanic breakdown. This closes out the
breakdown: #41-#48 are now all implemented, tested, and merged.
2026-08-15 21:24:28 +02:00

30 lines
836 B
GDScript

extends Node2D
@onready var play_button: IconButton = $UI/PlayButton
@onready var editor_button: IconButton = $UI/EditorButton
@onready var quit_button: IconButton = $UI/QuitButton
@onready var status_label: Label = $UI/StatusLabel
func _ready() -> void:
play_button.pressed.connect(_on_play_pressed)
editor_button.pressed.connect(_on_editor_pressed)
editor_button.enabled = true
quit_button.pressed.connect(_on_quit_pressed)
quit_button.visible = not OS.has_feature("web")
func _on_play_pressed() -> void:
GameState.reset_new_game()
get_tree().change_scene_to_file("res://Main.tscn")
func _on_editor_pressed() -> void:
if editor_button.enabled:
get_tree().change_scene_to_file("res://PlanetSetupEditor.tscn")
return
status_label.text = "Map editor coming soon"
func _on_quit_pressed() -> void:
get_tree().quit()