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

Prop

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

Replicated static mesh handle.

new Prop(id): Prop

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

Creates a script wrapper for an existing prop with this ID; use Prop.spawn() to spawn one.

number

Network entity identifier.

Prop

Entity.constructor

applyImpulse(impulse, point?, angularImpulse?): boolean

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

Pushes a rigid prop’s body and wakes it. The nearest player’s client simulates the body and every other player sees the pose it streams. propRest is raised once it stops.

Vector3

The push in kg m/s, world space. The body’s velocity changes by this divided by its mass, so a heavy prop needs a large number.

Vector3

Where the push lands, in world space. Off the centre of mass it also turns the body, which is what topples a tall one. Omitted, it lands on the centre of mass.

Vector3

A twist on top, in kg m^2/s about each world axis.

boolean

True when it was sent to the client simulating the prop; false when the prop is gone or is not rigid, a value is not finite or is out of range, or no player is within 60 m to simulate it.


destroy(): void

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

Despawns this prop on every client after emitting propDestroy.

void


resetPhysics(): boolean

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

Stops a rigid prop’s body and puts it back where it was spawned, for every player. Raises no propRest.

boolean

True when it was put back; false when the prop is gone or is not rigid.


setVelocity(velocity, angularVelocity?): boolean

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

Sets a rigid prop’s velocity outright, whatever its mass, and wakes it. propRest is raised once it stops.

Vector3

Its new velocity in m/s, world space, up to 200.

Vector3

Its new spin in radians per second about each world axis, up to 100. Omitted, it stops turning.

boolean

True when it was sent to the client simulating the prop; false when the prop is gone or is not rigid, a value is not finite or is out of range, or no player is within 60 m to simulate it.


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


sleep(): boolean

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

Stops a rigid prop’s body where it is, in mid-air if need be. It wakes again when something hits it or a script moves it. propRest then reports where it stopped. To fix a prop in place for good, set physics to static once propRest has been raised.

boolean

True when it was sent to the client simulating the prop; false when the prop is gone or is not rigid, a value is not finite or is out of range, or no player is within 60 m to simulate it.


toString(): string

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

Formats this prop handle for logging and debugging.

string

The prop ID, its model, its physics and its scale.

Entity.toString


wake(): boolean

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

Starts a resting rigid prop simulating where it lies, so it falls if nothing holds it up. propRest is raised once it stops.

boolean

True when it was sent to the client simulating the prop; false when the prop is gone or is not rigid, a value is not finite or is out of range, or no player is within 60 m to simulate it.


static all(): Prop[]

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

Lists every prop the server currently has.

Prop[]

One handle per live prop, in no particular order.


static destroyAll(virtualWorld?): number

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

Despawns props, emitting propDestroy for each one.

number

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

number

How many props were removed.


static getById(id): Prop | null

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

Looks a prop up by its network entity ID.

number

Network entity identifier.

Prop | null

The prop’s handle, or null when no live prop has that ID.


static spawn(model, position?, rotation?, scale?, physics?, virtualWorld?): Prop

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

Spawns and replicates a static mesh from the game’s own object catalog.

string

Mesh to build, as either a full catalog path (objects/manmade/barrels/barrel_a.cgf) or its file stem (barrel_a). A stem several meshes share resolves to the first of them, so pass the path when it matters which. A mesh this server streams – a .cgf in a resource’s stream/objects/kcdc/<resource>/ folder – is named by its full path, objects/kcdc/<resource>/chair.cgf; a player whose game does not have it yet sees the prop as soon as it does.

Vector3 | Partial<Vector3>

Optional world-space spawn position; omitted components default to zero.

Vector3 | Quaternion

Optional initial orientation: a Quaternion, or a Vector3 of Euler angles in degrees.

number | Vector3

Uniform size or separate X/Y/Z sizes, each from 0.01 to 100. Omitted uses the mesh size. Nonuniform collision follows the native engine limitations.

string

Optional collision: static (the default), rigid or none.

number

Optional virtual world the prop belongs to; omitted puts it in the global one.

Prop

The newly spawned prop handle.

readonly id: number

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

Immutable network entity identifier.

Entity.id


mass: number

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

A rigid prop’s mass in kilograms, given to its body as it is built; 0, the default, takes the mass the mesh’s collision gives it. Up to 100,000; a value outside 0 to 100,000 is ignored. Set it for a mesh whose collision carries no mass, such as a tree’s: without one, every client builds such a prop as a static one, which stands still and cannot be pushed, and logs why. Assignment rebuilds the prop on every client, so set it before pushing it.


readonly model: string

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

Catalog path of the mesh this prop was built from, e.g. objects/manmade/barrels/barrel_a.cgf. Read-only: the collision is built from the mesh when the entity is spawned and never re-read, so a prop is the model it was created with.


readonly modelGroup: string

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

Browsing bucket the mesh sits in, e.g. manmade/structures; kcdc/<resource> for a mesh the server streams.


readonly modelName: string

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

File stem of the mesh, e.g. barrel_a, which is the short name Prop.spawn also accepts.


physics: string

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

What this prop’s collision does: static collides but never moves, rigid falls and can be pushed, none has none at all. Assignment rebuilds the prop on every client. A rigid one is simulated by the nearest player’s client within 60 m, and every other player sees the pose it streams; with nobody that near, it stays where it last rested.


position: Vector3

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

Authoritative world-space position; assignment forces replicated state.

Entity.position


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


scale: number

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

Uniform scale, from 0.01 to 100; a value outside that is clamped into it. Assignment rebuilds the prop on every client, because the collision is sized from the scale at spawn and never re-read.


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