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
|
|
@ -508,28 +508,38 @@ var buildings: Array = []
|
||||||
# leaving the ship-lab branch zigzagging between 0.82 and 0.94 with nothing
|
# leaving the ship-lab branch zigzagging between 0.82 and 0.94 with nothing
|
||||||
# beside it.
|
# beside it.
|
||||||
#
|
#
|
||||||
# 0.10 supply logistics -> freight -> freight_yards
|
# 0.08 supply logistics -> freight -> freight_yards
|
||||||
# 0.30 industry power_systems -> field_engineering -> drone_bays
|
# 0.25 industry power_systems -> field_engineering -> drone_bays
|
||||||
# 0.50 spine shipyards -> coordination -> deep_space_scanning
|
# 0.42 spine shipyards -> coordination -> deep_space_scanning
|
||||||
# 0.70 ground forward_bases -> garrison_bays
|
# 0.58 fleet berth_authority
|
||||||
# 0.90 vessels vessel_science -> logistics_command
|
# 0.75 ground forward_bases -> garrison_bays
|
||||||
#
|
# 0.92 vessels vessel_science -> logistics_command
|
||||||
# Fleet size is deliberately absent: #219 moved it out of research entirely
|
|
||||||
# and onto the Fleet Office, which is why the widest lane is now empty.
|
|
||||||
const SKILL_TREE: Array = [
|
const SKILL_TREE: Array = [
|
||||||
{
|
{
|
||||||
"id": "shipyards", "name": "Shipyards", "cost": 15, "requires": "",
|
"id": "shipyards", "name": "Shipyards", "cost": 15, "requires": "",
|
||||||
"x": 0.50, "unlocks": BUILDING_SHIP_CRAFTER,
|
"x": 0.42, "unlocks": BUILDING_SHIP_CRAFTER,
|
||||||
"desc": "Build ship crafters, and buy extra vessels at them.",
|
"desc": "Build ship crafters, and buy extra vessels at them.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# Fleet size is a researched thing again, but only the STRUCTURE is:
|
||||||
|
# the office still has to be built and supplied, which is what #219
|
||||||
|
# moved it to. Ore only, and no research points: points come solely
|
||||||
|
# from conquering a planet, and conquering one needs a fleet, so
|
||||||
|
# pricing this in them would lock the fleet at its opening hull
|
||||||
|
# behind a fight that hull has to win first.
|
||||||
|
"id": "berth_authority", "name": "Berth Authority", "cost": 20,
|
||||||
|
"requires": "shipyards",
|
||||||
|
"x": 0.58, "unlocks": BUILDING_FLEET_OFFICE,
|
||||||
|
"desc": "Build Fleet Offices. Each holds one more berth in the fleet, and has to be kept supplied or the vessel in it is lost.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "logistics", "name": "Logistics", "cost": 25, "requires": "shipyards",
|
"id": "logistics", "name": "Logistics", "cost": 25, "requires": "shipyards",
|
||||||
"x": 0.10, "unlocks": BUILDING_EXTRACTOR,
|
"x": 0.08, "unlocks": BUILDING_EXTRACTOR,
|
||||||
"desc": "Build extractors on planets. They mine ore whether or not you are nearby.",
|
"desc": "Build extractors on planets. They mine ore whether or not you are nearby.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "coordination", "name": "Coordination", "cost": 20, "requires": "shipyards",
|
"id": "coordination", "name": "Coordination", "cost": 20, "requires": "shipyards",
|
||||||
"x": 0.50, "unlocks": BUILDING_COMMAND_CENTER, "research_points": 1,
|
"x": 0.42, "unlocks": BUILDING_COMMAND_CENTER, "research_points": 1,
|
||||||
"desc": "Build command centers, where the fleet formation is arranged.",
|
"desc": "Build command centers, where the fleet formation is arranged.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -539,7 +549,7 @@ const SKILL_TREE: Array = [
|
||||||
# start being able to hurt them.
|
# start being able to hurt them.
|
||||||
"id": "forward_bases", "name": "Forward Bases", "cost": 30, "requires": "coordination",
|
"id": "forward_bases", "name": "Forward Bases", "cost": 30, "requires": "coordination",
|
||||||
"costs": {"ore": 30, "gas": 12},
|
"costs": {"ore": 30, "gas": 12},
|
||||||
"x": 0.70, "unlocks": BUILDING_OUTPOST, "research_points": 1,
|
"x": 0.75, "unlocks": BUILDING_OUTPOST, "research_points": 1,
|
||||||
"desc": "Build outposts: forward positions vessels can be stationed at, to hold ground you are not standing on.",
|
"desc": "Build outposts: forward positions vessels can be stationed at, to hold ground you are not standing on.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -548,7 +558,7 @@ const SKILL_TREE: Array = [
|
||||||
# researching it never means demolishing and rebuilding.
|
# researching it never means demolishing and rebuilding.
|
||||||
"id": "garrison_bays", "name": "Garrison Bays", "cost": 110, "requires": "forward_bases",
|
"id": "garrison_bays", "name": "Garrison Bays", "cost": 110, "requires": "forward_bases",
|
||||||
"costs": {"ore": 110, "gas": 35},
|
"costs": {"ore": 110, "gas": 35},
|
||||||
"x": 0.70, "outpost_bonus": 1, "research_points": 2,
|
"x": 0.75, "outpost_bonus": 1, "research_points": 2,
|
||||||
"icon": 40,
|
"icon": 40,
|
||||||
"desc": "Permanent: +1 berth at every outpost, including ones already built.",
|
"desc": "Permanent: +1 berth at every outpost, including ones already built.",
|
||||||
},
|
},
|
||||||
|
|
@ -559,7 +569,7 @@ const SKILL_TREE: Array = [
|
||||||
# manages what shipyards do.
|
# manages what shipyards do.
|
||||||
"id": "logistics_command", "name": "Logistics Command", "cost": 140,
|
"id": "logistics_command", "name": "Logistics Command", "cost": 140,
|
||||||
"costs": {"ore": 140, "gas": 40},
|
"costs": {"ore": 140, "gas": 40},
|
||||||
"requires": "vessel_science", "x": 0.90,
|
"requires": "vessel_science", "x": 0.92,
|
||||||
"unlocks": BUILDING_PLANNING_CENTER, "research_points": 3,
|
"unlocks": BUILDING_PLANNING_CENTER, "research_points": 3,
|
||||||
"desc": "Build a planning center: set how many of each vessel should always exist, and the crafters are kept working until they do.",
|
"desc": "Build a planning center: set how many of each vessel should always exist, and the crafters are kept working until they do.",
|
||||||
},
|
},
|
||||||
|
|
@ -569,7 +579,7 @@ const SKILL_TREE: Array = [
|
||||||
# arrive after the player has some worth looking after.
|
# arrive after the player has some worth looking after.
|
||||||
"id": "field_engineering", "name": "Field Engineering", "cost": 95,
|
"id": "field_engineering", "name": "Field Engineering", "cost": 95,
|
||||||
"costs": {"ore": 95, "gas": 35, "energy": 20},
|
"costs": {"ore": 95, "gas": 35, "energy": 20},
|
||||||
"requires": "power_systems", "x": 0.30,
|
"requires": "power_systems", "x": 0.25,
|
||||||
"unlocks": BUILDING_WORKSHOP, "research_points": 2,
|
"unlocks": BUILDING_WORKSHOP, "research_points": 2,
|
||||||
"desc": "Build spacial workshops. Their drones fly out and repair damaged structures, spending ore delivered to the workshop.",
|
"desc": "Build spacial workshops. Their drones fly out and repair damaged structures, spending ore delivered to the workshop.",
|
||||||
},
|
},
|
||||||
|
|
@ -578,40 +588,40 @@ const SKILL_TREE: Array = [
|
||||||
# that reaches workshops already standing.
|
# that reaches workshops already standing.
|
||||||
"id": "drone_bays", "name": "Drone Bays", "cost": 150,
|
"id": "drone_bays", "name": "Drone Bays", "cost": 150,
|
||||||
"costs": {"ore": 150, "gas": 50, "energy": 35},
|
"costs": {"ore": 150, "gas": 50, "energy": 35},
|
||||||
"requires": "field_engineering", "x": 0.30,
|
"requires": "field_engineering", "x": 0.25,
|
||||||
"workshop_bonus": 1, "research_points": 2, "icon": 43,
|
"workshop_bonus": 1, "research_points": 2, "icon": 43,
|
||||||
"desc": "Permanent: +1 berth at every spacial workshop, including ones already built. The drone to fill it is still yours to build.",
|
"desc": "Permanent: +1 berth at every spacial workshop, including ones already built. The drone to fill it is still yours to build.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "freight", "name": "Freight Handling", "cost": 40, "requires": "logistics",
|
"id": "freight", "name": "Freight Handling", "cost": 40, "requires": "logistics",
|
||||||
"costs": {"ore": 40, "gas": 15},
|
"costs": {"ore": 40, "gas": 15},
|
||||||
"x": 0.10, "unlocks": BUILDING_TRANSPORT_HUB, "research_points": 1,
|
"x": 0.08, "unlocks": BUILDING_TRANSPORT_HUB, "research_points": 1,
|
||||||
"desc": "Build transport hubs. Transporters are built at a ship crafter and assigned to a hub, which then runs its routes without you.",
|
"desc": "Build transport hubs. Transporters are built at a ship crafter and assigned to a hub, which then runs its routes without you.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "vessel_science", "name": "Vessel Science", "cost": 35, "requires": "shipyards",
|
"id": "vessel_science", "name": "Vessel Science", "cost": 35, "requires": "shipyards",
|
||||||
"costs": {"ore": 35, "gas": 10},
|
"costs": {"ore": 35, "gas": 10},
|
||||||
"x": 0.90, "unlocks": BUILDING_SHIP_LAB, "research_points": 1,
|
"x": 0.92, "unlocks": BUILDING_SHIP_LAB, "research_points": 1,
|
||||||
"desc": "Build ship labs, where each vessel type is upgraded and new ones unlocked.",
|
"desc": "Build ship labs, where each vessel type is upgraded and new ones unlocked.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "deep_space_scanning", "name": "Deep-Space Scanning", "cost": 50,
|
"id": "deep_space_scanning", "name": "Deep-Space Scanning", "cost": 50,
|
||||||
"costs": {"ore": 50, "gas": 15},
|
"costs": {"ore": 50, "gas": 15},
|
||||||
"requires": "coordination", "x": 0.50,
|
"requires": "coordination", "x": 0.42,
|
||||||
"unlocks": BUILDING_PLANET_SCANNER, "research_points": 1,
|
"unlocks": BUILDING_PLANET_SCANNER, "research_points": 1,
|
||||||
"desc": "Build a planet scanner and reveal the nearest world of a chosen type.",
|
"desc": "Build a planet scanner and reveal the nearest world of a chosen type.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "freight_yards", "name": "Freight Yards", "cost": 80, "requires": "freight",
|
"id": "freight_yards", "name": "Freight Yards", "cost": 80, "requires": "freight",
|
||||||
"costs": {"ore": 80, "gas": 30},
|
"costs": {"ore": 80, "gas": 30},
|
||||||
"x": 0.10, "hub_bonus": 1, "research_points": 2,
|
"x": 0.08, "hub_bonus": 1, "research_points": 2,
|
||||||
"icon": 12,
|
"icon": 12,
|
||||||
"desc": "Permanent: +1 berth at every hub, including ones already built. The transporter to fill it is still yours to build.",
|
"desc": "Permanent: +1 berth at every hub, including ones already built. The transporter to fill it is still yours to build.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "power_systems", "name": "Power Systems", "cost": 45, "requires": "freight",
|
"id": "power_systems", "name": "Power Systems", "cost": 45, "requires": "freight",
|
||||||
"costs": {"ore": 45, "gas": 35},
|
"costs": {"ore": 45, "gas": 35},
|
||||||
"x": 0.30, "unlocks": BUILDING_GAS_BURNER, "research_points": 2,
|
"x": 0.25, "unlocks": BUILDING_GAS_BURNER, "research_points": 2,
|
||||||
"desc": "Build gas burners. Each converts gas into energy at its own site - hub transporters keep it stocked and collect what it makes.",
|
"desc": "Build gas burners. Each converts gas into energy at its own site - hub transporters keep it stocked and collect what it makes.",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ extends Node2D
|
||||||
# or back to its workshop. Carries no state of its own; GameState owns the
|
# or back to its workshop. Carries no state of its own; GameState owns the
|
||||||
# simulation and RepairDroneField creates, positions and frees this to match.
|
# simulation and RepairDroneField creates, positions and frees this to match.
|
||||||
|
|
||||||
|
const VESSEL_DEFINITIONS = preload("res://vessels/VesselDefinitions.gd")
|
||||||
const HULL_COLOR: Color = Color(0.5, 0.95, 0.8)
|
const HULL_COLOR: Color = Color(0.5, 0.95, 0.8)
|
||||||
|
|
||||||
var laden: bool = false
|
var laden: bool = false
|
||||||
|
|
@ -27,10 +28,10 @@ func _draw() -> void:
|
||||||
# Small and blunt, with a tool arm out front, in the workshop's own
|
# Small and blunt, with a tool arm out front, in the workshop's own
|
||||||
# green-teal: it should read as a tender belonging to a building rather
|
# green-teal: it should read as a tender belonging to a building rather
|
||||||
# than as a fleet vessel or a hub's magenta hauler.
|
# than as a fleet vessel or a hub's magenta hauler.
|
||||||
var hull: PackedVector2Array = PackedVector2Array([
|
# From the DEFINITION, for the reason Transporter.gd records: #216 made
|
||||||
Vector2(0, -11), Vector2(8, -3), Vector2(6, 10), Vector2(-6, 10), Vector2(-8, -3),
|
# these fly out as ordinary deliveries, and a delivery draws the
|
||||||
])
|
# definition's hull. Two copies meant two shapes for one vessel.
|
||||||
NeonDraw.draw_glowing_polygon(self, hull, HULL_COLOR, 1.0)
|
NeonDraw.draw_glowing_polygon(self, _hull(), HULL_COLOR, 1.0)
|
||||||
NeonDraw.draw_glowing_line(self, Vector2(0, -11), Vector2(0, -18), HULL_COLOR, 0.9, 0.35)
|
NeonDraw.draw_glowing_line(self, Vector2(0, -11), Vector2(0, -18), HULL_COLOR, 0.9, 0.35)
|
||||||
NeonDraw.draw_glowing_line(self, Vector2(-5, -18), Vector2(5, -18), HULL_COLOR, 0.9, 0.35)
|
NeonDraw.draw_glowing_line(self, Vector2(-5, -18), Vector2(5, -18), HULL_COLOR, 0.9, 0.35)
|
||||||
if laden:
|
if laden:
|
||||||
|
|
@ -38,3 +39,8 @@ func _draw() -> void:
|
||||||
# material rather than as a light on the hull.
|
# material rather than as a light on the hull.
|
||||||
NeonDraw.draw_glowing_circle(self, Vector2(0, 3), 5.0,
|
NeonDraw.draw_glowing_circle(self, Vector2(0, 3), 5.0,
|
||||||
GameState.resource_color(GameState.RESOURCE_ORE), 1.0)
|
GameState.resource_color(GameState.RESOURCE_ORE), 1.0)
|
||||||
|
|
||||||
|
|
||||||
|
func _hull() -> PackedVector2Array:
|
||||||
|
var definition: Resource = VESSEL_DEFINITIONS.get_definition(GameState.REPAIR_DRONE)
|
||||||
|
return PackedVector2Array() if definition == null else definition.hull_points
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ extends Node2D
|
||||||
# supply route. Carries no state of its own; GameState owns the simulation
|
# supply route. Carries no state of its own; GameState owns the simulation
|
||||||
# and TransporterField creates, positions and frees this to match.
|
# and TransporterField creates, positions and frees this to match.
|
||||||
|
|
||||||
|
const VESSEL_DEFINITIONS = preload("res://vessels/VesselDefinitions.gd")
|
||||||
const HULL_COLOR: Color = Color(0.95, 0.55, 0.85)
|
const HULL_COLOR: Color = Color(0.95, 0.55, 0.85)
|
||||||
|
|
||||||
var laden: bool = false
|
var laden: bool = false
|
||||||
|
|
@ -26,13 +27,21 @@ func _draw() -> void:
|
||||||
# Squat and boxy, in the transport hub's own magenta, so it reads as
|
# Squat and boxy, in the transport hub's own magenta, so it reads as
|
||||||
# "belongs to the hub" and not as an extractor hauler (green) or a fleet
|
# "belongs to the hub" and not as an extractor hauler (green) or a fleet
|
||||||
# vessel (sharp cyan triangle).
|
# vessel (sharp cyan triangle).
|
||||||
var hull: PackedVector2Array = PackedVector2Array([
|
#
|
||||||
Vector2(0, -16), Vector2(10, -4), Vector2(10, 14), Vector2(-10, 14), Vector2(-10, -4),
|
# Taken from the DEFINITION rather than written out here. #216 made these
|
||||||
])
|
# fly out from the mothership as ordinary deliveries, and a delivery draws
|
||||||
NeonDraw.draw_glowing_polygon(self, hull, HULL_COLOR, 1.0)
|
# the definition's hull - so a second copy of the shape here meant a
|
||||||
|
# transporter changed shape the moment it was assigned. One shape, one
|
||||||
|
# place, whichever node is drawing it.
|
||||||
|
NeonDraw.draw_glowing_polygon(self, _hull(), HULL_COLOR, 1.0)
|
||||||
if laden:
|
if laden:
|
||||||
# A visible payload, so a loaded run is distinguishable from a
|
# A visible payload, so a loaded run is distinguishable from a
|
||||||
# deadhead back to the hub at a glance.
|
# deadhead back to the hub at a glance.
|
||||||
NeonDraw.draw_glowing_polygon(self, PackedVector2Array([
|
NeonDraw.draw_glowing_polygon(self, PackedVector2Array([
|
||||||
Vector2(-5, 0), Vector2(5, 0), Vector2(5, 9), Vector2(-5, 9),
|
Vector2(-5, 0), Vector2(5, 0), Vector2(5, 9), Vector2(-5, 9),
|
||||||
]), HULL_COLOR, 0.85)
|
]), HULL_COLOR, 0.85)
|
||||||
|
|
||||||
|
|
||||||
|
func _hull() -> PackedVector2Array:
|
||||||
|
var definition: Resource = VESSEL_DEFINITIONS.get_definition(GameState.VESSEL_TRANSPORTER)
|
||||||
|
return PackedVector2Array() if definition == null else definition.hull_points
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ extends SceneTree
|
||||||
# holes where they used to be - it is repacked from whatever is researched.
|
# holes where they used to be - it is repacked from whatever is researched.
|
||||||
#
|
#
|
||||||
# Verifies:
|
# Verifies:
|
||||||
# 1. with nothing researched only the mothership and the Fleet Office are
|
# 1. with nothing researched only the mothership is offered (it is
|
||||||
# offered (the mothership is
|
|
||||||
# deliberately never gated - it is where research happens)
|
# deliberately never gated - it is where research happens)
|
||||||
# 2. researching a structure adds it, and it is placed, not left at
|
# 2. researching a structure adds it, and it is placed, not left at
|
||||||
# whatever offsets it happened to have in the scene file
|
# whatever offsets it happened to have in the scene file
|
||||||
|
|
@ -80,36 +79,23 @@ func _process(delta: float) -> bool:
|
||||||
|
|
||||||
# --- 1. nothing researched ----------------------------------
|
# --- 1. nothing researched ----------------------------------
|
||||||
controller._refresh_build_status()
|
controller._refresh_build_status()
|
||||||
# #219 put the Fleet Office beside the mothership at the opening:
|
# The Fleet Office sits behind Berth Authority, so the opening is
|
||||||
# it is the only way the fleet grows now, so gating it behind
|
# the mothership alone again - the fallback that is always there.
|
||||||
# research would gate fleet size behind research again - which is
|
|
||||||
# the thing that ticket removed.
|
|
||||||
var opening: Array = [GameState.BUILDING_MOTHERSHIP,
|
|
||||||
GameState.BUILDING_FLEET_OFFICE]
|
|
||||||
var shown: Array = _shown()
|
var shown: Array = _shown()
|
||||||
var shown_ids: Array = []
|
if shown.size() != 1 or shown[0][0] != GameState.BUILDING_MOTHERSHIP:
|
||||||
for e in shown:
|
var names: Array = []
|
||||||
shown_ids.append(e[0])
|
for e in shown:
|
||||||
shown_ids.sort()
|
names.append(e[0])
|
||||||
opening.sort()
|
print("TEST_BUILD_MENU_HIDES_LOCKED: FAIL (unresearched structures on offer: %s)" % [names])
|
||||||
if shown_ids != opening:
|
|
||||||
print("TEST_BUILD_MENU_HIDES_LOCKED: FAIL (opening offer was %s, expected %s)" \
|
|
||||||
% [shown_ids, opening])
|
|
||||||
quit(1)
|
quit(1)
|
||||||
return true
|
return true
|
||||||
# --- 4. and the row is centred as a whole -------------------
|
# --- 4. and it is centred, being alone on its row -----------
|
||||||
# Two entries now, so "centred" is the pair straddling the middle
|
var only: Array = _slots()[0]
|
||||||
# rather than one sitting on it. The rule being checked is the
|
if absf(only[1]) > 0.01:
|
||||||
# same one: a short row is not left hanging off to one side.
|
print("TEST_BUILD_MENU_HIDES_LOCKED: FAIL (the only entry sits at x=%.1f instead of centred)" % only[1])
|
||||||
var slots: Array = _slots()
|
|
||||||
var spread: float = 0.0
|
|
||||||
for slot in slots:
|
|
||||||
spread += float(slot[1])
|
|
||||||
if absf(spread) > 0.01:
|
|
||||||
print("TEST_BUILD_MENU_HIDES_LOCKED: FAIL (the opening row is off-centre by %.1f)" % spread)
|
|
||||||
quit(1)
|
quit(1)
|
||||||
return true
|
return true
|
||||||
print("nothing researched -> the mothership and a Fleet Office, centred")
|
print("nothing researched -> only the mothership, centred")
|
||||||
|
|
||||||
# --- 2. research three more ---------------------------------
|
# --- 2. research three more ---------------------------------
|
||||||
game_state.unlocked = ["shipyards", "logistics", "coordination"]
|
game_state.unlocked = ["shipyards", "logistics", "coordination"]
|
||||||
|
|
@ -117,11 +103,9 @@ func _process(delta: float) -> bool:
|
||||||
stage = 1
|
stage = 1
|
||||||
return false
|
return false
|
||||||
1:
|
1:
|
||||||
# Three doctrines add three structures to the two the opening
|
|
||||||
# already offers (#219's Fleet Office is one of those two).
|
|
||||||
var shown2: Array = _shown()
|
var shown2: Array = _shown()
|
||||||
if shown2.size() != 5:
|
if shown2.size() != 4:
|
||||||
print("TEST_BUILD_MENU_HIDES_LOCKED: FAIL (researched 3, expected 5 entries, got %d)" % shown2.size())
|
print("TEST_BUILD_MENU_HIDES_LOCKED: FAIL (researched 3, expected 4 entries, got %d)" % shown2.size())
|
||||||
quit(1)
|
quit(1)
|
||||||
return true
|
return true
|
||||||
for e in shown2:
|
for e in shown2:
|
||||||
|
|
|
||||||
|
|
@ -62,16 +62,38 @@ func _process(delta: float) -> bool:
|
||||||
if game_state.max_fleet_size() != 1:
|
if game_state.max_fleet_size() != 1:
|
||||||
return _fail("an unbuilt fleet caps at %d, expected 1" % game_state.max_fleet_size())
|
return _fail("an unbuilt fleet caps at %d, expected 1" % game_state.max_fleet_size())
|
||||||
|
|
||||||
# The whole tree, researched, must not add a single berth: #219
|
# --- the gate on the office ----------------------------------
|
||||||
# moved fleet size out of research entirely.
|
# Fleet Offices are researched (Berth Authority), but the research
|
||||||
|
# only unlocks the STRUCTURE - it grants no capacity by itself.
|
||||||
|
if game_state.is_building_unlocked(GameState.BUILDING_FLEET_OFFICE):
|
||||||
|
return _fail("Fleet Offices are buildable with nothing researched")
|
||||||
|
var gate: Dictionary = game_state.skill_node("berth_authority")
|
||||||
|
if gate.is_empty():
|
||||||
|
return _fail("no skill node unlocks the Fleet Office")
|
||||||
|
# Ore only, deliberately: research points come solely from
|
||||||
|
# conquering a planet, and conquering one needs a fleet. Pricing
|
||||||
|
# the fleet's own gate in them would lock the player at their
|
||||||
|
# opening hull behind a fight that hull has to win first.
|
||||||
|
if int(gate.get("research_points", 0)) != 0:
|
||||||
|
return _fail("Berth Authority costs %d research points - unreachable with one vessel" \
|
||||||
|
% int(gate.get("research_points", 0)))
|
||||||
|
for cost_resource in game_state.skill_costs("berth_authority"):
|
||||||
|
if String(cost_resource) != GameState.RESOURCE_ORE:
|
||||||
|
return _fail("Berth Authority asks for %s, which needs a built economy first" \
|
||||||
|
% cost_resource)
|
||||||
|
|
||||||
|
# The whole tree, researched, must still not add a single berth:
|
||||||
|
# #219 moved fleet SIZE out of research and onto the structure.
|
||||||
for node in GameState.SKILL_TREE:
|
for node in GameState.SKILL_TREE:
|
||||||
if int(node.get("fleet_bonus", 0)) != 0:
|
if int(node.get("fleet_bonus", 0)) != 0:
|
||||||
return _fail("skill node '%s' still grants fleet capacity" % node.id)
|
return _fail("skill node '%s' still grants fleet capacity" % node.id)
|
||||||
game_state.unlocked.append(String(node.id))
|
game_state.unlocked.append(String(node.id))
|
||||||
|
if not game_state.is_building_unlocked(GameState.BUILDING_FLEET_OFFICE):
|
||||||
|
return _fail("researching Berth Authority did not unlock the Fleet Office")
|
||||||
if game_state.max_fleet_size() != 1:
|
if game_state.max_fleet_size() != 1:
|
||||||
return _fail("researching the entire tree raised the fleet cap to %d" \
|
return _fail("researching the entire tree raised the fleet cap to %d" \
|
||||||
% game_state.max_fleet_size())
|
% game_state.max_fleet_size())
|
||||||
print("a new game: 1 vessel, 1 berth, and no research anywhere raises it")
|
print("a new game: 1 vessel, 1 berth; research unlocks the office, not the berth")
|
||||||
|
|
||||||
# --- B. offices are the berths -------------------------------
|
# --- B. offices are the berths -------------------------------
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
|
|
||||||
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)
|
||||||
|
|
@ -15,6 +15,6 @@ support_craftable = true
|
||||||
build_time = 11.0
|
build_time = 11.0
|
||||||
icon = 43
|
icon = 43
|
||||||
glow_color = Color(0.5, 0.95, 0.8, 1)
|
glow_color = Color(0.5, 0.95, 0.8, 1)
|
||||||
hull_points = PackedVector2Array(0, -14, 9, -4, 7, 10, -7, 10, -9, -4)
|
hull_points = PackedVector2Array(0, -11, 8, -3, 6, 10, -6, 10, -8, -3)
|
||||||
base_stats = {"max_speed": 620.0, "acceleration": 1800.0, "transport_speed": 190.0, "repair_amount": 25.0, "delivery_speed": 180.0}
|
base_stats = {"max_speed": 620.0, "acceleration": 1800.0, "transport_speed": 190.0, "repair_amount": 25.0, "delivery_speed": 180.0}
|
||||||
upgrades = Array[Resource]([ExtResource("2"), ExtResource("3")])
|
upgrades = Array[Resource]([ExtResource("2"), ExtResource("3")])
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ build_time = 9.0
|
||||||
support_craftable = true
|
support_craftable = true
|
||||||
icon = 12
|
icon = 12
|
||||||
glow_color = Color(0.95, 0.55, 0.85, 1)
|
glow_color = Color(0.95, 0.55, 0.85, 1)
|
||||||
|
hull_points = PackedVector2Array(0, -16, 10, -4, 10, 14, -10, 14, -10, -4)
|
||||||
capabilities = PackedStringArray("cargo", "transport")
|
capabilities = PackedStringArray("cargo", "transport")
|
||||||
component_scenes = Array[PackedScene]([ExtResource("2"), ExtResource("3")])
|
component_scenes = Array[PackedScene]([ExtResource("2"), ExtResource("3")])
|
||||||
base_stats = {"max_speed": 690.0, "acceleration": 2025.0, "cargo_capacity": 20.0, "fuel_capacity": 6.0, "fuel_boost": 1.0, "transport_speed": 120.0, "delivery_speed": 180.0}
|
base_stats = {"max_speed": 690.0, "acceleration": 2025.0, "cargo_capacity": 20.0, "fuel_capacity": 6.0, "fuel_boost": 1.0, "transport_speed": 120.0, "delivery_speed": 180.0}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue