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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”LevelEdit
Methods
Section titled “Methods”clearMove()
Section titled “clearMove()”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.
Returns
Section titled “Returns”void
move()
Section titled “move()”move(
position,rotation?,scale?):boolean
Defined in: server/api.d.ts:4389
Moves the object for every player, collision included.
Parameters
Section titled “Parameters”position
Section titled “position”Where the object stands instead.
rotation?
Section titled “rotation?”Its orientation: a Quaternion, or Euler angles in degrees. Left out, it keeps the last move’s.
scale?
Section titled “scale?”number | Vector3
A uniform scale or one per axis, from 0.01 to 100. Left out, it keeps the last move’s.
Returns
Section titled “Returns”boolean
False for a gone edit or a transform that is not finite.
restore()
Section titled “restore()”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.
Returns
Section titled “Returns”void
toJSON()
Section titled “toJSON()”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.
Returns
Section titled “Returns”LevelEditDefinition | null
Null once the edit is gone.
toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:4380
Formats this edit for logging and debugging.
Returns
Section titled “Returns”string
Its id, kind, object and what it does to it.
staticall(virtualWorld?):LevelEdit[]
Defined in: server/api.d.ts:4420
Lists every edit the server currently has.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to list; omitted lists every one of them.
Returns
Section titled “Returns”LevelEdit[]
One handle per live edit, in no particular order.
apply()
Section titled “apply()”
staticapply(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.
Parameters
Section titled “Parameters”definition
Section titled “definition”The object and what to do to it, in the format of one entry of a World Builder map’s world array.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world whose players see it; the global one when omitted.
Returns
Section titled “Returns”LevelEdit
The edit. Throws for a definition no client could find the object by.
getById()
Section titled “getById()”
staticgetById(id):LevelEdit|null
Defined in: server/api.d.ts:4427
Looks an edit up by its network entity ID.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”LevelEdit | null
The edit, or null when no live edit has that ID.
restoreAll()
Section titled “restoreAll()”
staticrestoreAll(virtualWorld?):number
Defined in: server/api.d.ts:4434
Drops edits, giving every player the objects back as the level had them.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to clear; omitted clears every one of them.
Returns
Section titled “Returns”number
How many edits were dropped.
Properties
Section titled “Properties”exists
Section titled “exists”
readonlyexists:boolean
Defined in: server/api.d.ts:4344
False once the edit has been restored; every other read then returns its empty value.
readonlyguid:string
Defined in: server/api.d.ts:4359
An entity’s level EntityGuid as sixteen lowercase hex digits; empty for a brush.
hidden
Section titled “hidden”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.
readonlyid:number
Defined in: server/api.d.ts:4339
Immutable network entity identifier.
readonlykind:"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.
readonlymoved: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.
readonlyname:string
Defined in: server/api.d.ts:4354
A brush’s mesh path, or the name the level gives the entity.
virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:4364
The virtual world whose players see the edit, fixed when it was applied.