Skip to content
ASArcaneMP Scripting APIScripting reference
Runtime classServer APIGenerated

Zone

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

A server volume that reports entities crossing it, from the positions the server already has, checked 10 times a second. Events: zoneEntered(zone, entity); zoneExit(zone, entity | null, reason, entityId) with reason “left”, or “gone” when the entity no longer exists (entity is then null). An entity inside when the zone is created gets zoneEntered at the next check. A mover that crosses the zone between two checks gets zoneEntered then zoneExited back to back. Destroying a zone, or replacing it under the same key, sends no zoneExited. A resource’s zones are destroyed when it stops. A zone with a hazard (options.hazard, setHazard) also hurts, fogs and tints the players inside it, and raises zoneHazard(zone, player, exposed, playerId) as their exposure changes.

new Zone(id): Zone

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

Wraps a zone id; see valid.

number

Zone id.

Zone

contains(point): boolean

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

Whether the point is inside. Ignores virtual worlds.

A world position; a Vector3 works.

number

number

number

boolean


destroy(): boolean

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

Destroys the zone. No zoneExited is sent.

boolean


getEntities(): (Player | Character | Beast | NPC | WorldObject)[]

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

Every tracked entity inside as of the last check.

(Player | Character | Beast | NPC | WorldObject)[]


getHazard(): ZoneHazard | null

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

Its hazard with every default filled in; null when it has none or is destroyed.

ZoneHazard | null


getPlayers(): Player[]

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

The players inside as of the last check.

Player[]


getShape(): ZoneShape | null

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

Its shape as created; null once destroyed.

ZoneShape | null


getTrack(): ("beast" | "player" | "npc" | "worldObject" | "character")[]

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

The entity kinds it reports.

("beast" | "player" | "npc" | "worldObject" | "character")[]


isExposed(player): boolean

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

Whether the last check found the player inside and unprotected.

Player

Who to ask about.

boolean


protect(player, seconds): boolean

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

Protects a player from this zone’s hazard for a while, inside or not yet, replacing what was left. Holding a protection item still protects on top. False once the zone is destroyed.

Player

Who to protect.

number

How long, 0 to 86400; 0 ends a protection now.

boolean


protectedFor(player): number

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

Seconds of protection left from a consumable or protect(), 0 when none. Items held are not counted.

Player

Who to ask about.

number


setHazard(hazard): boolean

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

Gives the zone a hazard, or takes it off. Players inside hear of it at the next check. False once the zone is destroyed; a TypeError on a bad hazard.

ZoneHazard | null

The new hazard, replacing the old one whole; null takes it off.

boolean


static create(key, shape, options?): Zone

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

Creates or replaces a zone. Throws a TypeError on a bad shape or option, and an Error at 4096 zones.

string

Stable key; creating again replaces the zone.

ZoneShape

The volume.

ZoneOptions

Virtual world and the entity kinds to report.

Zone


static destroy(key): boolean

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

Destroys the zone under a key. No zoneExited is sent.

string

Key passed to create.

boolean


static get(key): Zone | undefined

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

The zone under a key.

string

Key passed to create.

Zone | undefined


static getAll(): Zone[]

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

Every zone, oldest first.

Zone[]

readonly id: number

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

Zone id, unique for the server’s lifetime.


readonly key: string

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

The key it was created under; empty once destroyed.


readonly map: string

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

The map it is in; empty for the shared map.


readonly type: "" | "sphere" | "box" | "cylinder" | "polygon"

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

Its shape’s type; empty once destroyed.


readonly valid: boolean

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

Whether the zone still exists.


readonly virtualWorld: number

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

The virtual world it watches.