Skip to content

@nextvm/player

First-party player module. Owns the runtime per-character state for position, health, armor, and alive/dead status, plus the player RPC router (teleport, revive, setHealth).

Install

bash
pnpm add @nextvm/player

Then list it in nextvm.config.ts:

typescript
modules: ['@nextvm/player', /* ... */]

Config

FieldTypeDefaultDescription
startingHealthint (1–200)100Initial health value when a character spawns
respawnCoords{ x, y, z }Pillbox HospitalCoordinates used when reviving a player

State

playerState is a defineState container exported by the module:

FieldTypeDefault
posXnumber0
posYnumber0
posZnumber0
healthnumber (0–200)100
armornumber (0–100)0
isDeadbooleanfalse

All fields are character-scoped — keyed by charId, not source.

RPC procedures

ProcedureTypeInputDescription
getMequeryReturns the calling player's full state
getPlayerquery{ charId }Returns any character's state
teleportmutation{ x, y, z }Teleports the calling player
revivemutation{ charId }Resets health to 100 + isDead to false
setHealthmutation{ charId, health }Admin: set a character's health (0–200)

Events

EventPayloadFired when
player:spawned{ charId, source }Character is fully loaded after onPlayerReady
player:left{ charId, source }Character disconnects
player:mounted{}Client onMounted fires

Dependencies

None — @nextvm/player is the foundation that other modules (@nextvm/banking, @nextvm/jobs, @nextvm/housing, @nextvm/inventory, ...) depend on.

See also

Released under the LGPL-3.0 License.