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

LevelEdit

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

One change the server makes, for every player, to an object the level itself placed – a brush or a level entity taken out of the world, moved, or both. It is what a World Builder map’s world array carries.

new LevelEdit(id): LevelEdit

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

Wraps an edit the server already holds; use LevelEdit.apply to make one, or WorldResource for a whole export.

number

Network entity identifier.

LevelEdit

clearMove(): void

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

Puts the object back where the level placed it, keeping it out of the world if the edit takes it out.

void


move(position, rotation?, scale?): boolean

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

Moves the object for every player, collision included.

Vector3

Where the object stands instead.

Vector3 | Quaternion

Its orientation: a Quaternion, or Euler angles in degrees. Left out, it keeps the last move’s.

number | Vector3

A uniform scale or one per axis, from 0.01 to 100. Left out, it keeps the last move’s.

boolean

False for a gone edit or a transform that is not finite.


restore(): void

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

Drops the edit: every player gets the object back exactly as the level had it, collision included.

void


toJSON(): LevelEditDefinition | null

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

The definition LevelEdit.apply takes to make this edit again, which is what a script saves: the server keeps nothing past a restart. It is one entry of a World Builder map’s world array.

LevelEditDefinition | null

Null once the edit is gone.


toString(): string

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

Formats this edit for logging and debugging.

string

Its id, kind, object and what it does to it.


static all(virtualWorld?): LevelEdit[]

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

Lists every edit the server currently has.

number

Optional virtual world to list; omitted lists every one of them.

LevelEdit[]

One handle per live edit, in no particular order.


static apply(definition, virtualWorld?): LevelEdit

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

Takes an object the level placed out of the world, or moves it, for every player in the virtual world – whenever they join, and however far away they are. Collision goes with it. An edit already made to the same object in that world is restated rather than doubled, so applying one twice changes nothing. Kept in memory only: apply it again on boot.

LevelEditDefinition

The object and what to do to it, in the format of one entry of a World Builder map’s world array.

number

Optional virtual world whose players see it; the global one when omitted.

LevelEdit

The edit. Throws for a definition no client could find the object by.


static getById(id): LevelEdit | null

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

Looks an edit up by its network entity ID.

number

Network entity identifier.

LevelEdit | null

The edit, or null when no live edit has that ID.


static restoreAll(virtualWorld?): number

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

Drops edits, giving every player the objects back as the level had them.

number

Optional virtual world to clear; omitted clears every one of them.

number

How many edits were dropped.

readonly exists: boolean

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

False once the edit has been restored; every other read then returns its empty value.


readonly guid: string

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

An entity’s level EntityGuid as sixteen lowercase hex digits; empty for a brush.


hidden: boolean

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

Whether the object is taken out of the world: not drawn and not solid. Assignment takes it out or puts it back for every player, keeping any move.


readonly id: number

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

Immutable network entity identifier.


readonly kind: "brush" | "entity"

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

Whether the object is a brush, found by its mesh and where the level put it, or a level entity, found by its EntityGuid.


readonly moved: boolean

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

Whether the object stands somewhere other than where the level placed it; move and clearMove change it.


readonly name: string

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

A brush’s mesh path, or the name the level gives the entity.


readonly virtualWorld: number

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

The virtual world whose players see the edit, fixed when it was applied.