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 ascontrib/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 readsreskate.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 whenfnreturns without an error. Returningharness.skip(why)skips it, for a check that needs something not there now, such as a skater.later(title, within, fn):fngets adone(ok, why)to call withinwithinms, for checks that wait on timers or events.harness.refused(fn, ...): callsfnand 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) drawsicons/ptest.pngon screen and standing over the skater.ptest fly(checks/ports.lua) flies a camera for 15 s with the flight keys and mouse, renewinginput.captureeach tick and rolling the view. See a free-flying camera.ptest sound(checks/ports.lua) playssounds/beep.wavat the skater, then a motor 5 m ahead whose throttle it changes every half second. See playing sounds.ptest record,ptest animandptest 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 withreskate.net.send.ptest screen(checks/wider.lua) opens a full-screen screen; Esc closes it and the plugin hearsscreen_closed.ptest web(checks/wider.lua) asksapi.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.
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.
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 incontrib/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.