reskate.on accepts. Five need no permission; each of the others needs the permission named in its section.
Handling an event
reskate.on(event, handler)
Registers a function to run each time the event fires. Register handlers when the entry file runs, usually at its top level.
The event’s name, one of the 33 on this page, or the same name from
reskate.Enums.Event.- an unknown name:
there is no event "<name>" in this ReSkate; - an event the plugin lacks the permission for:
the <name> event needs the "<permission>" permission in reskate-plugin.json; - more than 256 handlers for one event:
more than 256 handlers for one event.
A handler stays registered until the plugin unloads; there is no way to remove one. Keep a flag and return early instead. A handler call past 50 ms is logged as a warning and one past 1000 ms stops the plugin (see limits). An error in a handler is logged and counts towards the plugin’s error limit.
Order in a tick
On a player’s game, each tick hands out the trick events first, then the session’s players, messages, events from other plugins, web answers, and the game’s events (skater, bails, physics steps, grind exits, chat, music, throwdowns, binds). After them come each plugin’s timers andtick handlers, then its draw handlers, then its screen and its menu page and panels. Level events come as the game notices a level change.
Client and server copies
The trick events reach only a plugin’s client copy. The level events reach a client copy and a dedicated server’s server copy, which hears them when the server changes its map. A server copy on a dedicated server has no skater, so it hears no skater, physics, chat or music events either. See client and server copies.Events with no permission
load
Permission: none.
Fires once, after the entry file has run, each time the plugin loads (and reloads). The handler gets no arguments.
unload
Permission: none.
Fires when the plugin unloads while it runs: its mod switched off or removed, its files changed, plugin off, or plugin reload. The handler gets no arguments. All unload handlers share 20 ms; the rest are skipped once it is spent.
tick
Permission: none.
Fires every game tick, after the plugin’s due timers.
level_loaded
Permission: none.
Fires when a level is being played that was not before.
map, a map vote or the rotation), as soon as the server has changed it: players’ games load the map after.
level_unloading
Permission: none.
Fires when the level being played changes or goes away, before level_loaded for the next one.
On a dedicated server, a server copy hears it when the server changes its map. Anything the plugin had going on the old map, such as a round or a spawned park, ends there.
Tricks
trick_started
Permission: events.tricks.
Fires when the local skater starts a trick, as the score HUD shows it.
trick_landed
Permission: events.tricks.
Fires when a trick lands and its points show in the line’s score.
line_broken
Permission: events.tricks.
Fires once when a fall loses the line going on: a slam, a wipeout, a ragdoll, or a runout (a failed landing on foot). It fires for a line that has points banked as well as for a trick going on, and once per fall, however long the fall lasts. Stepping off the board is not a fall.
trick_notes
Permission: events.tricks.
Fires once a tick while the trick feed is on and skate.’s score HUD wrote to its trick list since the last tick. Any plugin turns the feed on with reskate.tricks.feed(true); every plugin with events.tricks and a handler hears it.
The HUD can write a field again for the same entry: keep the latest.
The skater
skater_state
Permission: events.skater.
Fires when the local skater’s state changes, checked every tick.
The new state:
"riding", "air", "wipeout", "grinding", "off_board", "planted", "other" or "none" (no skater).reskate.skater.state() reads the same value at any time.
bail
Permission: events.skater.
Fires when the local skater wipes out: when its count of wipeouts this session goes up.
board_landed
Permission: events.skater.
Fires when the board comes down from the air, read in the physics step where it happens.
body_hit
Permission: events.skater.
Fires during a bail when part of the skater’s body hits something hard enough to be heard: 3 metres per second or more along the contact. Feet never count. A bone fires at most once every 220 ms, and the body at most once every 70 ms.
Head, Neck, Left hand, Left forearm, Left upper arm, Left collarbone, Right hand, Right forearm, Right upper arm, Right collarbone, Upper chest, Chest, Lower back, Spine, Left shin, Left thigh, Right shin, Right thigh and Pelvis.
bail_end
Permission: events.skater.
Fires once a bail’s fall is over: when the body is up again, or 3 seconds after the fall began. It sums up what the body went through.
The body parts that hit or slid, by name. Each is a table with
impact (its impacts summed, metres per second) and slide (how far it slid, in metres). Names are those of body_hit, plus the feet and toes.launch
Permission: events.skater.
Fires for each launch of the local skater into the air: ollies, pops out of grinds, no complies and boneless, as the game made them and as they left after any plugin’s reskate.skater.shape_launch. Launches are followed from the first tick a plugin with events.skater runs, and at most 32 wait between two ticks.
The direction of travel before it, level and one long.
nil under 0.5 metres per second."applied" (shaped), "none" (no plugin shapes these launches), "slow" (too slow to tell the direction of travel) or "not_ours" (it did not go along its travel at about the skater’s speed, so across and along were left alone).Physics
physics_step
Permission: events.physics.
Fires for every physics step of the local skater, in order: several times a tick. The steps are kept from the first tick a plugin with events.physics runs, and at most the last 512 wait between two ticks. During slow motion (reskate.time.slow) more steps come each second, each of them shorter.
How the skater moves, in metres per second: with the board while on it, else as its pelvis. A list of three numbers,
{x, y, z}, not a vector. Absent when unknown.The body parts touching something in this step, by name. Each is a table with
impact (its hardest contact’s speed along the contact, metres per second), slide (that contact’s speed along the surface, metres per second), and the booleans board, vehicle and world (anything but the board and vehicles: the ground, walls, rails). Bodies only touch things while the ragdoll moves them, in a bail; riding or walking, the table is empty. Names are those of body_hit, plus Left toes, Left foot, Right toes and Right foot.Physics geometry
Permission:events.physics.geometry, which also needs events.physics in the same manifest. A manifest with the first and not the second fails to load: events.physics.geometry also needs the events.physics permission.
With it, each physics_step carries the skater’s bodies as they are in the world, for effects that start where a body hits something. Without it these fields are never there. A field ReSkate could not read is absent, never zero, so do not make a hit out of a missing one.
A number for the skater’s physics state in this step, as the game selects it. It names no game memory. Compare it between steps to see a change; it has no fixed meaning to rely on. Absent when it could not be read.
Where the body’s hardest contact in the step is, in the world:
{x, y, z}, metres. Absent when unknown.Every body of the local skater ReSkate could read, by name, airborne ones included, and whether or not it touches anything. Each is a table with
transform, a list of 16 numbers, and velocity, {x, y, z} in metres per second. The transform is the body’s place in the world as four rows of four: the body’s x, y and z axes in the first three rows, its position in the first three numbers of the fourth (transform[13], transform[14], transform[15]). Empty when none could be read.Drawing
draw
Permission: overlay.
Fires every tick, after the tick handlers, to draw this frame’s shapes. The handler gets the drawing object, and drawing works only inside it. What it draws replaces what it drew the frame before. A server copy’s drawing is never shown.
The drawing object:
d:text, d:rect, d:line, d:circle, d:poly, d:gradient, d:world_text, d:world_line, d:world_circle, d:image, d:world_image, d:game_image, d:skeleton, d:size and d:world_to_screen. See overlay.Multiplayer
player_joined
Permission: session.read.
Fires for each player who comes into the session. When you join or start one, it fires for every player already in it, you included. The game checks the session four times a second.
player_left
Permission: session.read.
Fires for each player who leaves. When you leave the session, it fires for every player in it, you included. The handler gets the same player table as player_joined.
touch
Permission: session.skaters.
Fires when your skater comes within reach of another player’s, while your plugin has touching on (reskate.session.touch). It fires once a contact: again only after the two were apart. Bodies are compared every tick.
The part of your skater nearest theirs:
"head", "body", "left_arm", "right_arm", "left_leg", "right_leg" or "board".touch_end
Permission: session.skaters.
Fires when the two are apart again: 10 cm further apart than the reach, or the player has gone (left, or is no longer drawn). The handler gets the same fields as touch, as the two were at that moment (when the player has gone, as they last touched).
message
Permission: net.session.
Fires when the same plugin on another game sends you a message with reskate.net.send: one addressed to everyone, or to you. A server copy hears those addressed to everyone or to "server".
Who sent it, as a player table (
id, name, me, host, server). For a message from the session’s authority (a server copy), server is true, and name is "Server" when the session has no name for the sender.The session says who sent a message; a plugin cannot pretend to be another player or the authority. Only a server copy’s messages arrive with
from.server set.chat
Permission: chat.read.
Fires for each new line in your chat, as you see it (filtered when you filter chat). Lines from before the first plugin listened are not delivered. At most 20 lines a tick are; older ones past that are dropped. Lines plugins add with reskate.chat.notice (tagged “Plugin”) are never delivered, to the plugin that added them or to any other, so an echo cannot loop.
sender "0", server true), its plugins’ say lines among them. It also hears a /command the server does not know itself, such as /race join, with its /. The server does not answer such a line Unknown command while a plugin hears chat, so your plugin answers the player, with reskate.server.tell. The server’s own commands (/help, /vote, /kick and the rest) never reach plugins.
poll_answer
Permission: server.
Fires in a dedicated server’s server copy when a player answers one of the plugin’s polls. The poll closes for that player; no poll_closed follows.
poll_closed
Permission: server.
Fires in a dedicated server’s server copy when one of the plugin’s polls closes for a player who did not answer it.
"timeout" (it ran out), "left" (the player left the server), "replaced" (a newer plugin poll for that player) or "closed" (reskate.server.poll_close).throwdown
Permission: throwdowns.
Fires when a throwdown starts or ends for you.
throwdown_ui
Permission: throwdowns.
Fires for what you do in the native throwdowns UI with one of the plugin’s modes (registered with reskate.throwdowns.mode): its card, setup page, start flag, waiting card and match panel. It also brings the answers of the plugin’s reskate.ui.dialog dialogs. At most 64 events wait for each plugin; past that, the oldest go.
What happened, such as
"open", "setup_row", "flag_placed", "start", "quit", "join", "panel_command" or "dialog".throwdown_ui event for every action and its args.
Input and screens
action
Permission: input.
Fires once for each press of a combo the plugin bound with reskate.input.bind, while the game itself has the input (no menu, console or text box open). When the player set their own combo for the action on the Binds page, theirs is the one that fires it.
camera_cycle
Permission: camera.
Fires when the game’s camera height button steps into or out of your plugin’s camera, while it is in the cycle with reskate.camera.cycle. Start or stop your camera then.
screen_closed
Permission: ui.screen.
Fires when the player closes the plugin’s open full-screen screen with Esc. It does not fire when the plugin closes it with reskate.ui.close.
The menu
favorites_changed
Permission: menu.
Fires when the player’s starred items change: an item starred or unstarred in the game’s item grids, or the starred items read for the first time after the plugin started. It is checked once a tick. The handler gets no arguments: read the set again with reskate.menu.favorites, a table of item keys, each true.
What the set was when ReSkate first looked is not a change. A plugin that starts after the starred items were read hears nothing until the next change, so read them when it loads too.
menu_changed
Permission: menu.
Fires when what is up over the game changes: the game’s pause menu, ReSkate’s menu or the replay editor coming up or going, the ReSkate page the pause menu shows, or whether the game’s screens could be read (known). It is checked once a tick, and fires once for each change.
What was up when ReSkate first looked is not a change. A plugin that starts while a menu is up hears nothing until the next change, so read
reskate.menu.state() when it loads.
Music
track_changed
Permission: music.
Fires when the song in your outside music player (Spotify and the like) changes. It is checked once a second.
album; reskate.music.current() gives it.