#102/#103 (#97d/#97e): the outpost, and the garrison you compose for it

Landed together because an outpost you cannot crew is decoration, and a
garrison menu with no building to hang it off is nothing at all.

#102, the building. Researched at "Forward Bases", two prerequisites deep
and cheaper than any mid-game structure - the ticket asks for early, and the
answer to waves attacking your buildings should arrive at about the time the
waves can hurt them. It is drawn as a watch mast on a tripod with two open
berths, deliberately the least machinery of any structure here: it makes
nothing and refines nothing, it holds a position. 120hp, more than a
crafter, because being shot at is its job.

#103, the garrison. Two separate things live on its record, and conflating
them was the first thing to get wrong: the ORDER, what the player asked for,
and the CREW, who is actually there. This menu edits the order only; #104
fills the crew. Keeping the order as a wish is what lets an outpost ask for
a hull nobody has built yet and wait for it, rather than the request
evaporating - and it is why the panel shows "here / ordered" instead of one
number.

"Only ships that attack can be assigned" is expressed as capabilities rather
than a list of types, so a new armed vessel is eligible the day it is added
and an unarmed one never is by accident. Today that means the interceptor
and the laser vessel; a shield, a hauler and an engine block cannot hold a
position however much one might want them to.

Two berths by default, and Garrison Bays raises it at outposts ALREADY
standing - the same shape as freight_yards for hubs, because a bonus that
only reached new buildings would mean demolishing and rebuilding to collect
it.

The panel builds its own rows from the catalog rather than from nodes placed
in the scene, so adding an armed vessel later needs no scene surgery.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-23 14:02:20 +02:00
commit 3c632276af
12 changed files with 909 additions and 1 deletions

View file

@ -156,6 +156,16 @@ var lab_building_id: int = 0
get_node("../UI/LabMenu/Bar"),
]
# #103: the outpost's own panel. garrison_building_id is remembered for the
# same reason craft_building_id is - _process() clears current_building while
# a menu is open, so by the next frame the panel would not know which outpost
# it belongs to and every button in it would bail out at its `== 0` guard.
@onready var garrison_menu: Control = get_node("../UI/GarrisonMenu")
@onready var garrison_panel: Control = get_node("../UI/GarrisonMenu/Panel")
@onready var garrison_status: Label = get_node("../UI/GarrisonMenu/StatusLabel")
@onready var garrison_close_button: IconButton = get_node("../UI/GarrisonMenu/CloseButton")
var garrison_building_id: int = 0
@onready var skill_menu: Control = get_node("../UI/SkillMenu")
@onready var skill_tree: Control = get_node("../UI/SkillMenu/Tree")
@onready var skill_detail: Label = get_node("../UI/SkillMenu/DetailLabel")
@ -251,6 +261,8 @@ func _ready() -> void:
_layout_hangar()
build_button.pressed.connect(_on_build_pressed)
build_close_button.pressed.connect(_close_build_menu)
garrison_close_button.pressed.connect(_close_garrison_menu)
garrison_panel.changed.connect(_refresh_garrison)
_configure_build_menu_entries()
lab_close_button.pressed.connect(func(): lab_menu.visible = false)
lab_buy_button.pressed.connect(_on_lab_buy)
@ -586,6 +598,11 @@ func _on_action_pressed() -> void:
elif action == "formation":
formation_menu.visible = true
formation_editor.queue_redraw()
elif action == "garrison":
garrison_building_id = current_building.building_id
garrison_panel.building_id = garrison_building_id
garrison_menu.visible = true
_refresh_garrison()
func _on_build_pressed() -> void:
@ -691,6 +708,29 @@ func _close_build_menu() -> void:
build_menu.visible = false
# --- the outpost's garrison panel (#103) -----------------------------------
func _close_garrison_menu() -> void:
garrison_menu.visible = false
garrison_building_id = 0
func _refresh_garrison() -> void:
if garrison_building_id == 0:
return
garrison_panel.building_id = garrison_building_id
garrison_panel.refresh()
var ordered: int = GameState.garrison_desired_total(garrison_building_id)
var crewed: int = GameState.garrison_crew(garrison_building_id).size()
if ordered == 0:
garrison_status.text = "No vessels ordered. Only armed vessels can hold a position."
elif crewed >= ordered:
garrison_status.text = "Garrison at full strength"
else:
garrison_status.text = "%d of %d berths crewed - vessels are sent from the mothership as they become available" \
% [crewed, ordered]
func cost_of(type: String) -> int:
var definition: Resource = BUILDING_DEFINITIONS.get_definition(type)
return int(definition.cost) if definition != null else 0