Skip to content
ASArcaneMP Scripting APIScripting reference
Runtime classServer APIGenerated

Light

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

A server-owned point or spot light that every player in range renders, at a place or riding an entity.

  • ServerEntity.ServerEntity

new Light(id): Light

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

Wraps a light entity id without creating one.

number

Network id of the server entity to wrap.

Light

attachTo(entity, offset?, rotation?): boolean

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

Makes the light ride an entity’s body on every client until detach, and destroys it with the entity. False for a missing entity or one of another kind.

ServerEntity

A player, NPC, creature, world object or character.

Offset in cm in the entity’s frame, so it turns with it.

number

number

number

Rotation in degrees relative to the entity, to aim a spot light.

number

number

number

boolean


destroy(): boolean

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

Destroys this light; every client removes it.

boolean


detach(): boolean

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

Leaves an attached light where its entity is. False when it was not attached.

boolean


lookAt(target): boolean

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

Turns a placed light to shine at a point. False while it is attached or when the point is where the light is.

A world position.

number

number

number

boolean


set(options): boolean

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

Changes several settings at once. False for a light that no longer exists.

LightOptions

The fields to change; x/y/z and pitch/yaw/roll move it unless it is attached.

boolean


setVirtualWorld(world, map?): void

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

Moves this entity into another virtual world, within a map: there it meets the players in the same world of the same map, so world N of a dungeon is one instance of it.

number

Virtual-world identifier used to partition replication and visibility.

string

The map it is in, as player.location().areaId names it; “Overland” or “” for the shared map. Left out, it stays in its current map.

void


setVisibleTo(player): void

Defined in: shared.d.ts:82

Restricts replication to one player’s connection, within the usual range and visibility checks; null lifts it.

Entity | null

void


toString(): string

Defined in: shared.d.ts:74

string


static create(id, kind, options?): Light | undefined

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

Creates or replaces a light that every player in range renders. Throws on a wrong type, an unknown kind, preset or name.

string

Stable string id; creating again under it replaces the light.

"point" | "spot"

A point light shines all round, a spot light in a cone along its forward axis.

LightOptions

Placement and settings.

Light | undefined


static destroy(id): boolean

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

Destroys the light stored under an id.

string

The id passed to create.

boolean


static presets(): LightPreset[]

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

HL’s own light fixtures, from a candle to a street lamp, for LightOptions.preset.

LightPreset[]

readonly attachedTo: number

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

Network id of the entity it rides, or 0 when placed.


color: object

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

Linear color 0-1; also takes a “#RRGGBB” sRGB string.

b: number

g: number

r: number


drawDistance: number

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

Distance in cm from the camera beyond which clients stop drawing the light (default 4000, the game’s own); 0 never culls. Changing it re-creates the light on clients.


enabled: boolean

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

Whether the light is on.


fadeRange: number

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

Distance in cm over which the light fades out before drawDistance (default 300).


readonly id: number

Defined in: shared.d.ts:65

Network id, stable for the entity’s lifetime.


innerCone: number

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

Spot: the cone, in degrees from the axis, inside which the light is at full strength (default 0).


intensity: number

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

Brightness in candelas, 0-100000 (default 8). HL’s own fixtures run from a candle’s 1 to a street lamp’s 60.


readonly kind: "point" | "spot"

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

“point” or “spot”; fixed at create.


outerCone: number

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

Spot: the cone, in degrees from the axis, at whose edge the light falls to nothing (default 44).


position: Vector3

Defined in: shared.d.ts:67

World position. Read, call set(...), then assign back.


priority: "always" | "low" | "high" | "normal"

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

Its rank in the game’s render-side light budget; “always” exempts it.


radius: number

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

How far the light reaches, in cm (its attenuation radius), 1-100000 (default 1000).


rotation: Vector3 | Quaternion

Defined in: shared.d.ts:69

Reads as a quaternion; assignments also accept Euler angles in degrees.


shadowQuality: "medium" | "low" | "high" | "epic" | "cinematic"

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

The lowest shadow quality setting at which a player sees its shadows.


shadows: boolean

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

Whether it casts shadows.


softSourceRadius: number

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

In cm; widens only the shadow penumbra.


sourceLength: number

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

In cm; stretches a point or spot source into a tube along its forward axis.


sourceRadius: number

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

Radius of the emitting sphere in cm; a wider source softens shadows and highlights.


specular: number

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

Strength of its specular highlights, 0-1 (default 1); 0 lights diffuse only.


readonly state: StateBag

Defined in: shared.d.ts:71

This entity’s key/value state: the server writes it, and every client that can see the entity receives it. See StateBag.


streamRange: number

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

Interest radius in cm, clamped to 100-100000; takes effect at the next interest refresh.


temperature: number

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

Color temperature in Kelvin, 1700-12000; 0 leaves the color untinted.


readonly ttl: number

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

Seconds until the server destroys it, or 0 when it lives until destroy.


readonly virtualWorld: number

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

The virtual world scripts put this entity in. Outside the shared map (Overland) replication combines it with the entity’s map, as it does a player’s.


volumetric: number

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

How strongly it lights volumetric fog, 0-100 (default 1).