Skip to content

Pier

A Pier is a station Module that provides docking slots for capital ships (Ship class L and XL). Stations without piers can host only S/M ships at their built-in dockingbays; piers are how shipyards / trade stations / wharfs accommodate fleet visits.

Inheritance: component → destructible → module → pier. The datatype adds one accessor.

PropertyTypeDescription
.numpierdocksintNumber of capital-ship dock locations on this pier
PropertySourceDescription
.numdocks.{docksize}moduleGeneric per-size dock counts (parallel mechanism)
.haswalkableroommoduleWalkable interior
.hulldestructibleDamage state

”Count total pier dock locations on a station”

Section titled “”Count total pier dock locations on a station””

Pattern from vanilla finalisestations.xml:759-792:

<set_value name="$Total" exact="0"/>
<do_for_each name="$mod" in="$Station.modules">
<do_if value="$mod.isclass.pier">
<set_value name="$Total"
operation="add"
exact="$mod.numpierdocks"/>
</do_if>
</do_for_each>
<write_to_logbook
text="$Station.knownname + ' has '
+ $Total + ' pier dock slots'"/>

Vanilla finalisestations.xml aggregates numpierdocks across all pier modules during station finalisation to know the total trade-location count.

”Filter buildable docking modules (pier OR dock area)”

Section titled “”Filter buildable docking modules (pier OR dock area)””
<do_if value="$macro.isclass.dockarea
or $macro.isclass.pier">
<!-- a docking-providing module -->
</do_if>

Pattern from vanilla x4ep1_mentor_subscription.xml:9162.

  • numpierdocks is the per-module count, not station total. Sum across all piers to get station capacity.
  • Pier docks are for capital ships (L/XL). S/M ships use built-in dockingbays or Dockarea modules. Don’t confuse the two.
  • A station with zero piers cannot host capitals. Capital ships will fail to dock; player will see “no suitable dock” error. Always check before sending capitals.
  • Pier dock counts are static per macro. Modders adding new pier macros set numpierdocks in the macro XML; it doesn’t change at runtime.
  • Vanilla also has .numdocks.{docksize} on module. This parallel mechanism counts docks by size category. For pier-specific logic prefer numpierdocks; for generic per-size counts use .numdocks.{docksize}.
  • Module — parent abstraction.
  • Station — host; aggregates pier counts during finalisation.
  • Dockarea — sibling, for S/M ship docking.
  • Ship — capital ships need piers to dock.
  • Build module — has its own dock mechanism for construction vessels.