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
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
|
|
# Forgejo #79: a small "+N" with the resource's own mark, rising and fading
|
|
|
|
|
# where the fleet picked something up.
|
|
|
|
|
#
|
|
|
|
|
# Collecting used to be entirely silent - a rock vanished and a number in the
|
|
|
|
|
# corner of the screen changed. Which number, and by how much, was left for
|
|
|
|
|
# the player to notice on their own. This says it at the point it happened,
|
|
|
|
|
# in the resource's own colour, and gets out of the way.
|
|
|
|
|
#
|
|
|
|
|
# Built from the SAME glyph scene the resource tables and transfer rows use
|
|
|
|
|
# (ResourceDefinition.glyph_scene), so a new material added to the catalog
|
|
|
|
|
# gets a correct pickup mark with no work here - and can never end up with
|
|
|
|
|
# one mark in the HUD and a different one in the world.
|
|
|
|
|
|
#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_DEFINITIONS = preload("res://resources/ResourceDefinitions.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
|
|
|
# Deliberately NO class_name, and the constructor below loads this file by
|
|
|
|
|
# path rather than naming the class. A global class-name identifier - even a
|
|
|
|
|
# script's own, inside its own static function - needs the class cache already
|
|
|
|
|
# warm, and it is not when this is reached indirectly through a preview scene
|
|
|
|
|
# loading Main.tscn. That failed to compile outright, taking Rock and the gas
|
|
|
|
|
# vents down with it. Callers preload the path too; see Rock.gd.
|
#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 SELF_PATH: String = "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
|
|
|
|
|
|
|
|
const RISE_DISTANCE: float = 46.0
|
|
|
|
|
const DURATION: float = 0.85
|
|
|
|
|
const GLYPH_SIZE: float = 22.0
|
|
|
|
|
const DIGIT_HEIGHT: float = 20.0
|
|
|
|
|
# Held fully opaque for the first part of its life, so the eye has time to
|
|
|
|
|
# catch it before it starts going.
|
|
|
|
|
const FADE_START: float = 0.45
|
|
|
|
|
|
|
|
|
|
var age: float = 0.0
|
|
|
|
|
var colour: Color = Color.WHITE
|
|
|
|
|
var start_y: float = 0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func spawn(parent: Node, world_position: Vector2, resource_type: String,
|
|
|
|
|
amount: int) -> void:
|
|
|
|
|
if amount <= 0:
|
|
|
|
|
return
|
|
|
|
|
var vfx: Node2D = (load(SELF_PATH) as GDScript).new()
|
|
|
|
|
vfx.position = world_position
|
|
|
|
|
vfx.build(resource_type, amount)
|
|
|
|
|
parent.add_child(vfx)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func build(resource_type: String, amount: int) -> void:
|
|
|
|
|
var definition: Resource = RESOURCE_DEFINITIONS.get_definition(resource_type)
|
|
|
|
|
colour = definition.color if definition != null else Color.WHITE
|
|
|
|
|
|
|
|
|
|
if definition != null and definition.glyph_scene != null:
|
|
|
|
|
var glyph: Control = definition.glyph_scene.instantiate()
|
|
|
|
|
glyph.colour = definition.color
|
|
|
|
|
# Anchors first. The glyph scenes are authored as full-rect Controls
|
|
|
|
|
# for the panels that host them, and Godot recomputes the size of any
|
|
|
|
|
# Control with non-equal opposite anchors right after _ready() - so
|
|
|
|
|
# assigning size without this is overwritten, with a warning, the
|
|
|
|
|
# moment it enters the tree.
|
|
|
|
|
glyph.set_anchors_preset(Control.PRESET_TOP_LEFT)
|
|
|
|
|
glyph.size = Vector2(GLYPH_SIZE, GLYPH_SIZE)
|
|
|
|
|
glyph.position = Vector2(-2.0, -GLYPH_SIZE * 0.5)
|
|
|
|
|
add_child(glyph)
|
|
|
|
|
|
|
|
|
|
# show_icon off: the resource's own glyph is already beside it, and
|
|
|
|
|
# NeonNumber's built-in mark is the ore hexagon whatever the amount is.
|
|
|
|
|
var number := NeonNumber.new()
|
|
|
|
|
number.show_icon = false
|
|
|
|
|
number.amount = amount
|
|
|
|
|
number.digit_height = DIGIT_HEIGHT
|
|
|
|
|
number.glow_color = colour
|
|
|
|
|
number.core_color = colour.darkened(0.8)
|
|
|
|
|
number.size = Vector2(60.0, DIGIT_HEIGHT)
|
|
|
|
|
number.position = Vector2(GLYPH_SIZE + 4.0, -DIGIT_HEIGHT * 0.5)
|
|
|
|
|
add_child(number)
|
|
|
|
|
|
|
|
|
|
start_y = position.y
|
|
|
|
|
z_index = 40
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
|
age += delta
|
|
|
|
|
var t: float = age / DURATION
|
|
|
|
|
if t >= 1.0:
|
|
|
|
|
queue_free()
|
|
|
|
|
return
|
|
|
|
|
# Eases out: quick off the mark, drifting by the end.
|
|
|
|
|
position.y = start_y - RISE_DISTANCE * (1.0 - pow(1.0 - t, 2.0))
|
|
|
|
|
modulate.a = 1.0 if t < FADE_START else 1.0 - (t - FADE_START) / (1.0 - FADE_START)
|
|
|
|
|
queue_redraw()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _draw() -> void:
|
|
|
|
|
# The plus sign, drawn here rather than as a third child - it is two
|
|
|
|
|
# strokes and giving it its own node would cost more than it saves.
|
|
|
|
|
var centre := Vector2(-12.0, 0.0)
|
|
|
|
|
var arm: float = 5.0
|
|
|
|
|
NeonDraw.draw_glowing_line(self, centre - Vector2(arm, 0.0), centre + Vector2(arm, 0.0),
|
|
|
|
|
colour, 1.0, 0.5, colour.darkened(0.8))
|
|
|
|
|
NeonDraw.draw_glowing_line(self, centre - Vector2(0.0, arm), centre + Vector2(0.0, arm),
|
|
|
|
|
colour, 1.0, 0.5, colour.darkened(0.8))
|