Atrium Key
Based on game build 714014 | Last updated: 2026-03-07
Overview
The atrium_key prefab is a unique item that enables map reveal functionality for the Atrium area. When held (or placed in the inventory of the grand owner), it stops its associated icon's map revealing and hides it from the map; when dropped or lost by the owner, it resumes map revealing. It uses a secondary atrium_key_icon entity to render the map icon and integrates with the maprevealable, inventoryitem, and container components to track ownership and manage map state.
Usage example
-- Example: Attaching the atrium_key to a player and checking its reveal behavior
local key = SpawnPrefab("atrium_key")
player.components.inventory:GiveItem(key)
-- The key now stops revealing the map (icon hidden)
-- If dropped:
key.components.inventoryitem:Drop()
-- The key resumes map revealing (icon appears)
Dependencies & tags
Components used: inventoryitem, inspectable, tradable, maprevealable, container (via event callbacks)
Tags: Adds irreplaceable, nonpotatable, and CLASSIFIED (to icon entity only)
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
_owner | Entity or nil | nil | The grand owner of the key (after GetGrandOwner resolution). Used to reparent the icon entity. |
_container | Entity or nil | nil | The container (e.g., inventory) the key is stored in. Used to listen for inventory-related events. |
icon | Entity | Created via SpawnPrefab("atrium_key_icon") | Icon entity responsible for map rendering and reveal functionality. |
Main functions
storeincontainer(inst, container)
- Description: Registers event callbacks on the container to track when the key is put in, dropped from, or removed from it, and stores a reference to the container.
- Parameters:
container(Entity?) — the container entity, must have acontainercomponent.
- Returns: Nothing.
- Error states: No-op if
containerisnilor lacks thecontainercomponent.
unstore(inst)
- Description: Removes all event listeners previously added by
storeincontainerand clears the_containerreference. - Parameters: None.
- Returns: Nothing.
topocket(inst, owner)
- Description: Switches the key to "pocketed" state — stops map revealing, reparents the icon to the grand owner's entity, and sets the map restriction to
"nightmaretracker". Ensures the key’sicon.entityfollows the player when held. - Parameters:
owner(Entity) — the new owner or container entity. If it hasinventoryitem, its grand owner is used.
- Returns: Nothing.
toground(inst)
- Description: Switches the key to "dropped" state — resumes map revealing, resets map restriction, and reparents the icon back to the key entity itself.
- Parameters: None.
- Returns: Nothing.
OnRemoveEntity(inst)
- Description: Cleans up the icon entity when the key is removed from the world.
- Parameters: None.
- Returns: Nothing.
Events & listeners
- Listens to:
"onputininventory"(onicon) → triggerstopocket(inst, ...)"ondropped"(onicon) → triggerstoground(inst)"onputininventory"(on container) → triggersinst._oncontainerownerchanged"ondropped"(on container) → triggersinst._oncontainerownerchanged"onremove"(on container) → triggersinst._oncontainerremoved
- Pushes: None.