World
constWorld:object
Defined in: server/api.d.ts:4575
Server-authoritative world state: the global state bag, the clock, the calendar, the season, the weather, holiday decor, the Headmaster’s office, the Great Hall’s meals and banners, the Defence Against the Dark Arts dueling table, and the Hogwarts Express.
Type Declaration
Section titled “Type Declaration”commonRoomEntrances
Section titled “commonRoomEntrances”
readonlycommonRoomEntrances:object
Each house’s common-room entrance as setCommonRoomEntrance holds it on every client: “open”, “closed”, or “game” (the default: the entrance opens for its own house).
commonRoomEntrances.Gryffindor
Section titled “commonRoomEntrances.Gryffindor”Gryffindor:
"game"|"open"|"closed"
commonRoomEntrances.Hufflepuff
Section titled “commonRoomEntrances.Hufflepuff”Hufflepuff:
"game"|"open"|"closed"
commonRoomEntrances.Ravenclaw
Section titled “commonRoomEntrances.Ravenclaw”Ravenclaw:
"game"|"open"|"closed"
commonRoomEntrances.Slytherin
Section titled “commonRoomEntrances.Slytherin”Slytherin:
"game"|"open"|"closed"
readonlyday:number
Day of the month.
readonlydecor:"game"|"none"|"halloween"|"christmas"
Holiday decor pinned on every client: “halloween”, “christmas”, “none”, or “game” (the default: left to story missions).
duelingTable
Section titled “duelingTable”
readonlyduelingTable:"game"|"long"|"short"
The dueling table raised in the Defence Against the Dark Arts classroom on every client: “long”, “short”, or “game” (the default: the classroom’s desks, left to the story).
encounterPolicy
Section titled “encounterPolicy”
readonlyencounterPolicy:"suppressed"|"server"
Who spawns the Overland’s enemy camps: “suppressed” (nobody; the default) or “server” (replicated NPCs).
greatHallBanners
Section titled “greatHallBanners”
readonlygreatHallBanners:"Gryffindor"|"Hufflepuff"|"Ravenclaw"|"Slytherin"|"none"|"game"
The house whose banners hang at the head of the Great Hall on every client, “none”, or “game” (the default: left to the story, which never hangs one).
headmasterOffice
Section titled “headmasterOffice”
readonlyheadmasterOffice:"game"|"open"|"closed"
The Headmaster’s office staircase pinned on every client: “open”, “closed”, or “game” (the default: left to the story quest).
hogwartsExpress
Section titled “hogwartsExpress”
readonlyhogwartsExpress:HogwartsExpress
The Hogwarts Express. The game’s own timetable is off on every client, so it runs only when a script moves it; see HogwartsExpress.
readonlyhour:number
Hour of day (0-23).
lootPolicy
Section titled “lootPolicy”
readonlylootPolicy:object
Who spawns the Overland’s moonstone deposits and foragables (see setLootPolicy). “native” (each client’s own; the default), “suppressed” (nobody) or “server” (LootSpots).
lootPolicy.foragables
Section titled “lootPolicy.foragables”foragables:
"native"|"suppressed"|"server"
lootPolicy.moonstones
Section titled “lootPolicy.moonstones”moonstones:
"native"|"suppressed"|"server"
readonlymeal:"game"|"none"|"prep"|"breakfast"|"lunch"|"dinner"|"dessert"
The meal laid on the Great Hall’s and the Kitchens’ tables on every client, or “game” (the default: the game clock’s schedule).
minute
Section titled “minute”
readonlyminute:number
Minute of the hour (0-59).
readonlymonth:number
Month of the year (1-12).
playerCollision
Section titled “playerCollision”
readonlyplayerCollision:boolean
Whether players block each other’s movement on every client (see setPlayerCollision).
revision
Section titled “revision”
readonlyrevision:number
Monotonic server revision advanced whenever authoritative world state changes.
season
Section titled “season”
readonlyseason:0|1|2|3
0 spring, 1 summer, 2 autumn, 3 winter.
second
Section titled “second”
readonlysecond:number
Second of the minute (0-59).
readonlyspawn: {position: {x:number;y:number;z:number; };yaw:number; } |null
Where a connecting player’s world load stands them when no player.setSpawn applies, and where a respawn with no position lands. Null (the default) leaves it to the game’s own start, the house dormitory.
readonlystate:StateBag|null
Global replicated key/value state, shared by every resource and visible to every client. The server writes it; clients read it. Null before networking is up. See StateBag.
stateId
Section titled “stateId”
readonlystateId:number
Network id of the entity carrying World.state, for filtering the global entityStateChange bus. 0 before it exists.
timeScale
Section titled “timeScale”
readonlytimeScale:number
In-game minutes advanced per real second.
weather
Section titled “weather”
readonlyweather:string
Replicated weather template name.
readonlyyear:number
Calendar year, or 0 when the game keeps its native year.
getPlayerCount()
Section titled “getPlayerCount()”getPlayerCount():
number
Returns the number of connected players (cheaper than PlayerManager.getAll().length).
Returns
Section titled “Returns”number
The connected player count.
setCommonRoomEntrance()
Section titled “setCommonRoomEntrance()”setCommonRoomEntrance(
house,state):boolean
Holds a house’s common-room entrance open or closed on every client, with its own animation, sound and collision: the Gryffindor portrait, the Hufflepuff barrel, the Ravenclaw eagle door or the Slytherin wall. A loaded entrance follows at once, wherever the players are, and one that streams in later comes in that way. While it is held, player.commonRooms does not open it. Back on “game”, it opens for whoever its trigger admits, a player already standing in it included, and otherwise closes.
Parameters
Section titled “Parameters”"Gryffindor" | "Hufflepuff" | "Ravenclaw" | "Slytherin"
The house whose entrance to hold, in any case.
"game" | "open" | "closed"
“open” opens the entrance and holds it open; “closed” closes it and keeps it shut, the house’s own members and professors included; “game” hands it back to its own trigger.
Returns
Section titled “Returns”boolean
False for an unknown house or state, or an unavailable server.
setDate()
Section titled “setDate()”setDate(
day,month,year?):boolean
Sets the replicated calendar date.
Parameters
Section titled “Parameters”number
Valid day for the selected month (February allows 29).
number
Month of year.
number
Calendar year. Omit (or 0) to keep the game’s own, ~1891.
Returns
Section titled “Returns”boolean
False for an invalid range or unavailable server.
setDecor()
Section titled “setDecor()”setDecor(
decor):boolean
Sets the holiday decor every client shows, re-applied whenever a client’s world loads or a mission changes it. Releasing to “game” leaves the decor as it was until a mission changes it. The winter season’s own garlands are not holiday decor and follow World.setSeason.
Parameters
Section titled “Parameters”"none" | "game" | "halloween" | "christmas"
“halloween” or “christmas” shows that holiday’s castle and Hogsmeade decorations; “none” keeps both off; “game” stops pinning and leaves them to story missions.
Returns
Section titled “Returns”boolean
False for any other value or an unavailable server.
setDuelingTable()
Section titled “setDuelingTable()”setDuelingTable(
table):boolean
Sets the Defence Against the Dark Arts classroom’s dueling table on every client, re-applied whenever a client’s world loads or the classroom streams in. A client with the classroom loaded plays the change, as the class’s cutscene does: the desks slide aside to the walls and the table rises out of the floor, in about 4 s, and “game” plays it backwards. A client whose classroom loads later finds it in place.
Parameters
Section titled “Parameters”"long" | "short" | "game"
“long” raises the full dueling table of the first Defence Against the Dark Arts class and pushes the desks aside; “short” raises its short table the same way; “game” puts the table away and the desks back.
Returns
Section titled “Returns”boolean
False for any other value or an unavailable server.
setEncounterPolicy()
Section titled “setEncounterPolicy()”setEncounterPolicy(
policy):boolean
Sets who spawns the Overland’s enemy camps, for every client. No client spawns an enemy of its own under either policy: the game’s quest fights, dungeon waves and other world events are off. Under “server” a camp spawns when a player comes within its native trigger radius, despawns once nobody is near, and its dead return after Camps.respawnSeconds; world events roll as players approach their spots (WorldEvents). Leaving “server” removes every camp and world-event NPC.
Parameters
Section titled “Parameters”policy
Section titled “policy”"suppressed" | "server"
“suppressed” keeps the game’s enemy spawners off on every client; “server” keeps them off and spawns the camps and roaming world events as replicated NPCs.
Returns
Section titled “Returns”boolean
False for any other value or an unavailable server.
setGreatHallBanners()
Section titled “setGreatHallBanners()”setGreatHallBanners(
banners):boolean
Sets the one-house banners at the head of the Great Hall on every client. A change unfurls the new house’s banners in place with the game’s own reveal, and is re-applied whenever a client’s world loads or a mission changes it. Releasing to “game” leaves the banners as they were until a mission changes them. The game removes the banners for good once a save has completed the story mission FGB_01.
Parameters
Section titled “Parameters”banners
Section titled “banners”"none" | "Gryffindor" | "Hufflepuff" | "Ravenclaw" | "Slytherin" | "game"
A house name, in any case, hangs that house’s banners; “none” takes them down; “game” stops pinning and leaves them to the story.
Returns
Section titled “Returns”boolean
False for any other value or an unavailable server.
setHeadmasterOffice()
Section titled “setHeadmasterOffice()”setHeadmasterOffice(
office):boolean
Sets the Headmaster’s office staircase on every client, re-applied whenever a client’s world loads or a quest changes it. A staircase that is already loaded follows at once: “open” raises it, “closed” plays the raise backwards, folding the stairs away before the gargoyle sinks, and closes the stairwell off again. Releasing to “game” leaves it as it was until the quest changes it.
Parameters
Section titled “Parameters”office
Section titled “office”"game" | "open" | "closed"
“open” raises the gargoyle staircase to the Headmaster’s office; “closed” keeps it down; “game” stops pinning and leaves it to the story quest.
Returns
Section titled “Returns”boolean
False for any other value or an unavailable server.
setLootPolicy()
Section titled “setLootPolicy()”setLootPolicy(
policy):boolean
Sets who spawns the Overland’s moonstone deposits and foragables, for every client. Under “server” the game’s own spots (LootSpots) are shared lootables: a take empties a spot until its kind’s respawn time has passed, and it is adopted into the taker’s inventory as Lootables are. Native spawns are removed from areas that load after the change, so set it at startup. Leaving “server” removes every spot.
Parameters
Section titled “Parameters”policy
Section titled “policy”“native” leaves the family to each client’s game, where every player has their own copy of each spawn; “suppressed” removes it; “server” removes it and spawns the game’s own spots as server lootables. Families left out keep their setting.
foragables?
Section titled “foragables?”"native" | "suppressed" | "server"
moonstones?
Section titled “moonstones?”"native" | "suppressed" | "server"
Returns
Section titled “Returns”boolean
False for a non-object, any other value or an unavailable server; nothing changes then.
setMeal()
Section titled “setMeal()”setMeal(
meal):boolean
Sets the meal laid on the Great Hall’s and the Kitchens’ tables on every client. It holds through the schedule’s mealtimes and is re-applied whenever either room streams in or a story conversation lays its own lunch. Releasing to “game” lays the schedule’s meal for the current time at once.
Parameters
Section titled “Parameters”"none" | "game" | "prep" | "breakfast" | "lunch" | "dinner" | "dessert"
A meal lays that meal’s food; “prep” lays plates and goblets with no food; “none” clears the tables; “game” stops pinning and leaves them to the game clock’s schedule.
Returns
Section titled “Returns”boolean
False for any other value or an unavailable server.
setPlayerCollision()
Section titled “setPlayerCollision()”setPlayerCollision(
on):boolean
Switches player-to-player collision for every client. Only a player’s own movement is blocked: NPCs, spells and the world are unaffected, and nobody can push anyone. Two players who end up inside each other (a teleport, a shared spawn) pass through until they separate. Hidden, mounted, dead, disillusioned and animal-form players never block, and player.setCollidable(false) takes one player out of it.
Parameters
Section titled “Parameters”boolean
true makes players block each other; false (the default) lets them walk through each other.
Returns
Section titled “Returns”boolean
False for a non-boolean or an unavailable server.
setSeason()
Section titled “setSeason()”setSeason(
season):boolean
Sets the replicated season.
Parameters
Section titled “Parameters”season
Section titled “season”number
0 = spring, 1 = summer, 2 = autumn, 3 = winter.
Returns
Section titled “Returns”boolean
False for a non-integer, invalid range, or unavailable server.
setSpawn()
Section titled “setSpawn()”setSpawn(
spawn):boolean
Sets the server-wide spawn point: where a player’s client loads into the world when they connect, so they never pass through the dormitory first, and where a respawn without a position stands them. player.setSpawn overrides it per player. A change applies from the next connect or respawn; players already in the world stay where they are.
Parameters
Section titled “Parameters”{ position: { x: number; y: number; z: number; }; yaw?: number; } | null
An Overland position and a heading in degrees (default 0); null returns players to the game’s own start, the house dormitory.
Returns
Section titled “Returns”boolean
False for a malformed spawn or an unavailable server.
setTime()
Section titled “setTime()”setTime(
hour,minute,second?):boolean
Sets the replicated time of day. The clock keeps running from there at the current time scale.
Parameters
Section titled “Parameters”number
Hour of day (0-23).
minute
Section titled “minute”number
Minute of the hour (0-59).
second?
Section titled “second?”number
Second of the minute (0-59). Defaults to 0.
Returns
Section titled “Returns”boolean
False for an invalid range or unavailable server.
setTimeScale()
Section titled “setTimeScale()”setTimeScale(
minutesPerSecond):boolean
Sets the rate of the server-authoritative clock.
Parameters
Section titled “Parameters”minutesPerSecond
Section titled “minutesPerSecond”number
In-game minutes advanced per real second (0-600). 1 = a 24-minute in-game day; 0 freezes the clock.
Returns
Section titled “Returns”boolean
False for an invalid range or unavailable server.
setWeather()
Section titled “setWeather()”setWeather(
name):boolean
Sets the active replicated weather template. Template membership is not validated.
Parameters
Section titled “Parameters”string
Non-empty weather template name to replicate to clients.
Returns
Section titled “Returns”boolean
False for an empty/oversized name or unavailable server.