2026-08-15 21:22:10 +02:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
|
|
# Preloaded by path rather than an `is CapturePoint` check - this preview
|
|
|
|
|
# runs through screenshot.sh, which (unlike run_tests.sh) does not run an
|
|
|
|
|
# import pass first, so the global class_name cache may not be warm yet.
|
#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>
2026-08-21 19:44:14 +02:00
|
|
|
const CAPTURE_POINT_SCRIPT = preload("res://surface/CapturePoint.gd")
|
2026-08-15 21:22:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
GameState.planet_name = "Kepler's Rest"
|
|
|
|
|
GameState.planet_id = "chunk:3:7"
|
|
|
|
|
GameState.planet_definition_id = "rocky"
|
|
|
|
|
GameState.surviving_ship_count = 3
|
|
|
|
|
GameState.rocks = 128
|
#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>
2026-08-21 19:44:14 +02:00
|
|
|
var surface: Node = load("res://surface/PlanetSurface.tscn").instantiate()
|
2026-08-15 21:22:10 +02:00
|
|
|
surface.get_node("SurfaceController").fade_duration = 0.0
|
|
|
|
|
add_child(surface)
|
|
|
|
|
|
|
|
|
|
# Zoomed out so all three ~220-radius capture rings fit the frame with
|
|
|
|
|
# margin, regardless of wherever the real setup's points happen to sit.
|
|
|
|
|
surface.get_node("Camera2D").zoom = Vector2(0.55, 0.55)
|
|
|
|
|
|
|
|
|
|
var host: Node = surface.get_node("SurfaceFeatures/PlanetSetupHost")
|
|
|
|
|
var points: Array = []
|
|
|
|
|
for child in host.get_children():
|
|
|
|
|
if child.get_script() == CAPTURE_POINT_SCRIPT:
|
|
|
|
|
points.append(child)
|
|
|
|
|
|
|
|
|
|
# Lay the three points out in a compact, clearly-separated triangle for
|
|
|
|
|
# the screenshot, rather than the real (far-flung) authored positions.
|
2026-08-15 22:47:44 +02:00
|
|
|
# Point 0 sits at the origin - exactly where the fleet spawns - so the
|
|
|
|
|
# screenshot also proves the #50 z_index fix: the ring must not occlude
|
|
|
|
|
# the ships parked on top of it.
|
|
|
|
|
var layout: Array = [Vector2(0, 0), Vector2(-300, 150), Vector2(300, -200)]
|
2026-08-15 21:22:10 +02:00
|
|
|
for i in range(mini(points.size(), layout.size())):
|
|
|
|
|
points[i].position = layout[i]
|
|
|
|
|
|
|
|
|
|
# Show all three states at once: captured, mid-fill, and blocked. Each
|
|
|
|
|
# point's own _process() would otherwise immediately recompute state
|
|
|
|
|
# from the real (empty, this far from any ship) fleet/enemy proximity
|
|
|
|
|
# and overwrite these on the very next frame, so freeze it after setting
|
|
|
|
|
# the display state - same technique as freezing enemy.speed for the
|
|
|
|
|
# gas bomber screenshot.
|
|
|
|
|
if points.size() >= 1:
|
|
|
|
|
points[0].mark_captured()
|
|
|
|
|
points[0].set_process(false)
|
|
|
|
|
GameState.mark_point_captured(GameState.planet_id, points[0].point_index)
|
|
|
|
|
if points.size() >= 2:
|
|
|
|
|
points[1].state = CAPTURE_POINT_SCRIPT.State.CAPTURING
|
|
|
|
|
points[1].progress = 0.55
|
|
|
|
|
points[1].queue_redraw()
|
|
|
|
|
points[1].set_process(false)
|
|
|
|
|
if points.size() >= 3:
|
|
|
|
|
points[2].state = CAPTURE_POINT_SCRIPT.State.BLOCKED
|
|
|
|
|
points[2].progress = 0.3
|
|
|
|
|
points[2].queue_redraw()
|
|
|
|
|
points[2].set_process(false)
|