Skip to main content
The ReSkate repository keeps its example plugins in contrib/plugins. Two of them check ReSkate’s plugin host: reskate-test calls every plugin API and says what worked, and reskate-hostile attacks the sandbox on purpose. Between them they ask for almost every permission, so read them for how each API is used, not for which permissions a plugin of your own needs.

Try one

Copy the plugin’s folder (such as contrib/plugins/reskate-test) into the game’s Mods folder and open the console. The game looks for plugins every 2 s, so it loads without a restart. plugin list shows whether it is running. Both also run without the game, in the plugin tests (dingosdk_plugin_tests, built with DINGOSDK_BUILD_PLUGIN_TESTS).

reskate-test

reskate-test calls every plugin API. ptest all runs every check, ptest <module> runs one module, and ptest list names the modules. It prints only the failures and one summary line, to stay under the 50 lines a second a plugin may log. It is also the example to copy when you make a plugin: every API ReSkate adds gets a module in plugin/checks/.

Its files

main.lua

The entry first reads reskate.side. The server copy loads server.lua and stops there; the player’s copy loads harness.lua and every module in checks/, then adds the ptest command:

The harness

harness.lua is a small test runner. A module calls harness.module(name) and adds checks to it:
  • check(title, fn): passes when fn returns without an error. Returning harness.skip(why) skips it, for a check that needs something not there now, such as a skater.
  • later(title, within, fn): fn gets a done(ok, why) to call within within ms, for checks that wait on timers or events.
  • harness.refused(fn, ...): calls fn and fails unless it raised an error. Most checks use it to make sure a bad argument is refused.

The modules

ptest all reads the game and changes nothing. What changes things runs by hand, from its own command. wider also offers a library: reskate.expose gives other plugins version and add, as reskate.require_plugin("ReSkate_Test") returns them. See libraries.

Commands worth reading

Some of the by-hand commands are small plugins of their own:
  • ptest hud (checks/overlay.lua) draws a box with text on screen, and a ring, a line and a label in the world around the skater. See drawing a HUD.
  • ptest picture (checks/more.lua) draws icons/ptest.png on screen and standing over the skater.
  • ptest fly (checks/ports.lua) flies a camera for 15 s with the flight keys and mouse, renewing input.capture each tick and rolling the view. See a free-flying camera.
  • ptest sound (checks/ports.lua) plays sounds/beep.wav at the skater, then a motor 5 m ahead whose throttle it changes every half second. See playing sounds.
  • ptest record, ptest anim and ptest replace (checks/more.lua) record 3 s of the skater, play it back, and make the kickflip play it. See recording and playing clips.
  • ptest ping (checks/session.lua) asks every other player running reskate-test to answer with reskate.net.send.
  • ptest screen (checks/wider.lua) opens a full-screen screen; Esc closes it and the plugin hears screen_closed.
  • ptest web (checks/wider.lua) asks api.github.com, the one host its manifest lists, for a line of text.

The server copy

reskate-test’s manifest says "side": "both", so on a lobby’s host and on a dedicated server a second copy runs as the session’s authority. server.lua is all it does: it answers a "ping" with a pong to everyone and says so in chat.
On a lobby’s host its id is reskate-test@server, so its log lines read [reskate-test@server] server copy: ping .... ptest server (in checks/more.lua) sends "ping" to "server", and prints the pong when a message with from.server set comes back. See a game mode with a server copy.

reskate-hostile

reskate-hostile is written to break the sandbox, one attack per command. Every attack must end with the plugin stopped or refused and the game running as before. hostile list names the attacks with what should happen, and hostile <attack> runs one. An attack that gets it stopped is expected: plugin on reskate-hostile starts it again for the next one.
reskate-hostile is for testing only. Some attacks hang a handler on purpose, flood the log, or send chat lines and messages to the session. Run it on your own, not in a session with other players.
Any line it prints starting with ESCAPED is a hole in the sandbox. Its manifest says "side": "client".

Time and memory

Rates and amounts

Each of these keeps running: the calls past the limit are refused.

Ways out

Each of these keeps running and must be refused.

Ports

Five features that were built into ReSkate are mods now, plugins in contrib/plugins that use only the API on these pages. ReSkate keeps no copy of them: their console commands, settings and menu panels are the plugins’ own. Each has its own checks (<command> test), which the plugin tests run too, and its switches on its own page in the menu’s PLUGINS section. They are larger than reskate-test’s checks, and show how the APIs go together in a whole feature. Copy a plugin’s folder into the game’s Mods folder to try it, as with reskate-test. board-break goes inside the deck pack’s folder, beside its sounds/.

Where to go next

  • Quickstart: your first plugin.
  • Guides: game modes, drawing, clips, a flying camera and sounds, each built step by step.