LevelEdit
Defined in: server/api.d.ts:4733
One change the server makes, for every player, to an object the level itself placed – a brush, a tree or a level entity taken out of the world, moved, swapped for another mesh, or a mix of those – or to the grass: the tall grass, flowers and ferns the level bakes into its terrain are not objects, and a grass edit takes out every one of them rooted in a box. It is what a World Builder map’s world array carries. WorldRayHit.levelObject names the object a trace met in the form apply takes.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LevelEdit(
id):LevelEdit
Defined in: server/api.d.ts:4738
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:4803
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:4798
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, a transform that is not finite, or a grass edit, whose box is fixed when it is applied.
restore()
Section titled “restore()”restore():
void
Defined in: server/api.d.ts:4808
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:4814
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:4789
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:4829
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:4822
Takes an object the level placed out of the world, moves it, or swaps it for another mesh, 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. A WorldRayHit.levelObject is a definition already: spread it and add what to do, as in LevelEdit.apply({ ...hit.levelObject, model: stump }).
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, a model no client could load, or a grass box that is not finite and within its limits.
getById()
Section titled “getById()”
staticgetById(id):LevelEdit|null
Defined in: server/api.d.ts:4836
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:4843
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:4748
False once the edit has been restored; every other read then returns its empty value.
readonlyguid:string
Defined in: server/api.d.ts:4763
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:4773
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. For grass, whether the plants in the box are taken out.
readonlyid:number
Defined in: server/api.d.ts:4743
Immutable network entity identifier.
readonlykind:"brush"|"entity"|"grass"
Defined in: server/api.d.ts:4753
Whether the object is a brush, found by its mesh and where the level put it, a level entity, found by its EntityGuid, or a box of the terrain’s grass.
model:
string
Defined in: server/api.d.ts:4783
The mesh standing in the object’s place, or empty. Assigning a prop catalog path or a mesh this server streams swaps the object for it on every player: the object goes, collision included, and the mesh stands where it stood – or where move put it – as solid static scenery. A felled tree leaves its stump this way. Assigning an empty string gives the object back. Throws for any other path, and for a grass edit.
readonlymoved:boolean
Defined in: server/api.d.ts:4778
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:4758
A brush’s mesh path, or the name the level gives the entity. Empty for grass.
virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:4768
The virtual world whose players see the edit, fixed when it was applied.