Skip to content
ASArcaneMP Scripting APIScripting reference
Global objectClient APIGenerated

World

const World: object

Defined in: client/api.d.ts:6050

Current level and world-streaming state.

readonly state: StateBag | null

Global replicated key/value state written by the server and shared by every resource. Read-only here. Null until the world entity streams in. See StateBag.

readonly stateId: number

Network id of the entity carrying World.state, for filtering the global entityStateChange bus. 0 before it streams in.

ambientPopulation(): boolean

Whether ambient population is currently restored.

boolean

clearLocalOverride(): void

Hands this client’s weather, clock and season back to the server.

void

collectablePolicy(): object

The per-family suppression policy: {fieldGuidePages, flyingBooks, spawnedPages}.

object

commonRoomEntrances(): object

Each house’s common-room entrance on this client: the server’s World.setCommonRoomEntrance for it, whether it is loaded here, whether it stands open or opening (null when not loaded), and whether the local player stands in its trigger, the spot where it decides whom to let in (e.g. to ask for a password there).

object

Gryffindor: CommonRoomEntrance

Hufflepuff: CommonRoomEntrance

Ravenclaw: CommonRoomEntrance

Slytherin: CommonRoomEntrance

currentLevelName(): string

Returns the current level name.

string

isReady(): boolean

Returns whether the playable world is ready.

boolean

leadVelocity(sx, sy, sz, tx, ty, tz, tvx, tvy, tvz, speed, gravity?): object | null

The engine’s ballistic lead solver: the velocity to launch from the source at to hit a target moving at a constant velocity. Returns {x,y,z,time}; time 0 means no solution. Magnitude is sqrt(speed^2 + |targetVel|^2) — a shipped bug, so pass sqrt(S^2 - |tv|^2) for exactly S.

number

number

number

number

number

number

number

number

number

number

number

object | null

lineTrace(start, end, options?): TraceHit | null

Traces a line through this client’s collision and returns the first blocking hit, or null on a miss. Only loaded levels have collision, so a trace into an area this client has not streamed in finds nothing. Throws a TypeError on a bad argument.

Vec3

Where the trace starts, in world centimetres.

Vec3

Where it ends.

TraceOptions

Channel or object types, and what to pass through.

TraceHit | null

localOverride(): { hour?: number; minute?: number; owner: string; season?: number; weather?: string; } | null

The override setLocalOverride set, with the resource that set it; null when the server’s environment shows.

{ hour?: number; minute?: number; owner: string; season?: number; weather?: string; } | null

populationDensity(): number

The crowd density setPopulationDensity applied, 1 by default.

number

populationExclusions(): PopulationExclusions

The scheduled NPCs currently kept out of the world.

PopulationExclusions

populationExemptions(): string[]

The NPC names currently exempt from population suppression.

string[]

scheduledEntities(): ScheduledEntityInfo[]

Every NPC the game’s scheduler holds on this client: its name (what setPopulationExemptions and setPopulationExclusions take), its game subtype, whether it is spawned or excluded, and where its schedule has it. Named NPCs are listed wherever they are; crowd NPCs only while the crowd has them out, and several may share a name.

ScheduledEntityInfo[]

setAmbientPopulation(enabled): boolean

Restores the game’s ambient population (students, seat fillers, Tier-4 crowd extras). The mod suppresses it by default, so crowds need this on first. Turning it off returns every Tier-4 extra already out, except an exempt NPC’s own.

boolean

boolean

setBoundaryPolicy(remove): number

Sets boundary-volume enforcement.

boolean

number

setCollectablePolicy(suppress, families?): number

Disables field-guide collectables without writing any save state; returns actors written. Turning it off re-arms the hotspots, but destroyed books and pages only return when their cell re-streams. Chests, ancient magic, astronomy, Merlin trials and balloons are separate systems and are not covered.

boolean

object

Which families to act on: fieldGuidePages, flyingBooks, spawnedPages. Omit for all; with it, only the keys set true are touched.

number

setLocalOverride(override): void

Shows this client its own weather, time of day and season in place of the server’s, e.g. while a character creator is open. Fields left out follow the server. Replaces any earlier override, from any resource, and ends when clearLocalOverride is called or the resource that set it stops.

weather: a template name, as World.setWeather takes on the server. hour 0-23 and minute 0-59 stop this client’s clock there. season 0-3 (spring, summer, autumn, winter). An empty object clears.

number

number

number

string

void

setPopulationDensity(density): number

Thins the ambient crowd on this client: every crowd lane (wandering and seated students and townsfolk, spline walkers, world-event extras) may have only this share of the player’s own Population quality out, and this share of the Tier-4 background extras gets through. Named NPCs are not affected. A crowd already out thins as it turns over, not at once. Returns the value applied. 1 by default and again when the session ends; call it from playerRegionChanged for a density per area, e.g. 0 for HM_ and Hogsmeade regions, 0.3 for HOG_ ones and Hogwarts.

number

0 (no crowd) to 1 (the game’s own); outside that range it is clamped.

number

setPopulationExclusions(exclusions): PopulationExclusions

Keeps these scheduled NPCs out of the world, with ambient population on or off: one already spawned goes away within a second, and one listed again later comes back on its own schedule. Types also refuse the matching Tier-4 crowd extras (T4Student, T4Townsperson, T4DarkWizard, T4Goblin) from then on. Replaces both lists and returns them deduplicated; an unknown type throws. Empty by default and cleared when the session ends.

PopulationExclusions

names: scheduled-entity names, e.g. “GerboldOllivander”. types: game subtypes, e.g. “T3Student”, or the groups “vendors”, “students” and “townsfolk”.

PopulationExclusions

setPopulationExemptions(ids): string[]

Keeps these named NPCs scheduled while ambient population is off, so a location-bound character such as the Fat Lady’s portrait is not left empty. Replaces the whole list and returns it deduplicated. Empty by default and cleared when the session ends. Removing an id stops scheduling that NPC but does not despawn one already in the world.

string[]

Scheduled-entity names, e.g. “FatLady”.

string[]

worldObjectState(networkId): WorldObjectClientState | null

Returns this client’s replicated world-object and spawned-actor state, or null when the replica is absent.

number

Server world-object network id.

WorldObjectClientState | null