Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classServer APIGenerated

Light

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

Replicated point light that illuminates its surroundings.

new Light(id): Light

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

Creates a handle for an existing entity.

number

Network entity identifier.

Light

Entity.constructor

destroy(): void

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

Removes this light from every client. Safe to repeat.

void


setVirtualWorld(world): void

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

Moves this entity into another virtual world.

number

Virtual-world identifier used to partition replication and visibility.

void

Entity.setVirtualWorld


setVisibleTo(player): void

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

Restricts replication of this entity to one owning connection while preserving normal range and visibility checks.

Entity | null

Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.

void

Entity.setVisibleTo


toString(): string

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

Formats this entity handle for logging and debugging.

string

Text containing the network entity ID.

Entity.toString


static spawn(position, options?): Light

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

Creates a persistent point light, streamed to nearby players including late arrivals. Removed when its creating script resource stops. Exported world lights are owned by the server.

Vector3 | { x: number; y: number; z: number; }

World-space position in metres.

RGB color 0..1, intensity 0..100 and radius 0.1..100 metres. Defaults to warm orange, intensity 1, radius 5 and castShadows false. Set castShadows to true for native shadows.

boolean

Vector3 | { x: number; y: number; z: number; }

number

number

Light

The new light handle.

castShadows: boolean

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

Whether this light casts native shadows. False by default; only booleans are accepted.


color: Vector3

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

RGB color using x, y and z, each from 0 to 1. Invalid values throw before mutation.


readonly id: number

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

Immutable network entity identifier.

Entity.id


intensity: number

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

Diffuse intensity multiplier, from 0 to 100. Invalid values throw before mutation.


position: Vector3

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

World-space position in metres. Invalid positions throw before mutation.

Entity.position


radius: number

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

Light radius in metres, from 0.1 to 100. Invalid values throw before mutation.


rotation: Vector3 | Quaternion

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

Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.

Entity.rotation


readonly state: StateBag

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

Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.

Entity.state


readonly virtualWorld: number

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

Current virtual-world identifier.

Entity.virtualWorld