Add planet setups as authored resources (#42)

PlanetSetup/PlanetSetupSpawn define a curated capture-point/enemy
layout for a surface profile; PlanetSetups scans res://PlanetSetups/
at first use (not a hardcoded preload table) so dropping in a new
.tres is the only step needed to add one, and resolves the same
setup for the same planet deterministically, same pattern as
WorldGen.planet_data_at_chunk. PlanetSurfaceController composes a
PlanetSetupHost onto the landed surface alongside the existing
resource-provider feature scene.

Ships two starter setups (rocky_default, gas_default) with
placeholder capture-point markers; #43 replaces the markers with the
real CapturePoint scene through the same apply_setup() entry point.

Part of the #40 conquest-mechanic breakdown.
This commit is contained in:
Loïc Wisniewski 2026-08-15 14:41:37 +02:00
commit 5326852807
17 changed files with 350 additions and 4 deletions

33
PlanetSetupHost.gd Normal file
View file

@ -0,0 +1,33 @@
class_name PlanetSetupHost
extends Node2D
# Instantiates the contents of a PlanetSetup onto a landed surface. Capture
# points are placeholder markers here; #43 replaces them with the real
# CapturePoint scene through the same apply_setup() entry point, and enemy
# spawning is filled in by the enemy-foundation ticket (#44). Keeping this
# seam stable is the point of this ticket.
const MARKER_COLOR: Color = Color(0.55, 0.85, 1.0)
const MARKER_RADIUS: float = 36.0
var setup: Resource
func apply_setup(new_setup: Resource) -> void:
setup = new_setup
for child in get_children():
child.queue_free()
if setup == null:
return
for point in setup.capture_points:
_add_capture_point_marker(point)
func _add_capture_point_marker(at: Vector2) -> void:
var marker: NeonPiece = NeonPiece.create(self, at, MARKER_COLOR)
var points: PackedVector2Array = PackedVector2Array()
for i in range(16):
var angle: float = float(i) / 16.0 * TAU
points.append(Vector2(cos(angle), sin(angle)) * MARKER_RADIUS)
marker.add_polygon(points, 0.6)
marker.queue_redraw()