2026-08-13 22:04:21 +02:00
|
|
|
extends Node2D
|
Implement #77, #78 and #79
#77 - the Distorder becomes the Energy Propulser. Renamed everywhere the
player reads it, reskinned to match: a symmetric hull flaring into an engine
skirt instead of the lopsided warped lump, an engine bell with a thrust plume
instead of the wobbling ring glyph, and energy's own yellow instead of purple,
since energy is what it burns. The internal id stays "distorder" - it is the
capability string, the unlock key and the component scene name, and renaming
the wiring would be a large mechanical change with no player-visible effect.
Its speed ceiling now grows with the LOGARITHM of how many fly. Each one used
to add a flat 1.0, so a fleet that could afford six simply drove at six times
cruise and the vessel stopped being a choice. Base-2 makes the rule one
sentence - every doubling adds another 1.0 - and leaves two propulsers worth
exactly what they were worth before, so nothing already built is devalued.
#78 - a gas burner can be paused. It converts gas the player may want for
bombs into energy they may not need yet, and the only way to stop it was to
demolish it. The action is data-driven like every other: the visual's
ActionProvider lists "pause", and any converter can adopt it. Pause is the
burner's PRIMARY action, so it is one tap rather than a menu; the button shows
what it will DO, bars while running and a play triangle while stopped; and the
building itself goes visibly cold, because a paused building that looked
identical to a running one would be a setting to remember rather than see.
Conversion progress is left where it was rather than reset, so switching off
and on again does not discard a part-finished unit.
#79 - picking something up says so. A "+N" with the resource's own mark rises
and fades where it happened. Built from the SAME glyph the resource tables and
transfer rows use, so a material added to the catalog later cannot end up with
one mark in the HUD and a different one in the world. A pickup a full hold
REFUSES raises nothing.
Two Godot traps cost real time here and are now written down where the next
person will hit them:
- a `#` comment inside a .tres [resource] block is not a comment. It parses
as part of the preceding value and silently blanks the property after it.
One in DistorderVesselDefinition.tres left definition_id empty, which
surfaced as "<blank> did not resolve its definition" in a test far from
the edit. The note lives in VesselDefinition.gd now.
- a global class_name is not reliably resolvable, INCLUDING a script's own
inside its own static function. ResourcePickupVFX.new() failed to compile
when reached through a preview scene, taking Rock and the gas vents with
it. It has no class_name now and constructs itself by path.
Suite 114/114.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 17:38:30 +02:00
|
|
|
|
|
|
|
|
# By path, not by its `ResourcePickupVFX` global name: a bare class-name
|
|
|
|
|
# reference needs the global class cache already warm, which it is not when
|
|
|
|
|
# this script is reached indirectly - loading Main.tscn from inside a preview
|
|
|
|
|
# scene made it a hard parse error. Same workaround PlanetSetups and
|
|
|
|
|
# PlanetSetupEditor already use.
|
#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 RESOURCE_PICKUP_VFX = preload("res://vfx/ResourcePickupVFX.gd")
|
Implement #77, #78 and #79
#77 - the Distorder becomes the Energy Propulser. Renamed everywhere the
player reads it, reskinned to match: a symmetric hull flaring into an engine
skirt instead of the lopsided warped lump, an engine bell with a thrust plume
instead of the wobbling ring glyph, and energy's own yellow instead of purple,
since energy is what it burns. The internal id stays "distorder" - it is the
capability string, the unlock key and the component scene name, and renaming
the wiring would be a large mechanical change with no player-visible effect.
Its speed ceiling now grows with the LOGARITHM of how many fly. Each one used
to add a flat 1.0, so a fleet that could afford six simply drove at six times
cruise and the vessel stopped being a choice. Base-2 makes the rule one
sentence - every doubling adds another 1.0 - and leaves two propulsers worth
exactly what they were worth before, so nothing already built is devalued.
#78 - a gas burner can be paused. It converts gas the player may want for
bombs into energy they may not need yet, and the only way to stop it was to
demolish it. The action is data-driven like every other: the visual's
ActionProvider lists "pause", and any converter can adopt it. Pause is the
burner's PRIMARY action, so it is one tap rather than a menu; the button shows
what it will DO, bars while running and a play triangle while stopped; and the
building itself goes visibly cold, because a paused building that looked
identical to a running one would be a setting to remember rather than see.
Conversion progress is left where it was rather than reset, so switching off
and on again does not discard a part-finished unit.
#79 - picking something up says so. A "+N" with the resource's own mark rises
and fades where it happened. Built from the SAME glyph the resource tables and
transfer rows use, so a material added to the catalog later cannot end up with
one mark in the HUD and a different one in the world. A pickup a full hold
REFUSES raises nothing.
Two Godot traps cost real time here and are now written down where the next
person will hit them:
- a `#` comment inside a .tres [resource] block is not a comment. It parses
as part of the preceding value and silently blanks the property after it.
One in DistorderVesselDefinition.tres left definition_id empty, which
surfaced as "<blank> did not resolve its definition" in a test far from
the edit. The note lives in VesselDefinition.gd now.
- a global class_name is not reliably resolvable, INCLUDING a script's own
inside its own static function. ResourcePickupVFX.new() failed to compile
when reached through a preview scene, taking Rock and the gas vents with
it. It has no class_name now and constructs itself by path.
Suite 114/114.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 17:38:30 +02:00
|
|
|
|
2026-08-14 16:05:32 +02:00
|
|
|
@export var fleet_path: NodePath = NodePath("../Fleet")
|
|
|
|
|
@onready var fleet: Node2D = get_node(fleet_path)
|
2026-08-13 22:04:21 +02:00
|
|
|
var vents: Array[Vector2] = []
|
|
|
|
|
var progress: float = 0.0
|
2026-08-14 13:44:10 +02:00
|
|
|
var emission_phase: float = 0.0
|
2026-08-13 22:04:21 +02:00
|
|
|
func _ready() -> void:
|
2026-08-22 23:29:21 +02:00
|
|
|
# #91: the vents are ground features and must never cover the fleet.
|
|
|
|
|
# SurfaceFeatures is added AFTER Fleet in PlanetSurface.tscn, so at the
|
|
|
|
|
# default z_index of 0 the later sibling simply wins and the player flies
|
|
|
|
|
# UNDER their own gas source. Same fix, and the same reason, as #50's
|
|
|
|
|
# capture rings and the rocks on a rocky surface (Rock.gd) - the
|
|
|
|
|
# difference is that this field draws in its own _draw() rather than
|
|
|
|
|
# spawning child nodes, so the depth belongs on the field itself.
|
|
|
|
|
z_index = -1
|
2026-08-13 22:04:21 +02:00
|
|
|
var rng := RandomNumberGenerator.new()
|
2026-08-14 22:16:40 +02:00
|
|
|
rng.seed = hash(GameState.planet_id if GameState.planet_id != "" else GameState.planet_name)
|
2026-08-13 22:04:21 +02:00
|
|
|
for i in range(6): vents.append(Vector2(rng.randf_range(-800,800), rng.randf_range(-650,650)))
|
|
|
|
|
queue_redraw()
|
|
|
|
|
func _process(delta: float) -> void:
|
2026-08-14 13:44:10 +02:00
|
|
|
emission_phase = fmod(emission_phase + delta * 0.55, 1.0)
|
|
|
|
|
queue_redraw()
|
2026-08-13 22:04:21 +02:00
|
|
|
for vent in vents:
|
|
|
|
|
if fleet.get_centroid().distance_to(vent) < 90.0:
|
|
|
|
|
progress += delta
|
|
|
|
|
if progress >= 1.0:
|
2026-08-16 14:53:26 +02:00
|
|
|
# #56: a full fleet hold rejects the deposit - keep the
|
|
|
|
|
# undelivered whole units in progress rather than discarding
|
|
|
|
|
# them, so gas is only ever lost by not gathering it.
|
|
|
|
|
var whole: int = int(progress)
|
Implement #77, #78 and #79
#77 - the Distorder becomes the Energy Propulser. Renamed everywhere the
player reads it, reskinned to match: a symmetric hull flaring into an engine
skirt instead of the lopsided warped lump, an engine bell with a thrust plume
instead of the wobbling ring glyph, and energy's own yellow instead of purple,
since energy is what it burns. The internal id stays "distorder" - it is the
capability string, the unlock key and the component scene name, and renaming
the wiring would be a large mechanical change with no player-visible effect.
Its speed ceiling now grows with the LOGARITHM of how many fly. Each one used
to add a flat 1.0, so a fleet that could afford six simply drove at six times
cruise and the vessel stopped being a choice. Base-2 makes the rule one
sentence - every doubling adds another 1.0 - and leaves two propulsers worth
exactly what they were worth before, so nothing already built is devalued.
#78 - a gas burner can be paused. It converts gas the player may want for
bombs into energy they may not need yet, and the only way to stop it was to
demolish it. The action is data-driven like every other: the visual's
ActionProvider lists "pause", and any converter can adopt it. Pause is the
burner's PRIMARY action, so it is one tap rather than a menu; the button shows
what it will DO, bars while running and a play triangle while stopped; and the
building itself goes visibly cold, because a paused building that looked
identical to a running one would be a setting to remember rather than see.
Conversion progress is left where it was rather than reset, so switching off
and on again does not discard a part-finished unit.
#79 - picking something up says so. A "+N" with the resource's own mark rises
and fades where it happened. Built from the SAME glyph the resource tables and
transfer rows use, so a material added to the catalog later cannot end up with
one mark in the HUD and a different one in the world. A pickup a full hold
REFUSES raises nothing.
Two Godot traps cost real time here and are now written down where the next
person will hit them:
- a `#` comment inside a .tres [resource] block is not a comment. It parses
as part of the preceding value and silently blanks the property after it.
One in DistorderVesselDefinition.tres left definition_id empty, which
surfaced as "<blank> did not resolve its definition" in a test far from
the edit. The note lives in VesselDefinition.gd now.
- a global class_name is not reliably resolvable, INCLUDING a script's own
inside its own static function. ResourcePickupVFX.new() failed to compile
when reached through a preview scene, taking Rock and the gas vents with
it. It has no class_name now and constructs itself by path.
Suite 114/114.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 17:38:30 +02:00
|
|
|
var taken: int = GameState.collect_gas_cargo(whole)
|
|
|
|
|
progress -= float(taken)
|
|
|
|
|
RESOURCE_PICKUP_VFX.spawn(get_tree().root,
|
|
|
|
|
to_global(vent), GameState.RESOURCE_GAS, taken)
|
2026-08-13 22:04:21 +02:00
|
|
|
return
|
|
|
|
|
progress = 0.0
|
|
|
|
|
func _draw() -> void:
|
|
|
|
|
for vent in vents:
|
2026-08-14 11:54:31 +02:00
|
|
|
_draw_gas_source(vent)
|
2026-08-14 13:44:10 +02:00
|
|
|
_draw_emission(vent)
|
2026-08-14 11:54:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _draw_gas_source(centre: Vector2) -> void:
|
|
|
|
|
var colour := Color(0.85, 0.52, 1.0)
|
|
|
|
|
var core := Color(0.15, 0.03, 0.22)
|
|
|
|
|
var bubbles: Array = [
|
|
|
|
|
[centre + Vector2(-20.0, 8.0), 20.0],
|
|
|
|
|
[centre + Vector2(18.0, 14.0), 27.0],
|
|
|
|
|
[centre + Vector2(17.0, -22.0), 15.0],
|
|
|
|
|
]
|
|
|
|
|
for bubble in bubbles:
|
|
|
|
|
var ring := PackedVector2Array()
|
|
|
|
|
for i in range(12):
|
|
|
|
|
var angle: float = TAU * float(i) / 12.0
|
|
|
|
|
ring.append(bubble[0] + Vector2(cos(angle), sin(angle)) * float(bubble[1]))
|
|
|
|
|
NeonDraw.draw_glowing_polygon(self, ring, colour, 0.9, core, 0.6)
|
2026-08-14 13:44:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _draw_emission(centre: Vector2) -> void:
|
|
|
|
|
# Small bubbles continuously rise out of every source. This remains
|
|
|
|
|
# animated even when the fleet is not collecting, so the vent reads as
|
|
|
|
|
# an active gas generator rather than a static decoration.
|
|
|
|
|
var core := Color(0.15, 0.03, 0.22)
|
|
|
|
|
for i in range(4):
|
|
|
|
|
var travel: float = fmod(emission_phase + float(i) * 0.25, 1.0)
|
|
|
|
|
var bubble_centre := centre + Vector2(
|
|
|
|
|
sin((travel + float(i)) * TAU) * 11.0,
|
|
|
|
|
-48.0 - travel * 92.0
|
|
|
|
|
)
|
|
|
|
|
var radius: float = lerpf(5.0, 14.0, travel)
|
|
|
|
|
var colour := Color(0.92, 0.68, 1.0, 1.0 - travel * 0.72)
|
|
|
|
|
var ring := PackedVector2Array()
|
|
|
|
|
for point in range(10):
|
|
|
|
|
var angle: float = TAU * float(point) / 10.0
|
|
|
|
|
ring.append(bubble_centre + Vector2(cos(angle), sin(angle)) * radius)
|
|
|
|
|
NeonDraw.draw_glowing_polygon(self, ring, colour, 0.75, core, 0.45)
|