Research the Fleet Office, and give it one hull
Fleet Offices sit behind a new Berth Authority doctrine. It costs ore and no research points, deliberately: points come only from conquering a planet, conquering needs a fleet, and the fleet caps at its opening hull until an office exists - so pricing the fleet's own gate in them would lock a player behind a fight that one vessel has to win first. The research unlocks the STRUCTURE; capacity is still the built, supplied thing #219 made it. The tree gains a sixth lane for it, so the branch that fleet size vacated is occupied again rather than reading as a hole. Also fixes a shape #216 exposed: a stationed transporter drew a hull written into its own script while a delivered one drew the definition's, and the transporter's definition declared none at all - so one in flight was an empty polygon. Both vessels now draw the definition, and a test pins that the two paths agree. The repair drone had the same fault, off by two units. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
parent
11773a63cf
commit
cc71811d89
8 changed files with 161 additions and 64 deletions
65
tests/test_logistics_hull_identity.gd
Normal file
65
tests/test_logistics_hull_identity.gd
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
extends SceneTree
|
||||
|
||||
# A logistics vessel is ONE vessel, so it looks the same wherever it is drawn.
|
||||
#
|
||||
# #216 made transporters and repair drones fly out from the mothership as
|
||||
# ordinary vessel deliveries. A delivery draws the hull off the vessel
|
||||
# DEFINITION; the stationed nodes each drew a copy written into their own
|
||||
# script. The copies had drifted - the transporter's definition declared no
|
||||
# hull at all, so one in flight was an empty polygon, and the drone's two
|
||||
# shapes differed by a couple of units - which is why a transporter changed
|
||||
# shape the moment it was assigned.
|
||||
#
|
||||
# Covers:
|
||||
# A. every vessel that can be delivered declares a hull to be drawn by
|
||||
# B. the stationed node draws that same hull, not a second copy
|
||||
# C. and the colours agree, so it does not change livery either
|
||||
|
||||
const DELIVERABLE: Array = ["transporter", "repair_drone"]
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
var definitions: Script = load("res://vessels/VesselDefinitions.gd")
|
||||
var nodes: Dictionary = {
|
||||
"transporter": load("res://logistics/Transporter.gd"),
|
||||
"repair_drone": load("res://logistics/RepairDrone.gd"),
|
||||
}
|
||||
|
||||
for vessel_type in DELIVERABLE:
|
||||
var definition: Resource = definitions.get_definition(vessel_type)
|
||||
if definition == null:
|
||||
return _fail("no definition for '%s'" % vessel_type)
|
||||
|
||||
# --- A. there is a hull at all -------------------------------
|
||||
# An empty one is not a small bug: VesselDelivery draws exactly this,
|
||||
# so a vessel with no hull is invisible for the whole flight.
|
||||
if definition.hull_points.is_empty():
|
||||
return _fail("'%s' declares no hull, so it is invisible in flight" % vessel_type)
|
||||
|
||||
# --- B. and the stationed node draws that one ----------------
|
||||
var node: Node2D = nodes[vessel_type].new()
|
||||
root.add_child(node)
|
||||
var drawn: PackedVector2Array = node._hull()
|
||||
node.free()
|
||||
if drawn != definition.hull_points:
|
||||
return _fail("'%s' is drawn as %s at its post and %s in flight" \
|
||||
% [vessel_type, drawn, definition.hull_points])
|
||||
|
||||
# --- C. same livery too ---------------------------------------
|
||||
var node_colour: Color = nodes[vessel_type].HULL_COLOR
|
||||
var definition_colour: Color = definition.glow_color
|
||||
if not is_equal_approx(node_colour.r, definition_colour.r) \
|
||||
or not is_equal_approx(node_colour.g, definition_colour.g) \
|
||||
or not is_equal_approx(node_colour.b, definition_colour.b):
|
||||
return _fail("'%s' is %s at its post and %s in flight" \
|
||||
% [vessel_type, node_colour, definition_colour])
|
||||
print("%s: one hull of %d points, one colour, both places" \
|
||||
% [vessel_type, definition.hull_points.size()])
|
||||
|
||||
print("TEST_LOGISTICS_HULL_IDENTITY: PASS")
|
||||
quit(0)
|
||||
|
||||
|
||||
func _fail(message: String) -> void:
|
||||
print("TEST_LOGISTICS_HULL_IDENTITY: FAIL (%s)" % message)
|
||||
quit(1)
|
||||
Loading…
Reference in a new issue