Scanner
A Scanner is the destructible component that provides radar and scan capabilities to a Ship or Station. Like Shield generator, the scanner datatype declares no own properties — its capabilities are exposed at the parent Controllable level.
Inheritance: component → destructible → scanner. Extends destructible directly, not object.
Properties
Section titled “Properties”There are no scanner-specific properties (scriptproperties.xml:1160). Use:
- Inherited from
destructible:.hull,.hullpercentage,.parent
Parent-side accessors (where scanner state actually lives)
Section titled “Parent-side accessors (where scanner state actually lives)”| Parent property (on Controllable) | Description |
|---|---|
.hasscanner | Has scanner software installed |
.longrange | Has long-range scanner software |
.maxscanlevel | Highest scan level (1-3 in vanilla) |
.software.longrange | Currently installed long-range scanner ware |
Reading Ship.maxscanlevel is the canonical “what can this ship scan” query — used heavily by vanilla scenarios for secrecy mechanics.
Common patterns
Section titled “Common patterns””Is this ship scanner-capable enough to read a module’s secrets?”
Section titled “”Is this ship scanner-capable enough to read a module’s secrets?””Pattern from vanilla scenario_tutorials.xml:10568, 10601:
<do_if value="$module.revealedpercentage gt 0 and $module.revealedpercentage lt 100 and $module.secrecylevel gt player.ship.maxscanlevel"> <!-- player needs better scanner to fully reveal --></do_if>The .secrecylevel on the target module is the “lock level”; .maxscanlevel on the scanning ship is the “key level”. Player needs ≥ secrecy to fully reveal.
”Does the player have long-range scanner installed?”
Section titled “”Does the player have long-range scanner installed?””<do_if value="player.ship.longrange"> <!-- long-range scan available --></do_if>Pattern from x4ep1_mentor_subscription.xml:1812, modes.xml:34 (negated for error gating).
”Find scanners on a specific ship”
Section titled “”Find scanners on a specific ship””<find_object_component name="$Scanners" multiple="true" object="$Ship" class="class.scanner"/>Use this only when you need to read scanner-component damage state. For “can this ship scan”, read the parent’s .hasscanner / .maxscanlevel directly.
Events
Section titled “Events”No event_scanner_X family. Standard component events:
| Event | When | Notes |
|---|---|---|
event_object_destroyed | Scanner destroyed | Filter on class.scanner. Parent’s .hasscanner becomes false |
event_object_attacked | Scanner attacked | Standard |
Common gotchas
Section titled “Common gotchas”- ⚠ Scanner declares NO datatype properties. Same pattern as Shield generator — all capability state on the parent.
- ⚠
scannerextendsdestructible, NOTobject. No.sectordirectly. - ⚠
maxscanlevelis the MAX, not current. A ship in combat may have its effective scan level reduced by damage;maxscanlevelreports the equipped maximum. - ⚠ Long-range vs short-range are distinct softwares.
Ship.longrangeis true only with the long-range scanner ware installed; standard scanner sets.hasscannerbut not.longrange. - ⚠ NPC ships have scanners too, with their own
maxscanlevel. Don’t assume only the player needs to be scanner-checked.
Architectural context
Section titled “Architectural context”- Secrecy / reveal mechanic: Architectural overview Scan mechanic — how
.secrecylevelon targets gates information disclosure based on scanner.maxscanlevel. - Long-range scan usage: Architectural overview Long-range mode — UI mode that depends on
.longrangeware.
Related
Section titled “Related”- Ship — host;
.hasscanner,.maxscanlevel,.longrangelive here. - Station — also hosts scanners.
- Controllable — the parent type that aggregates scanner accessors.
- Shield generator — sibling empty-datatype destructible.
- Engine / Weapon — sibling destructible components (these DO have datatype properties).
- Ware —
ware.software_scanner*,ware.software_longrange*are the equip-able items.