#84: move 215 root files into a folder hierarchy

Everything lived in one flat directory, so a diff gave no clue what area it
touched and finding the file you wanted meant knowing its exact name. Twelve
folders now, grouped by what a thing IS rather than what type it is - a
vessel's definition, its component scenes and its upgrade resources sit
together, because that is the set you read when you change one of them.

  buildings  core  controllers  enemies  logistics  planets
  resources  shaders  surface  ui  vessels  vfx  world

332 files moved and every res:// reference rewritten - 306 files touched,
including the autoload and main-scene paths in project.godot. Nothing renamed:
this is purely where files sit, so the diff is a pile of pure moves and no
behaviour is buried in it. ui_theme.tres, icon.svg and web_shell.html stay at
the root, where Godot and the export preset expect them.

Verified three ways, because a suite alone would not have caught all of it:
the full 117 pass, the web export builds clean, and the game renders.

The export is why that matters. The FIRST export after the move failed with
"Attempt to open script 'res://GameState.gd'" - the old path - while
project.godot on disk plainly said res://core/GameState.gd. That is this
project's documented Android FUSE mtime trap: Godot served a cached copy of a
file whose content had changed. A `touch` fixed it. Nothing in the test suite
would have found that, because the suite runs from a copy on a native
filesystem - the one place the bug cannot happen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-21 19:44:14 +02:00
commit 2f161621c3
495 changed files with 571 additions and 567 deletions

View file

@ -0,0 +1,14 @@
[gd_resource type="Resource" script_class="PlanetDefinition" load_steps=3 format=3]
[ext_resource type="Script" path="res://planets/PlanetDefinition.gd" id="1"]
[ext_resource type="PackedScene" path="res://planets/BlackHoleVisual.tscn" id="2"]
[resource]
script = ExtResource("1")
definition_id = "black_hole"
display_name = "Black hole"
names = PackedStringArray("Event Zero", "Umbral Well", "The Sinkhole", "Lightless Reach", "Null Point")
visual_scene = ExtResource("2")
surface_profile_id = "void"
resource_id = "dark_matter"
map_color = Color(0.55, 0.15, 0.85, 1)

View file

@ -0,0 +1,49 @@
extends Node2D
# Same informal interface as GasGiantVisual/RockyPlanetVisual - configure(),
# extractor_anchor(), animates via its own _process(). No solid body: the
# core stays genuinely empty (nothing drawn inside CORE_RADIUS), and an
# accretion disc of rotating arc segments - not closed rings - stands in
# for a surface, brighter and thicker toward the centre.
var disc_phase: float = 0.0
const CORE_RADIUS: float = 46.0
const RING_COUNT: int = 5
const RING_STEP: float = 16.0
const DISC_COLOR: Color = Color(0.55, 0.15, 0.85)
const DISC_HOT_COLOR: Color = Color(0.9, 0.6, 1.0)
func configure(_shape_seed: int) -> void:
queue_redraw()
func extractor_anchor() -> Vector2:
return Vector2(0.0, -(CORE_RADIUS + float(RING_COUNT - 1) * RING_STEP + 12.0))
func _process(delta: float) -> void:
disc_phase += delta
queue_redraw()
func _draw() -> void:
for i in range(RING_COUNT):
var radius: float = CORE_RADIUS + float(i) * RING_STEP
# 1.0 at the innermost ring, fading to 0.0 at the outermost - drives
# both colour (hotter inward) and stroke weight/brightness.
var t: float = 1.0 - float(i) / float(maxi(RING_COUNT - 1, 1))
var ring_color: Color = DISC_COLOR.lerp(DISC_HOT_COLOR, t * 0.65)
# Alternating spin direction per ring and a speed tied to t reads as
# genuine turbulence rather than one disc rotating as a rigid whole.
var spin: float = disc_phase * (0.12 + t * 0.22) * (1.0 if i % 2 == 0 else -1.0)
for arc_i in range(2):
var start: float = spin + float(arc_i) * PI + 0.15
var end: float = start + PI - 0.3
var points := PackedVector2Array()
var steps: int = 24
for j in range(steps + 1):
var angle: float = lerpf(start, end, float(j) / float(steps))
points.append(Vector2(cos(angle), sin(angle)) * radius)
NeonDraw.draw_glowing_path(self, points, ring_color, 0.5 + t * 0.5, 0.45 + t * 0.35)

View file

@ -0,0 +1 @@
uid://c6448m0c5bses

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://planets/BlackHoleVisual.gd" id="1"]
[node name="Visual" type="Node2D"]
script = ExtResource("1")

View file

@ -0,0 +1,14 @@
[gd_resource type="Resource" script_class="PlanetDefinition" load_steps=3 format=3]
[ext_resource type="Script" path="res://planets/PlanetDefinition.gd" id="1"]
[ext_resource type="PackedScene" path="res://planets/GasGiantVisual.tscn" id="2"]
[resource]
script = ExtResource("1")
definition_id = "gas_giant"
display_name = "Gas giant"
names = PackedStringArray("Aurelia", "Boreas", "Cerulean Deep", "Helios Major", "Vesper")
visual_scene = ExtResource("2")
surface_profile_id = "gas"
resource_id = "gas"
map_color = Color(0.65, 0.42, 0.9, 1)

31
planets/GasGiantVisual.gd Normal file
View file

@ -0,0 +1,31 @@
extends Node2D
var gas_phase: float = 0.0
func configure(_shape_seed: int) -> void:
queue_redraw()
func extractor_anchor() -> Vector2:
return Vector2(0.0, -118.0)
func _process(delta: float) -> void:
gas_phase += delta
queue_redraw()
func _draw() -> void:
var rim := PackedVector2Array()
for i in range(32):
var angle := TAU * float(i) / 32.0
rim.append(Vector2(cos(angle) * 118.0, sin(angle) * 118.0))
NeonDraw.draw_glowing_polygon(self, rim, Color(0.4, 0.78, 1.0), 0.9)
for row in [-62.0, -28.0, 8.0, 43.0, 73.0]:
var band := PackedVector2Array()
var half_width: float = sqrt(maxf(0.0, 118.0 * 118.0 - row * row))
for i in range(15):
var x := lerpf(-half_width, half_width, float(i) / 14.0)
band.append(Vector2(x, row + sin(x * 0.045 + gas_phase * 1.6 + row) * 7.0))
NeonDraw.draw_glowing_path(self, band, Color(0.85, 0.52, 1.0), 0.75, 0.65)

View file

@ -0,0 +1 @@
uid://bxfw4ja2hw4pf

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://planets/GasGiantVisual.gd" id="1"]
[node name="Visual" type="Node2D"]
script = ExtResource("1")

123
planets/Planet.gd Normal file
View file

@ -0,0 +1,123 @@
extends Node2D
const PLANET_DEFINITIONS = preload("res://planets/PlanetDefinitions.gd")
# A landable world-object - unlike regular Asteroid.gd, planets are
# stationary ("Big Stable Asteroid" - stable means it doesn't drift or
# destroy ships on touch). Whether the fleet counts as "landed" is decided
# by PlanetField comparing the fleet's CENTROID distance to landing_radius,
# not per-ship Area2D collision - a single stable number, immune to the
# constant minor jostling of individual ships holding formation, which
# used to make the "enter atmosphere" prompt flicker on/off as ships
# drifted in and out of the boundary independently of each other even
# while the fleet as a whole was clearly sitting on the planet.
@export var planet_name: String = ""
@export var planet_id: String = ""
@export var definition_id: String = PLANET_DEFINITIONS.DEFAULT_DEFINITION_ID
@export var landing_radius: float = 140.0
# Set by whoever spawns this planet (PlanetField, seeded from the chunk's
# own coordinates) so the outline shape is stable across respawns of the
# same chunk, instead of reading as a "different" planet every time.
@export var shape_seed: int = 0
var definition: Resource
var visual: Node2D
var resource_type: String:
get: return String(definition.resource_id) if definition != null else "ore"
var surface_profile_id: String:
get: return String(definition.surface_profile_id) if definition != null else "rocky"
var shape_points: PackedVector2Array:
get:
if visual != null and "shape_points" in visual:
return visual.shape_points
return PackedVector2Array()
var gas_phase: float:
get:
if visual != null and "gas_phase" in visual:
return float(visual.gas_phase)
return 0.0
# An extractor is built down on this planet's SURFACE, in a different scene
# the player is no longer looking at, so from space nothing distinguished a
# planet already being mined from an untouched one - you had to land to find
# out. This is a derrick planted on the rim: the same amber the world map
# uses for its extractor badge, so the two read as the same fact.
const EXTRACTOR_MARKER_COLOR: Color = Color(1.0, 0.85, 0.3)
const DERRICK_HEIGHT: float = 44.0
const DERRICK_HALF_WIDTH: float = 16.0
# Kept in step with GameState.extractor_added rather than polled per frame.
# An extractor is built from SPACE (BuildController._planet_under_fleet(),
# with the fleet parked on the planet), so this node is already in the tree
# with its _ready() long since run when the answer changes - resolving it
# only at _ready() left the planet looking untouched until it happened to
# despawn and respawn.
var shows_extractor: bool = false
func _ready() -> void:
add_to_group("planets")
z_index = -1
definition = PLANET_DEFINITIONS.get_definition(definition_id)
visual = definition.visual_scene.instantiate()
visual.configure(shape_seed)
get_node("VisualHost").add_child(visual)
if planet_id == "":
planet_id = planet_name
shows_extractor = GameState.has_extractor_at(planet_id)
GameState.extractor_added.connect(_on_extractor_added)
queue_redraw()
func _on_extractor_added(built_on: String) -> void:
# Only the planet it was actually built on, and only a redraw when the
# answer really changed - every other planet in range gets this too.
if built_on != planet_id or shows_extractor:
return
shows_extractor = true
queue_redraw()
func extractor_derrick_anchor() -> Vector2:
if visual != null and visual.has_method("extractor_anchor"):
return visual.extractor_anchor()
return Vector2(0.0, -100.0)
func extractor_derrick_tip() -> Vector2:
# Exposed separately from the polygon because "does the derrick clear the
# planet's outline" is a question about the TIP alone. The base corners
# sit a half-width off to either side, so they are sqrt(|base|^2 + w^2)
# from the centre and can clear the rim on their own even when the tower
# points straight into the ground.
var base: Vector2 = extractor_derrick_anchor()
var out: Vector2 = base.normalized()
if out == Vector2.ZERO:
out = Vector2.UP
return base + out * DERRICK_HEIGHT
func extractor_derrick_points() -> PackedVector2Array:
var base: Vector2 = extractor_derrick_anchor()
var out: Vector2 = base.normalized()
if out == Vector2.ZERO:
out = Vector2.UP
var side: Vector2 = Vector2(-out.y, out.x)
var tip: Vector2 = extractor_derrick_tip()
return PackedVector2Array([
base - side * DERRICK_HALF_WIDTH,
tip - side * (DERRICK_HALF_WIDTH * 0.35),
tip + side * (DERRICK_HALF_WIDTH * 0.35),
base + side * DERRICK_HALF_WIDTH,
])
func _draw() -> void:
if shows_extractor:
NeonDraw.draw_glowing_polygon(self, extractor_derrick_points(), EXTRACTOR_MARKER_COLOR, 1.0)

1
planets/Planet.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://berbdl8nqskqa

8
planets/Planet.tscn Normal file
View file

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://planets/Planet.gd" id="1"]
[node name="Planet" type="Node2D"]
script = ExtResource("1")
[node name="VisualHost" type="Node2D" parent="."]

View file

@ -0,0 +1,133 @@
extends Node2D
# Space-side: bootstraps the fleet on Main.tscn startup (a fresh 5-ship
# fleet at the origin on first launch, or GameState's surviving ship
# count/position if we just returned from a planet's surface), shows an
# "enter atmosphere" prompt (name + button) when the fleet is standing on
# a landable planet, and - on press - fades out and swaps to a completely
# separate PlanetSurface.tscn scene (not an overlay toggled in place), so
# asteroids/enemies genuinely cannot exist there rather than merely being
# hidden. Fleet size and the world position/zoom to return to are handed
# off via the GameState autoload, since change_scene_to_file() tears down
# this whole scene tree.
@export var fade_duration: float = 0.4
@export var prompt_debounce_time: float = 0.15
@onready var planet_field: Node2D = get_node("../PlanetField")
@onready var asteroid_field: Node2D = get_node("../AsteroidField")
@onready var fleet: Node2D = get_node("../Fleet")
@onready var camera: Camera2D = get_node("../Camera2D")
@onready var planet_name_label: Label = get_node("../UI/PlanetNameLabel")
@onready var enter_button: IconButton = get_node("../UI/EnterAtmosphereButton")
@onready var world_map: Control = get_node("../UI/WorldMap")
@onready var build_controller: Node2D = get_node("../BuildController")
@onready var fade_rect: ColorRect = get_node("../FadeOverlay/FadeRect")
var current_planet: Node2D = null
var transitioning: bool = false
var pending_planet: Node2D = null
var pending_time: float = 0.0
func _ready() -> void:
enter_button.pressed.connect(_on_enter_pressed)
if GameState.has_return_position:
fleet.spawn_ships(GameState.surviving_ship_count, GameState.return_world_position,
GameState.surviving_vessel_types)
camera.position = GameState.return_world_position
camera.zoom = Vector2(GameState.return_camera_zoom, GameState.return_camera_zoom)
GameState.has_return_position = false
else:
# A brand new game. STARTING_SHIP_COUNT rather than a literal: this
# said 5, which was the old BASE_FLEET_SIZE written out by hand, and
# it silently became "however many slots exist" once max_fleet_size()
# clamped it. The opening fleet size is one decision and it lives in
# GameState.
fleet.spawn_ships(GameState.STARTING_SHIP_COUNT, Vector2.ZERO)
# AsteroidField/PlanetField normally only populate nearby chunks once
# their own check_interval timer elapses (~1s) - fine during normal
# continuous play (things appear far off-screen, gradually), but
# right after a fresh scene load it means an empty-looking world for
# a second before asteroids/the planet visibly pop in. Force an
# immediate synchronous populate now that the fleet is correctly
# positioned, so nothing is missing on the very first visible frame.
# DEFERRED, not called straight through. Everything above runs inside the
# single frame that builds Main.tscn, and these two populate 25 and 49
# chunks of world on top of it - 150-odd asteroids plus planets and their
# visuals. On a phone browser that frame is where the scene appeared to
# hang forever: nothing can paint until it ends, so a slow frame and a
# freeze look identical. One frame later is still immediate to the eye,
# and it lets the scene draw first.
asteroid_field.update_chunks.call_deferred()
planet_field.update_chunks.call_deferred()
func _process(delta: float) -> void:
if transitioning:
return
if world_map.visible or build_controller.is_showing_building_prompt():
# Context actions belong to BuildController. This controller owns the
# debounced planet selection and label, and suppresses both while a modal
# screen is open.
current_planet = null
pending_planet = null
planet_name_label.visible = false
return
# Debounced: only commit a visible/hidden change once the raw
# landing-detection result has stayed the same for prompt_debounce_time
# in a row, instead of reacting to every single frame's reading. Belt
# and suspenders on top of get_planet_fleet_is_on() already using the
# fleet's centroid (a single stable number - see Planet.gd) rather
# than any individual ship's position, so this only has to absorb
# genuine sub-debounce-window boundary crossings, not constant noise.
var detected_planet: Node2D = planet_field.get_planet_fleet_is_on()
if detected_planet != pending_planet:
pending_planet = detected_planet
pending_time = 0.0
else:
pending_time += delta
if pending_time < prompt_debounce_time or pending_planet == current_planet:
return
current_planet = pending_planet
if current_planet != null:
planet_name_label.text = current_planet.planet_name
planet_name_label.visible = true
else:
planet_name_label.visible = false
func _on_enter_pressed() -> void:
if transitioning or current_planet == null:
return
transitioning = true
planet_name_label.visible = false
enter_button.visible = false
GameState.has_return_position = true
GameState.surviving_ship_count = fleet.ships.size()
GameState.surviving_vessel_types = fleet.vessel_types()
# The planet's own position, not fleet.get_centroid() - the fleet only
# needs to be somewhere within the planet's landing radius (not
# centered exactly on it) for the prompt to show, so the centroid can
# be tens of units off from the planet. Returning should always place
# the fleet back at the planet itself.
GameState.return_world_position = current_planet.position
GameState.return_camera_zoom = camera.zoom.x
GameState.planet_name = current_planet.planet_name
GameState.planet_id = current_planet.planet_id
GameState.planet_definition_id = current_planet.definition_id
var tween: Tween = create_tween()
tween.tween_property(fade_rect, "color:a", 1.0, fade_duration)
tween.tween_callback(_enter_surface)
func _enter_surface() -> void:
get_tree().change_scene_to_file("res://surface/PlanetSurface.tscn")

View file

@ -0,0 +1 @@
uid://dfof82skt2f4d

View file

@ -0,0 +1,14 @@
class_name PlanetDefinition
extends Resource
@export var definition_id: String = "rocky"
@export var display_name: String = "Rocky planet"
@export var names: PackedStringArray = []
@export var visual_scene: PackedScene
@export var surface_profile_id: String = "rocky"
@export var resource_id: String = "ore"
@export var map_color: Color = Color(0.7, 0.65, 0.55)
# Optional reward granted once when every authored capture point is claimed.
# Keeping it on the definition lets conquest remain generic as new planet
# rewards are introduced.
@export var conquest_research_points: int = 0

View file

@ -0,0 +1 @@
uid://dt6tsdmmlnfaf

View file

@ -0,0 +1,18 @@
class_name PlanetDefinitions
extends RefCounted
const ROCKY_ID: String = "rocky"
const GAS_GIANT_ID: String = "gas_giant"
const BLACK_HOLE_ID: String = "black_hole"
const RESEARCH_LAB_ID: String = "research_lab"
const DEFAULT_DEFINITION_ID: String = ROCKY_ID
const DEFINITIONS: Dictionary = {
ROCKY_ID: preload("res://planets/RockyPlanetDefinition.tres"),
GAS_GIANT_ID: preload("res://planets/GasGiantDefinition.tres"),
BLACK_HOLE_ID: preload("res://planets/BlackHolePlanetDefinition.tres"),
RESEARCH_LAB_ID: preload("res://planets/ResearchLabPlanetDefinition.tres"),
}
static func get_definition(definition_id: String) -> Resource:
return DEFINITIONS.get(definition_id, DEFINITIONS[DEFAULT_DEFINITION_ID])

View file

@ -0,0 +1 @@
uid://ipsld2ex2t8e

96
planets/PlanetField.gd Normal file
View file

@ -0,0 +1,96 @@
extends Node2D
# Spawns "Big Stable Asteroid" planets in ASTEROID_FIELD biome chunks near
# the fleet where WorldGen says one belongs, and despawns them once the
# fleet has moved far enough away - mirrors AsteroidField's chunk-lifecycle
# pattern, but at a sparser, larger-radius scale since planets are rare
# landmarks rather than common decoration.
@export var check_interval: float = 1.0
@export var spawn_radius_chunks: int = 3
@export var despawn_radius_chunks: int = 6
@onready var fleet: Node2D = get_node("../Fleet")
var planet_scene: PackedScene = preload("res://planets/Planet.tscn")
var populated_chunks: Dictionary = {}
var timer: float = 0.0
func _process(delta: float) -> void:
timer += delta
if timer < check_interval:
return
timer = 0.0
update_chunks()
func get_planet_fleet_is_on() -> Node2D:
# Fleet centroid distance, not per-ship Area2D overlap - a single
# stable number instead of many independently-noisy ship positions.
# See Planet.gd for why this matters.
var fleet_centroid: Vector2 = fleet.get_centroid()
for chunk in populated_chunks.keys():
for planet in populated_chunks[chunk]:
if is_instance_valid(planet) and planet.position.distance_to(fleet_centroid) <= planet.landing_radius:
return planet
return null
func update_chunks() -> void:
# Public (not just called from _process's own timer): also invoked
# once synchronously right after the fleet is positioned on a fresh
# Main.tscn load, so a nearby planet exists immediately instead of
# only appearing ~check_interval seconds later - most noticeable as a
# jarring pop-in right after returning from a planet's surface.
var center_chunk: Vector2i = WorldGen.chunk_coords(fleet.get_centroid())
for dx in range(-spawn_radius_chunks, spawn_radius_chunks + 1):
for dy in range(-spawn_radius_chunks, spawn_radius_chunks + 1):
var chunk: Vector2i = center_chunk + Vector2i(dx, dy)
if populated_chunks.has(chunk):
continue
if not WorldGen.has_planet_at_chunk(chunk):
continue
_spawn_chunk_planet(chunk)
var to_remove: Array = []
for chunk in populated_chunks.keys():
if _chebyshev_chunk_distance(chunk, center_chunk) > despawn_radius_chunks:
for planet in populated_chunks[chunk]:
if is_instance_valid(planet):
planet.queue_free()
to_remove.append(chunk)
for chunk in to_remove:
populated_chunks.erase(chunk)
func _chebyshev_chunk_distance(a: Vector2i, b: Vector2i) -> int:
return max(abs(a.x - b.x), abs(a.y - b.y))
func _spawn_chunk_planet(chunk: Vector2i) -> void:
# WorldGen.planet_data_at_chunk() is seeded purely from the chunk's own
# coordinates, so a given chunk always produces the exact same planet -
# name, position within the chunk, and shape - no matter how many times
# it's despawned and respawned across a scene reload. It's also the
# same function the world map uses to place a marker for a
# not-currently-loaded explored chunk, so the two never disagree.
var data: Dictionary = WorldGen.planet_data_at_chunk(chunk)
var origin: Vector2 = WorldGen.chunk_origin(chunk)
var planet: Node2D = planet_scene.instantiate()
planet.position = origin + data.local_pos
planet.planet_name = data.name
planet.planet_id = data.planet_id
planet.shape_seed = data.shape_seed
planet.definition_id = String(data.get("definition_id", "rocky"))
# Deferred: update_chunks() can run synchronously from inside a
# parent's own _ready() chain (forced once right after the fleet is
# positioned, to avoid a pop-in on scene load) - Godot refuses a
# direct add_child() while the tree is still "busy setting up
# children" in that situation, so this must be deferred either way.
get_parent().add_child.call_deferred(planet)
populated_chunks[chunk] = [planet]

View file

@ -0,0 +1 @@
uid://cxgnqiqa11o0f

View file

@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PlanetDefinition" load_steps=3 format=3]
[ext_resource type="Script" path="res://planets/PlanetDefinition.gd" id="1"]
[ext_resource type="PackedScene" path="res://planets/ResearchLabPlanetVisual.tscn" id="2"]
[resource]
script = ExtResource("1")
definition_id = "research_lab"
display_name = "Research Lab"
names = PackedStringArray("Blacksite Zero", "Cordoned Array", "Dead Signal Station", "The Vault", "Interdicted Post")
visual_scene = ExtResource("2")
surface_profile_id = "research_lab"
resource_id = ""
map_color = Color(0.7, 0.2, 0.15, 1)
conquest_research_points = 0

View file

@ -0,0 +1,55 @@
extends Node2D
# Same informal interface as GasGiantVisual/RockyPlanetVisual - configure(),
# extractor_anchor(), animates via its own _process(). Deliberately angular
# and armoured rather than a natural silhouette (#63: this is an ENEMY
# installation, not a celestial body), with a rotating dish and blinking
# warning lights to read as occupied/hostile at a glance.
var phase: float = 0.0
const RADIUS: float = 108.0
const HULL_COLOR: Color = Color(0.55, 0.1, 0.08)
const CORE_COLOR: Color = Color(0.9, 0.25, 0.18)
const WARNING_COLOR: Color = Color(1.0, 0.2, 0.15)
const DARK_CORE: Color = Color(0.14, 0.02, 0.02)
func configure(_shape_seed: int) -> void:
queue_redraw()
func extractor_anchor() -> Vector2:
return Vector2(0.0, -(RADIUS + 40.0))
func _process(delta: float) -> void:
phase += delta
queue_redraw()
func _draw() -> void:
var hull: PackedVector2Array = PackedVector2Array()
for i in range(6):
var angle: float = TAU * float(i) / 6.0
hull.append(Vector2(cos(angle), sin(angle)) * RADIUS)
NeonDraw.draw_glowing_polygon(self, hull, HULL_COLOR, 0.85, DARK_CORE)
var inner: PackedVector2Array = PackedVector2Array()
for i in range(6):
var angle: float = TAU * float(i) / 6.0 + PI / 6.0
inner.append(Vector2(cos(angle), sin(angle)) * RADIUS * 0.55)
NeonDraw.draw_glowing_polygon(self, inner, CORE_COLOR, 0.9, DARK_CORE)
# A slow-rotating dish - reads as actively transmitting, not derelict.
var dish_angle: float = phase * 0.6
var dish_tip: Vector2 = Vector2(cos(dish_angle), sin(dish_angle)) * RADIUS * 1.35
NeonDraw.draw_glowing_line(self, Vector2.ZERO, dish_tip, CORE_COLOR, 0.8, 0.55, DARK_CORE)
NeonDraw.draw_glowing_circle(self, dish_tip, 11.0, CORE_COLOR, 1.0, DARK_CORE)
# Blinking hull-corner warning lights.
var blink: float = 0.4 + 0.6 * absf(sin(phase * 4.0))
for i in range(6):
var angle: float = TAU * float(i) / 6.0
var at: Vector2 = Vector2(cos(angle), sin(angle)) * RADIUS
NeonDraw.draw_glowing_circle(self, at, 5.0, WARNING_COLOR, blink, DARK_CORE)

View file

@ -0,0 +1 @@
uid://c6nasspc8ewwj

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://planets/ResearchLabPlanetVisual.gd" id="1"]
[node name="Visual" type="Node2D"]
script = ExtResource("1")

View file

@ -0,0 +1,14 @@
[gd_resource type="Resource" script_class="PlanetDefinition" load_steps=3 format=3]
[ext_resource type="Script" path="res://planets/PlanetDefinition.gd" id="1"]
[ext_resource type="PackedScene" path="res://planets/RockyPlanetVisual.tscn" id="2"]
[resource]
script = ExtResource("1")
definition_id = "rocky"
display_name = "Rocky planet"
names = PackedStringArray("Kepler's Rest", "Ceres Minor", "Vesta's Shadow", "Ironhold", "Drift Anchor", "Stonefall", "Grey Watch", "Silent Quarry", "Baros Rock", "Umbra Point")
visual_scene = ExtResource("2")
surface_profile_id = "rocky"
resource_id = "ore"
map_color = Color(0.7, 0.65, 0.55, 1)

View file

@ -0,0 +1,26 @@
extends Node2D
var shape_points: PackedVector2Array = PackedVector2Array()
func configure(shape_seed: int) -> void:
shape_points.clear()
var rng := RandomNumberGenerator.new()
rng.seed = shape_seed
for i in range(10):
var angle: float = (float(i) / 10.0) * TAU
var radius: float = rng.randf_range(70.0, 100.0)
shape_points.append(Vector2(cos(angle), sin(angle)) * radius)
queue_redraw()
func extractor_anchor() -> Vector2:
var anchor := Vector2(0.0, -100.0)
for point in shape_points:
if point.y < anchor.y:
anchor = point
return anchor
func _draw() -> void:
NeonDraw.draw_glowing_polygon(self, shape_points, Color(0.6, 0.55, 0.5), 1.0)

View file

@ -0,0 +1 @@
uid://b82xh8nosedlm

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://planets/RockyPlanetVisual.gd" id="1"]
[node name="Visual" type="Node2D"]
script = ExtResource("1")