API reference
Это содержимое пока не доступно на вашем языке.
GDMP experiences run sandboxed JavaScript (V8, no eval of strings from the network, no file or network access) with one
global, gdmp. This page lists every name in it. API 1.0 is frozen (see the end): what is listed here keeps working
in every 1.x release.
gdmp.version is the API level as a string: "77" for 1.0, "89" with player touch, "90" with sounds
(gdmp.audio) and UI icons / sprites / fades, "91" with outlines and moving UI, "92" with free (X/Y) movement and
more input keys, "93" with data stores, "103" with gdmp.sprites, "120" with gdmp.console, "122" with gdmp.voice. It only grows. Compare it as a number: Number(gdmp.version) >= 92.
Where a script runs, and what it gets
Section titled “Where a script runs, and what it gets”A package has up to three scripts. Which names exist depends on the host and on the capabilities the manifest
declares ("capabilities": [...]; Studio objects add what they need by themselves).
| Script | Runs on | Typical use |
|---|---|---|
server (server.entry) |
the game server (GdmpServer) | the rules: authoritative, sees every player |
client (client.entry) |
every player’s game, Play mode | UI, local effects, this player’s input |
build (build.entry) |
the creator’s game, Build mode | tools that edit the level |
| Namespace | Server | Play client | Build client | Capability |
|---|---|---|---|---|
gdmp.version, gdmp.log, gdmp.time |
✓ | ✓ | ✓ | — |
gdmp.players (queries, events) |
✓ | ✓ | ✓ | players |
gdmp.players.respawn/teleport/freeze/setVisible |
✓ | playerControl + net + players |
||
gdmp.nametags |
✓ | playerControl + net + players |
||
gdmp.net, gdmp.state |
✓ | ✓ | net |
|
gdmp.zones |
✓ | ✓ | players |
|
gdmp.players.onTouch/onTouchEnd/touching/setTouchDistance (level 89) |
✓ | ✓ | players |
|
gdmp.audio (level 90) |
✓ (sends) | ✓ (plays) | net + players on the server; nothing on a client |
|
gdmp.economy |
✓ (full) | ✓ (promptPurchase) |
net |
|
gdmp.data (level 93) |
✓ | data |
||
gdmp.sprites (level 103) |
✓ (Play) | nativeUI |
||
gdmp.world (read) |
✓ | ✓ | world |
|
gdmp.world.create/update/remove, gdmp.build |
✓ | worldWrite |
||
gdmp.level (read) |
✓ | ✓ | level |
|
gdmp.level.create/update/remove/transaction/getByHandle |
✓ | level (Build) |
||
gdmp.level.spawn |
✓ (group[, playerId]) |
✓ (group) |
levelControl |
|
gdmp.input |
✓ | input |
||
gdmp.player |
✓ | playerControl |
||
gdmp.ui |
✓ | ✓ | nativeUI |
|
gdmp.web |
✓ | ✓ | webUI (and CEF on) |
|
gdmp.voice (level 122) |
✓ (channels, mutes) | ✓ (who speaks, volumes) | voice |
|
gdmp.console (level 120) |
✓ | — |
A name that is not there is undefined. Test for it: if (gdmp.economy) ....
Values a call returns are frozen copies: reading them is free, changing them throws. Callbacks (on...) need a
script that stays loaded (always true for package scripts); each kind has a limit (64 by default). A bad argument throws a
TypeError that names the call (gdmp.players.teleport: expects (id, x, y) ...); nothing happens then.
Coordinates are GD level units: 30 = one block; a player standing on the ground row is at y = 105.
