Stock a Fleet Office for its own berth, and stop there

#223: an office declared a flat buffer - 60 ore, 30 gas, 30 energy - whatever
was in its berth, so one keeping an interceptor had transporters haul it gas
and energy it can never spend, and the figure bore no relation to what it was
actually charged. Since #220 that charge depends on the berth's occupant and
on how far down the fleet the berth sits, neither of which a definition can
state.

It asks for what its own berth costs, four charges deep: enough that the tax
is payable whenever the bank has anything - a transporter round trip fits
inside four intervals - and no more, so an office is not a hoard. Same idiom
outposts and workshops already use for world-dependent demand.

A small floor stays in the definition on purpose: an empty berth asks for
nothing dynamic, so without it a newly crewed berth would start from zero and
could starve before its first delivery landed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
Loïc Wisniewski 2026-09-06 10:44:30 +02:00
commit fe3ae97f94
3 changed files with 138 additions and 3 deletions

View file

@ -786,6 +786,12 @@ const FLEET_OFFICE_UPKEEP_DIVISOR: int = 8
# seven and a half. A steeper rate reaches "unaffordable" while the player is
# still learning what the fleet is for.
const FLEET_UPKEEP_GROWTH: float = 1.12
# #223: how many charges an office is kept stocked for. Enough that the tax
# is always payable while the bank has anything - a transporter round trip is
# well inside four charge intervals - and no more, so an office does not sit
# on resources the rest of the base needs. Below this it can starve with ore
# in the bank; far above it, offices become a hoard.
const FLEET_OFFICE_STOCK_CHARGES: int = 4
# Offices in the order they were built, which is the order they are matched to
@ -868,6 +874,28 @@ func fleet_upkeep_breakdown() -> Dictionary:
# The vessel an office is answerable for, or "" when the fleet is smaller than
# the berths built for it - an office with nothing in it costs nothing.
# What this office should hold of one resource: enough charges of whatever is
# in its berth to keep paying while a transporter is on its way, and nothing
# it will never spend. An office keeping an interceptor asks for no gas at
# all, where a flat buffer had it hauling gas it could not use.
#
# An empty berth asks for nothing beyond the small floor its definition
# declares - which is what keeps a newly crewed berth payable before its
# first delivery arrives.
func fleet_office_stock_target(id: int, resource_type: String) -> int:
var offices: Array = fleet_offices()
for i in range(offices.size()):
if int(offices[i].get("id", 0)) != id:
continue
var slot_index: int = i + BASE_FLEET_SIZE
var vessel_type: String = fleet_office_vessel(slot_index)
if vessel_type == "":
return 0
var upkeep: Dictionary = fleet_office_upkeep(vessel_type, slot_index)
return int(upkeep.get(resource_type, 0)) * FLEET_OFFICE_STOCK_CHARGES
return 0
func fleet_office_vessel(slot_index: int) -> String:
if slot_index < 0 or slot_index >= fleet_vessel_types.size():
return ""
@ -2842,6 +2870,10 @@ func building_logistics_deficit(id: int, resource_type: String) -> int:
# take, which likewise depends on the world rather than on a definition.
if resource_type == RESOURCE_ORE:
target = maxi(target, workshop_ore_demand(id))
# #223: a Fleet Office asks for what the vessel in ITS berth is charged,
# which no definition can state - the berth's occupant decides it, and
# since #220 so does how far down the fleet that berth sits.
target = maxi(target, fleet_office_stock_target(id, resource_type))
return maxi(0, target - building_resource(id, resource_type))