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.
14 lines
510 B
GDScript
14 lines
510 B
GDScript
extends Node2D
|
|
|
|
|
|
func _ready() -> void:
|
|
var editor: Node = load("res://PlanetSetupEditor.tscn").instantiate()
|
|
add_child(editor)
|
|
editor.new_setup("preview_setup", "Preview Setup", "rocky")
|
|
editor.add_capture_point(Vector2(300, 150))
|
|
editor.add_capture_point(Vector2(-250, 300))
|
|
editor.add_enemy("chaser", Vector2(200, -300))
|
|
editor.add_enemy("sniper", Vector2(-300, -150))
|
|
editor.add_enemy("artillery", Vector2(0, 350))
|
|
editor.selected_item = {"kind": "capture", "index": 0}
|
|
editor._rebuild_markers()
|