Defence module
A Defence module is a station Module that hosts Turrets and shield generators. Stations with defence modules can fight back; stations without them are exposed to attack. Defence stations are typically composed mostly of these.
Inheritance: component → destructible → module → defencemodule. The datatype declares no own properties — it’s a class label rather than a property bag. All meaningful state (turrets, shields) comes through the contained weapon components.
Properties
Section titled “Properties”Defence module declares no properties of its own in scriptproperties.xml:1097. Use:
- Inherited from
module:.numdocks.{docksize},.haswalkableroom - Inherited from
destructible:.hull,.hullpercentage - Component search for installed turrets:
find_object_component class="class.turret"against the defence module
Common patterns
Section titled “Common patterns””Filter defence modules when building”
Section titled “”Filter defence modules when building””<do_if value="$macro.isclass.defencemodule"> <!-- defence module --></do_if>Pattern from vanilla finalisestations.xml:949. Vanilla uses this in the station finalisation pipeline to count defence components.
”Find all defence modules on a station"
Section titled “”Find all defence modules on a station"”<do_for_each name="$mod" in="$Station.modules"> <do_if value="$mod.isclass.defencemodule"> <!-- one defence module --> </do_if></do_for_each>"Find all turrets attached to a defence module”
Section titled “"Find all turrets attached to a defence module””<find_object_component name="$Turrets" multiple="true" object="$DefenceModule" class="class.turret"/>Common gotchas
Section titled “Common gotchas”- ⚠ Defence module declares NO datatype properties. It’s a class label. All combat state is on the contained turrets / shield generators.
- ⚠
.canbeattackablelives on the parent station. Don’t expect a defence-module-level “is this active” flag. - ⚠ Multiple defence modules stack additively. Vanilla
finalisestations.xml:949counts each as contributing to overall defence rating. - ⚠ Defence modules + a Defence station are separate concepts. A defence station is mostly composed of defence modules. Production stations can have one or two defence modules too — they’re not exclusive to defence stations.
Related
Section titled “Related”- Module — parent abstraction.
- Defence station — station subtype mostly made of these.
- Weapon / Turret — what defence modules host.
- Shield generator — sibling combat component, also installed on defence modules.