Skip to content

Colshape

@vimp-mp/types 2.0.1

Interface · Server API

Server-side trigger volume returned by vimp.colshapes.create*.

Detection (player enter/exit) is performed authoritatively by the server on each player position update; scripts only observe the results via playerEnterColshape / playerExitColshape events.

playersInside is a live JS-side cache updated by those same events; reading it never round-trips to the server.

ts
interface Colshape extends StreamSyncedMeta

Members

dimension

ts
dimension: number

Virtual world. Detection (playerEnterColshape/playerExitColshape) runs only for players in the same dimension. A player in another dimension does not generate an event even while physically inside.

id

ts
readonly id: number

Server-assigned colshape identifier.

isExists

ts
readonly isExists: boolean

Whether the colshape is still registered with the server runtime.

key

ts
readonly key: string | undefined

Application key supplied at creation.

playersInside

ts
readonly playersInside: readonly Array<Player>

Players currently inside this volume (server-authoritative).

position

ts
position: Vec3

Trigger volume centre. Writing it moves the colshape server-side and re-streams the new geometry to every client.

type

ts
readonly type: ColshapeType

Geometric shape selected by the creation method.

deleteStreamSyncedMeta

ts
deleteStreamSyncedMeta(key: string): void

Deletes key and propagates the removal to streaming clients.

destroy

ts
destroy(): boolean

Destroys this colshape instance.

getStreamSyncedMeta

ts
getStreamSyncedMeta<T = unknown>(key: string): T | undefined

Returns undefined if the key is unset.

getStreamSyncedMetaKeys

ts
getStreamSyncedMetaKeys(): Array<string>

Returns all stream-synced metadata keys stored on the entity.

hasStreamSyncedMeta

ts
hasStreamSyncedMeta(key: string): boolean

Returns whether the entity has a value for key.

isPointInside

ts
isPointInside(x: number, y: number, z: number): boolean

Local geometric check using the cached shape parameters. Useful for ad-hoc queries; the server runs the same check on every UDP position packet.

setStreamSyncedMeta

ts
setStreamSyncedMeta(key: string, value: unknown): void

Set or replace one key. The value is forwarded to every player currently streaming this entity, plus included in the snapshot for any future stream-in. Use deleteStreamSyncedMeta rather than undefined when the key must be removed.

VIMP developer documentation