2026-08-14 22:12:57 +02:00
|
|
|
class_name VesselDefinitions
|
|
|
|
|
extends RefCounted
|
|
|
|
|
|
#116: the Spacial Workshop, and the drones that mend what waves break
Modelled on the transport hub, deliberately and closely: drones belong to a
workshop rather than to the player, are provisioned when it is built, are
never a production order, and are upgraded at a ship lab like any other
vessel. Anything that already knows how hub transporters behave knows how
these do, and Drone Bays raises the count at workshops already standing -
the same shape as Freight Yards and Garrison Bays.
What a repair COSTS is the one new idea. It is a share of the building's own
price, in proportion to how much of its health is gone: levelling a crafter
and rebuilding it costs its full price, and patching one up after a wave
costs a fraction, the fraction being the damage. The ore is spent when a
drone LEAVES, so two drones cannot be sent to the same wall and spend twice
for one load of repair, and a building demolished in transit sends its load
home rather than swallowing it.
"Required resources are sent to the spacial workshop": the workshop asks hub
logistics for the ore its outstanding repairs will need, exactly as a gas
burner asks for gas, because building_logistics_deficit now takes the larger
of the definition's static buffer and what the world actually demands. There
is a ceiling on that, so one badly-mauled base cannot pull the whole bank
into a single workshop and starve everything else.
Worst first: the structure closest to coming down is the one a repair is
worth most on.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-23 21:59:51 +02:00
|
|
|
const ORDER: PackedStringArray = ["interceptor", "shield", "gas_bomber", "transporter", "carrier", "laser", "distorder", "repair_drone"]
|
2026-08-14 22:12:57 +02:00
|
|
|
const DEFINITIONS: Dictionary = {
|
#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
|
|
|
"interceptor": preload("res://vessels/InterceptorVesselDefinition.tres"),
|
|
|
|
|
"shield": preload("res://vessels/ShieldVesselDefinition.tres"),
|
|
|
|
|
"gas_bomber": preload("res://vessels/GasBomberVesselDefinition.tres"),
|
|
|
|
|
"transporter": preload("res://vessels/TransporterVesselDefinition.tres"),
|
|
|
|
|
"carrier": preload("res://vessels/CarrierVesselDefinition.tres"),
|
|
|
|
|
"laser": preload("res://vessels/LaserVesselDefinition.tres"),
|
|
|
|
|
"distorder": preload("res://vessels/DistorderVesselDefinition.tres"),
|
#116: the Spacial Workshop, and the drones that mend what waves break
Modelled on the transport hub, deliberately and closely: drones belong to a
workshop rather than to the player, are provisioned when it is built, are
never a production order, and are upgraded at a ship lab like any other
vessel. Anything that already knows how hub transporters behave knows how
these do, and Drone Bays raises the count at workshops already standing -
the same shape as Freight Yards and Garrison Bays.
What a repair COSTS is the one new idea. It is a share of the building's own
price, in proportion to how much of its health is gone: levelling a crafter
and rebuilding it costs its full price, and patching one up after a wave
costs a fraction, the fraction being the damage. The ore is spent when a
drone LEAVES, so two drones cannot be sent to the same wall and spend twice
for one load of repair, and a building demolished in transit sends its load
home rather than swallowing it.
"Required resources are sent to the spacial workshop": the workshop asks hub
logistics for the ore its outstanding repairs will need, exactly as a gas
burner asks for gas, because building_logistics_deficit now takes the larger
of the definition's static buffer and what the world actually demands. There
is a ceiling on that, so one badly-mauled base cannot pull the whole bank
into a single workshop and starve everything else.
Worst first: the structure closest to coming down is the one a repair is
worth most on.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-23 21:59:51 +02:00
|
|
|
"repair_drone": preload("res://vessels/RepairDroneVesselDefinition.tres"),
|
2026-08-14 22:12:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static func get_definition(definition_id: String) -> Resource:
|
|
|
|
|
return DEFINITIONS.get(definition_id)
|
|
|
|
|
|
|
|
|
|
static func all() -> Array:
|
|
|
|
|
var result: Array = []
|
|
|
|
|
for definition_id in ORDER:
|
|
|
|
|
result.append(DEFINITIONS[definition_id])
|
|
|
|
|
return result
|
|
|
|
|
|
2026-08-15 00:09:10 +02:00
|
|
|
|
|
|
|
|
static func fleet() -> Array:
|
|
|
|
|
var result: Array = []
|
|
|
|
|
for definition in all():
|
|
|
|
|
if definition.fleet_eligible:
|
|
|
|
|
result.append(definition)
|
|
|
|
|
return result
|
|
|
|
|
|
Build the logistics crews, and let them burn energy
#216: transport hubs and spacial workshops no longer conjure their crews.
Transporters and repair drones are ordered at a ship crafter, assigned per
building through a new Station menu, flown out from the mothership hangar,
and spent by the work they do - 20 runs, 12 repairs, counted where the run
ENDS so nothing retires with cargo in the air or a building half repaired.
A spent vessel is gone, so the structure is short again and the player has
to build another. The menu shows what each one has left, worst first.
Craftability needed its own flag: "the crafter can make it" and "it can take
a berth in the fleet" stopped being the same question.
#217: transporters crawl at 120 rather than 150, and a Burn Drive lets them
carry energy and spend it to travel far faster. Fetching it is a leg of its
own, to the nearest store that has any - so a refuelling transporter cannot
be dispatched mid-errand - and the leg flown to COLLECT fuel is not charged
for it. Unresearched, nothing detours and nothing changes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
2026-09-05 19:09:35 +02:00
|
|
|
# Everything a ship crafter can be asked for: the fleet hulls, plus #216's
|
|
|
|
|
# support craft. Ordered fleet-first so the craft menu's own rows do not move
|
|
|
|
|
# when a support vessel is added.
|
|
|
|
|
static func craftable() -> Array:
|
|
|
|
|
var result: Array = fleet()
|
|
|
|
|
for definition in all():
|
|
|
|
|
if definition.support_craftable and not definition.fleet_eligible:
|
|
|
|
|
result.append(definition)
|
|
|
|
|
return result
|
|
|
|
|
|
2026-08-14 22:12:57 +02:00
|
|
|
static func with_capability(capability: String) -> Resource:
|
|
|
|
|
for definition in all():
|
|
|
|
|
if definition.has_capability(capability):
|
|
|
|
|
return definition
|
|
|
|
|
return null
|