Skip to content

Container

A Container is the X4 engine abstract class for entities that hold cargo, build other entities, and trade. Almost every station in the game is a container — it inherits container’s massive property set for managing cargo, build infrastructure, products/resources, and prices.

Inheritance: object → controllable → defensible → container. Subclasses include all station types and some special ship variants.

The container class has ~110 properties. Below is the most-used subset grouped by purpose.

PropertyTypeDescription
.hasmasstrafficbooleanContainer is in the zone’s mass-traffic network
.istrafficlevel.<level>booleanContainer at traffic level (normal/heavy/gridlock)
.dockingenabledbooleanIs docking at the container enabled?
.dockingallowed.{$ship}booleanCan $ship dock at container (faction/relation check)?
PropertyTypeDescription
.hasunitdrone.{$ship}booleanContainer has $ship as drone unit

The build property group manages station construction + ship manufacturing.

PropertyTypeDescription
.buildingmodulebuildmoduleBuild module constructing this container
.buildingprocessorbuildprocessorBuild processor doing the work
.buildbuildBuild task constructing this object
.builds.queuedlistQueued build tasks
.builds.inprogresslistBuild tasks in progress
.builds.todeletelistBuild tasks queued for deletion
.buildanchorcomponentBuild anchor (reference point)
.canabortbuild.{$build}booleanCan $build currently be aborted?
.hasplannedconstructionbooleanAre there plans to expand this container?
.plannedconstruction.sequenceconstructionsequencePlanned construction sequence
.plannedconstruction.boundingbox.*vector / booleanPlanned construction’s bounding box

Build equipment (what container can build)

Section titled “Build equipment (what container can build)”
PropertyTypeDescription
.buildequipment.wareswarelistAll equipment wares container can build (default + included - excluded)
.buildequipment.absolutewarelistAbsolute equipment list (overrides default)
.buildequipment.excludedwarelistEquipment excluded from default
.buildequipment.includedwarelistEquipment included beyond default
.buildequipment.<type>warelistEquipment of specific type
.buildships.wareswarelistAll ship wares container can build
.buildships.absolutewarelistAbsolute ship list
.buildships.excludedwarelistShips excluded from default
.buildships.includedwarelistShips included beyond default
.canbuildclass.{$class}booleanHas build module for class?
.canequipclass.{$class}booleanHas build module for equipping class?
.cansupplyclass.{$class}booleanHas build module for supplying class?
.canbuildequipment.{$ware}booleanCan build specified equipment?
.canbuildmacro.{$macro}booleanCan build specified macro?
.canbuildshipsbooleanCan build ships (= isshipyard or iswharf)
.canequipshipsbooleanCan equip ships (= isequipmentdock)
.cansupplyshipsbooleanCan supply ships (= issupplyship)
PropertyTypeDescription
.buildresources.{$build}wareamountlistTotal resources for $build (or remaining if in-progress)
.buildresources.{$ship}wareamountlistTotal resources for $ship
.neededbuildresources.{$build}wareamountlistMissing resources for $build
.neededbuildresources.{$ship}wareamountlistMissing resources for $ship
.missingloadoutequipment.{$loadout}.{$faction}warelistLoadout equipment $faction prevents this container from constructing
PropertyTypeDescription
.cargocontainercargolistCurrent cargo
.cargo.{$ware}.targetintegerTarget amount for traded commodity
.productswarelistAll produced wares
.products.{$ware}.intermediateboolean$ware is intermediate
.originalproductwareContainer’s original product
.resourceswarelistAll consumed/produced resource wares
.resources.purewarelistNon-intermediate resources
.resources.intermediatewarelistIntermediate resources
.resources.primarywarelistPrimary resources
.resources.secondarywarelistSecondary resources
.resources.{$ware}.primary / .secondary / .intermediatebooleanResource categorization
.supplyresourceswarelistResources for supplying units + ammo (NOT production)
.tradewareswarelistBought/sold wares (neither product nor resource)
.researchwarelistResearch wares currently being worked on
PropertyTypeDescription
.buypricestableCurrent buy prices for all relevant wares
.sellpricestableCurrent sell prices for all relevant wares
.buildbuypricestableBuy prices accounting for build price factor
<set_value name="$cargolist" exact="$station.cargo.list"/>
<do_for_each name="$ware" in="$cargolist">
<write_to_logbook text="$ware.{1}.name + ': ' + $ware.{2}"/>
</do_for_each>
<do_if value="$shipyard.canbuildmacro.{macro.ship_arg_l_destroyer_02_a_macro}">
<create_ship macro="macro.ship_arg_l_destroyer_02_a_macro" ... />
</do_if>
<do_for_each name="$want" in="$shipyard.neededbuildresources.{$build}">
<write_to_logbook text="$want.{1}.name + ' needs ' + $want.{2}"/>
</do_for_each>

"Check station’s current price for a ware”

Section titled “"Check station’s current price for a ware””
<set_value name="$price" exact="$station.buyprices.{ware.advancedcomposites}"/>
  • .cargo and .cargo.list look the same but are different types.cargo is containercargolist, .cargo.list returns the list-of-tuples. Use .cargo.list for iteration.
  • .buildequipment.wares is the COMPUTED set (default + included - excluded). Don’t try to back-compute it; use specific category property if you need transparency.
  • .products includes intermediates unless you filter via .products.{$ware}.intermediate. Check before trading.
  • Build prices differ from buy prices — use .buildbuyprices when calculating construction costs, not .buyprices.
  • .canbuildships is a shortcut for “isshipyard OR iswharf”. Don’t double-check both.
  • .cargo.{$ware}.target is the target, not the current — current amount is in .cargo.list.
object
└── controllable
└── defensible
└── container ← this class
├── station (most stations)
├── headquarters (player HQ — a special container)
├── tradestation (trade station variant)
└── various station subtypes
ActionPurpose
<add_inventory>Add a ware to container cargo
<remove_inventory>Remove a ware from cargo
<set_equipment_wares_absolute>Set absolute equipment-build list
<set_equipment_wares_excluded>Add to excluded list
<set_equipment_wares_included>Add to included list
<set_ship_wares_absolute>Set absolute ship-build list
<add_build_to_expand_station>Add a build to expand the station
<set_cargo_target>Set target for cargo trade

Container is the largest property class in the X4 engine. Stations are containers, build infrastructure is on containers, prices live on containers. When in doubt about a station’s behavior, container’s property list is the first stop.