Skip to content
ASArcaneMP Scripting APIScripting reference
Global objectServer APIGenerated

Sanctuary

const Sanctuary: object

Defined in: server/api.d.ts:5596

Room of Requirement instances. A room is a layout under an id the script chooses, and nobody owns one: a script says where each player’s castle door leads (their destination), takes players into any room with enter, and grants edit rights room by room. Players in the same room see each other and its editors’ changes live. The server holds rooms only while it runs: save Sanctuary.get(id) from sanctuaryChanged, and Sanctuary.load it back.

addBeast(id, vivarium, beast): Beast | null

Puts a beast into a room’s vivarium, as if an editor released it there. Null when the room is not loaded, or the vivarium already holds 12 beasts or 4 other species. Throws on an unknown species, a color it does not have, a bad gender or a name over 64 bytes.

string

"Forest" | "Swamp" | "Coastal" | "Grassland"

Omit<SanctuaryBeast, "id" | "vivarium">

Its vivarium is the argument’s; its id is the room’s to give.

Beast | null

beasts(id, vivarium?): Beast[]

The beasts living in a loaded room’s vivariums. Players in the room see them, and their game counts them as its own vivarium beasts. Destroying one, or a catch, takes it out of the room.

string

"Forest" | "Swamp" | "Coastal" | "Grassland"

Only this vivarium’s.

Beast[]

destination(player): string | null

The room the castle door or fast travel takes the player into.

Player

string | null

door(): "open" | "closed" | "proximity"

The castle door’s mode.

"open" | "closed" | "proximity"

doorAccess(player): boolean

Whether the castle door opens for the player: allowed, with a loaded destination.

Player

boolean

editors(id): Player[]

Players allowed to edit the room. Not part of the layout.

string

Player[]

enter(player, id): boolean

Takes the player into a room now, behind the game’s own loading screen: from Overland, or from inside another room, swapped in place. Their destination stays as it was. False when no room is loaded under that id.

Player

string

boolean

get(id): SanctuaryLayout | null

A room’s saved form, ready to store; null when no room is loaded under that id.

string

SanctuaryLayout | null

ids(): string[]

Every loaded room’s id.

string[]

inside(player): string | null

The room the player is standing in.

Player

string | null

load(id, layout): boolean

Creates or replaces a room. Players heading for it are restaged; players inside see the difference applied, and a change to its locks or lighting reloads them into it behind the loading screen.

string

SanctuaryLayout

boolean

nativeEntry(): boolean

Whether the castle door lets players in itself; false by default.

boolean

nativeStations(types?): boolean

Whether every one of the kinds offers the game’s own F prompt and menu; true by default.

("planter" | "potionStation" | "loom")[]

Only these kinds; every kind when left out.

boolean

occupants(id): Player[]

Players standing in a room.

string

Player[]

revision(id): number | null

Bumped on every load and accepted edit; the number sanctuaryChanged carries.

string

number | null

setDestination(player, id): void

The room the castle door or fast travel takes the player into; null leads nowhere. A room not loaded yet is staged once it loads, and the door stays shut until then, so set it before the room is read back from storage.

Player

string | null

void

setDoor(mode): void

The castle door for everyone. proximity (the default): it reveals while any player stands at it, and every player watching sees the reveal. open: always revealed. closed: never revealed, so nobody walks in.

"open" | "closed" | "proximity"

void

setDoorAccess(player, allowed): void

Whether the castle door may open for the player; true unless a script says otherwise. It only ever opens toward a loaded destination. A player without access still reveals the door and sees it, but it stays shut for them. A script’s own door should ask doorAccess too.

Player

boolean

void

setEditor(id, player, allowed): void

Whether the player may edit the room; their changes reach everyone inside. Held for the player’s connection, and kept across the room’s loads and unloads.

string

Player

boolean

void

setNativeEntry(enabled): void

Whether the castle door lets players in itself; false by default. Off, it still reveals, but no player can walk in or gets the game’s prompt: a script shows its own prompt (the client’s Sanctuary.door) and calls enter. On, the game’s walk-in works for players with door access.

boolean

void

setNativeStations(enabled, types?): void

Whether the room’s stations offer the game’s own F prompt and menu; on by default. Off, no player gets them in any room, so a script can run its own herbology, brewing or gear upgrades there: it shows its own prompt (the client’s Sanctuary.objects gives each one’s type and position). The game’s interaction is gone too, so the client’s objectInteracted does not fire on them. Plots and benches from Herbology.place and Brewing.place keep theirs.

boolean

("planter" | "potionStation" | "loom")[]

Only these kinds; every kind when left out.

void

unload(id): boolean

Drops a room that is nobody’s destination and that nobody is in or entering.

string

boolean