Nav context
A Nav context is a runtime-spawned interior — a group of rooms attached to a Station or Ship, typically created by a mission cue to host story-specific NPCs (the Manager’s Office, a kidnapper’s hideout, a mad scientist’s lab). Unlike normal station rooms (defined in macros and present from game start), nav contexts come and go with mission cues.
The vanilla “dynamic interior” UI / gmc_dynamic.xml framework is the canonical user of this datatype.
Inheritance: component → destructible → navcontext. Extends destructible directly, not object.
Properties
Section titled “Properties”Navcontext-specific
Section titled “Navcontext-specific”| Property | Type | Description |
|---|---|---|
.ispersistent | bool | Persistent — interior exists even in low attentions (player far away) |
.isprivate | bool | Private — NPC slots only findable by directly querying contained rooms |
.rooms | list | All Rooms inside this nav context |
Inherited
Section titled “Inherited”| Property | Source | Description |
|---|---|---|
.hull / .hullpercentage | destructible | Damage state — usually invincible in vanilla |
.parent | component | Containing station / ship |
Where nav contexts come from
Section titled “Where nav contexts come from”Nav contexts are spawned via dedicated engine actions (not standard <create_object>). The vanilla gmc_dynamic.xml framework picks a station with .canhavedynamicinterior=true, then attaches an interior:
<find_station name="$SelectedStation" space="$StationSpace" owner="$StationOwner" canhavedynamicinterior="true" tradestation="true"/>Pattern from gmc_madscientist.xml:278-287. The canhavedynamicinterior= filter on find_station is a dedicated attribute — use it to find suitable hosts before spawning your interior.
Container relationship
Section titled “Container relationship”The canhavedynamicinterior accessor lives on the Controllable (and inherited by station, ship). It tells you which objects can host a dynamic interior — typically those with a window connection (even for interiors without windows):
<do_if value="$InteriorObject.canhavedynamicinterior"> <!-- can attach a nav context here --></do_if>Pattern from gmc_dynamic.xml:1387, 1465.
Cleanup events
Section titled “Cleanup events”When a mission ends, vanilla destroys the dynamic interior via event_object_destroyed with method="killmethod.removed":
<event_object_destroyed object="$managersoffice.dynamicinterior" method="killmethod.removed"/>Pattern from diplomacy.xml:1450. The killmethod.removed distinguishes “interior was cleanly cleaned up” from “interior was destroyed in combat” (combat destruction rare).
Accessing the nav context
Section titled “Accessing the nav context”From a contained room
Section titled “From a contained room”$Room.dynamicinteriorReturns the nav context the room is part of (null if normal room).
From an entity
Section titled “From an entity”<do_if value="$Intro_Agent.hascontext.{$managersoffice.dynamicinterior}"> <!-- agent is inside this dynamic interior --></do_if>Pattern from diplomacy.xml:1454.
From cinematic camera matching
Section titled “From cinematic camera matching”<match_parent class="class.navcontext"/>Pattern from cinematiccamera.xml:1207. Used by cinematic-camera cues to detect when the framed subject is inside any nav context.
Common patterns
Section titled “Common patterns””Find rooms suitable for crate placement, dynamic-interior-aware”
Section titled “”Find rooms suitable for crate placement, dynamic-interior-aware””Vanilla gm_bringitems.xml:220 comment documents the type of objects accepted:
room / walkablemodule / defensible / dynamicinterior component in which to find a crate slot
Nav contexts are treated as containers for crate slots / NPC slots / mission-actor placement.
”Spawn a manager’s office on a trade station”
Section titled “”Spawn a manager’s office on a trade station””<find_station name="$Host" space="$Sector" owner="faction.argon" tradestation="true" canhavedynamicinterior="true"/>
<do_if value="@$Host"> <!-- ... mission-specific create_dynamic_interior call ... --></do_if>The actual create-interior action is engine-side (<create_dynamic_interior>-style); modders typically piggyback on gmc_dynamic.xml rather than rolling their own.
Events
Section titled “Events”| Event | When | Notes |
|---|---|---|
event_object_destroyed | Nav context destroyed | Use method="killmethod.removed" for clean-up; standard destruction is rare |
There is no event_navcontext_X family. Standard destructible events apply.
Common gotchas
Section titled “Common gotchas”- ⚠ Nav context extends
destructible, NOTobject. No.sectordirectly — read.parent.sector. - ⚠
canhavedynamicinterioris on the HOST controllable, not on the nav context. Filterfind_stationwith the attribute; the nav context itself doesn’t expose it. - ⚠ Private nav contexts hide their NPC slots from
find_npc_slotsqueries.isprivate=truemakes contained slots invisible to global finds. You must directly query the contained rooms. - ⚠ Persistence affects attention. A non-persistent interior may vanish when the player is far away (engine offload). For story-critical hosts, set
.ispersistent=trueat create time. - ⚠ Vanilla
gmc_dynamic.xmlis the canonical user. If your mod adds dynamic interior content, studygmc_dynamic,gmc_madscientist,diplomacy.xml(Manager’s Office) for patterns. Don’t roll your own framework — too many engine integration points. - ⚠ Crate slots in nav contexts work the same as in normal rooms.
find_crate_slotaccepts nav contexts as theobjectparameter. See Crate. - ⚠
killmethod.removedis the cleanup convention. When destroying a nav context to end a mission, use this killmethod — vanilla event handlers distinguish it from combat-destroy.
Examples
Section titled “Examples”Example 1: Detect when an NPC is inside a specific dynamic interior
Section titled “Example 1: Detect when an NPC is inside a specific dynamic interior”<do_if value="@$MissionActor and $MissionActor.hascontext.{$MyDynamicInterior}"> <write_to_logbook text="'Mission actor inside dynamic interior'"/></do_if>Pattern from diplomacy.xml:1454.
Example 2: Find a trade-station host for a new interior
Section titled “Example 2: Find a trade-station host for a new interior”<find_station name="$Host" space="player.galaxy" owner="faction.argon" tradestation="true" canhavedynamicinterior="true" multiple="false"/>
<do_if value="@$Host"> <write_to_logbook text="'Dynamic interior host: ' + $Host.knownname"/></do_if>Pattern from gmc_madscientist.xml:281-287.
Example 3: Clean up a mission interior
Section titled “Example 3: Clean up a mission interior”<event_object_destroyed object="$MyInterior" method="killmethod.removed"/>Note: this is the event declaration (in <conditions>), not an action — used to listen for the cleanup. To actually trigger the cleanup, signal the engine via the appropriate mission-cue path.
Architectural context
Section titled “Architectural context”- Dynamic interior framework: Architectural overview Dynamic interiors —
gmc_dynamic.xml, attachment lifecycle, persistence vs attention, manager’s office model. - Mission-actor placement: Architectural overview Mission actors — how NPCs are placed inside nav contexts.
- Crate / NPC slot lookup: Architectural overview Slot lookup —
find_crate_slotandfind_npc_slotaccept nav contexts as parents.
Related
Section titled “Related”- Room — contained rooms;
Room.dynamicinterioraccessor. - Station — common host (via
canhavedynamicinterior). - Ship — can also host (rare).
- NPC — populates nav contexts.
- Crate — uses nav contexts as crate-slot parents.