reskate.session, which needs session.read), other players’ skaters, touching them, hiding them or some of their items, and rays at them (session.skaters), tags beside their nametags (session.nametags), their voice volume (voice.control), and messages between the copies of your plugin on every player’s game (reskate.net.send and the message event, which need net.session). See permissions.
Players
A player is a table:
Every function that takes a player reads it the same way, as one of these:
- a player table, such as
reskate.session.players()gives, read by itsid; - a player’s id as a string of digits and nothing else, such as
"76561197960287930"; - a whole number, but only while a Lua number holds it exactly (below 2^53).
a Steam ID is a string: a number cannot hold one exactly. Anything else that is not a player raises an error too: "123abc", "", " 1", "+1", "0" and 0.
The session is read four times a second, so a player who just joined may take up to a quarter of a second to appear. The player_joined and player_left events (they need session.read) say who came and went; see events.
reskate.session.active()
reskate.session.is_dedicated()
true when the session is on a dedicated server, false in a player’s lobby or outside a session.reskate.session.players()
Everyone in the session, the local player first.
reskate.session.me()
reskate.session.host()
active, is_dedicated, players, me and host need session.read.active and is_dedicated are true, players lists the players on the server, and me and host are nil: the server is none of them.
Spectating and the world
reskate.session.spectate(player)
Watches a session player’s skater with the game’s Spectate camera, as the party menu’s Spectate does, or stops watching.
A player, as players says: their id (
"7656...") or a player table. nil, nothing, "0" or 0 stops a Spectate started this way.player that is none of those raises an error. Pass the id as a string or a player table: a Lua number cannot hold a SteamID64 exactly.
Needs
session.read. Spectate takes the camera from a plugin’s view while it runs (see camera). A Spectate started with spectate or camera.follow is the same one: stopping either way ends it. It does not end when your plugin stops: stop it in an unload handler.reskate.session.world()
The world the local player is in, for a game mode that matches players in the same world.
Needs
session.read. On a dedicated server, a server copy gets the server’s own world and the name of the map it runs, and barred is false.Other players’ skaters
reskate.session.skaters()
Where the other players’ skaters are, as the session last heard. The local skater is not in it: use reskate.skater.get.
A list of tables:
id(string): the player’s id.position(vector): the skater’s position, in world metres.heading(number): the way it faces, in radians, as the local skater’s heading.age_ms(number): how old that pose is, in milliseconds.
Needs
session.skaters.skaters lists every player in the world who has sent a pose, from the poses the server has: the server has no skater of its own. A server copy can follow players with it, for checkpoints or a game of tag, without trusting what each player’s copy reports. age_ms grows while a player sends no poses (in a menu, or gone quiet). On a lobby’s host, the server copy gets the host’s own view, as its client copy does.
reskate.session.joint(player, joint)
Where one of another player’s joints is in the world, as your game draws their skater.
A joint, as
reskate.skater.joint takes it: 0 to 394, or "right_hand", "left_hand", "head", "hips" or "spine".{position, rotation, scale}, as reskate.skater.joint gives it. nil while your game does not draw that player, and on the first call: asking keeps the joint read for 2 seconds, so call it every tick. At most 64 joints of other players are read at once, for every plugin together.Needs
session.skaters. A player that is not a player’s id, or a joint that is not one of those, raises an error.reskate.session.tag(player, text, colour)
Puts a short tag beside a player’s nametag, or takes yours away. Only this player sees it: it changes nothing on anyone else’s game.
Needs
session.nametags. Raises an error for a player that is not one, text over 16 characters or not printable, and a colour that is not a whole number from 0 to 0xFFFFFFFF. When several plugins tag the same player, one tag shows. Your tags go away when your plugin stops.reskate.session.nametags(shown)
Holds the names over the other players off on your screen, or gives them back: for a camera that films, say. Chat bubbles still show.
Returns nothing.
Needs
session.nametags. The names stay off while any plugin holds them off. When the plugin stops, its hold is let go. A shown that is not a boolean raises an error.Touching, hiding and rays at players
For tag, infection or prop hunt: when your skater touches another player’s, another player’s skater hidden on your screen, and a ray that hits players. Each skater’s body is a set of capsules around its parts, as your game draws it:"head", "body" (hips to neck), "left_arm", "right_arm" (shoulder to hand), "left_leg", "right_leg" (hip to foot) and "board" (the deck, while it is drawn). Your own skater’s body is read each time your pose is sent to the other players, and moves with your skater in between. Bodies are read only in a multiplayer session, and only while a plugin uses them: the first tick or two after you start, nothing is touched or hit.
Each game sees its own skater’s touches. To tell everyone, send a message: the player you touched hears it on their game too.
reskate.session.touch(on, reach)
Turns the touch and touch_end events on or off for your plugin.
True (or nothing) to hear touches. False stops them:
touching is empty again, and no touch_end fires for the players touched then.How near counts as touching, in metres between the two bodies’ surfaces: 0 to 1. Calling it again while on changes the reach.
Needs
session.skaters. A reach that is not 0 to 1 raises an error. At most 64 players are touched at once: past that, a touch waits until one of them is apart.reskate.session.touching()
The players your skater touches now, while touching is on.
A list of tables, as the
touch event gives them:player(string): the player’s id.part(string): the part of your skater nearest theirs.their_part(string): the part of their skater nearest yours.distance(number): the gap between the two parts, in metres: 0 where they overlap.position(vector): the point halfway across that gap, in the world.
Needs
session.skaters. Empty while touching is off.reskate.session.hide(player, hidden)
Hides another player’s skater on your screen, or shows it again. Only your game changes: they still see themselves, and everyone else still sees them.
While hidden, their skater and board are not drawn, their sounds do not play, their nametag and their marker on the map are gone, they cannot be spectated, and they are not solid to your skater. Their body is still there for touch and raycast.
True (or nothing) hides them; false shows them again.
Needs
session.skaters. A player stays hidden while any plugin hides them. Your plugin’s go when it stops.reskate.session.hidden()
Needs
session.skaters.reskate.session.raycast(from, to, options)
The first other player’s body a ray meets. Your own skater is never hit; hidden players are.
True: the world blocks the ray, as
reskate.world.raycast meets it. Anything it meets more than 0.4 m before the player blocks (closer than that, the player’s own collision can be what it meets). False: the ray goes through the world.nil when no player is hit, or the world is in the way. Otherwise:player(string): the player’s id.part(string): the part hit, one of the parts above.position(vector): where the ray meets the part’s surface.distance(number): how far that is fromfrom, in metres.
Needs
session.skaters, and no world.raycast. Each call counts towards the 64 raycasts a tick, with reskate.world.raycast’s. A ray longer than 1000 m, or a raycast past those 64, raises an error. Collision is loaded only near your skater, so far from it the world does not block.Other players’ items
What another player wears, and items of theirs your game does not show. Withreskate.mods.item_origins (which mod an item comes from) and reskate.outfit.stand_ins (what shows in its place), a plugin can hide every item of one mod, or every mod item on one player. The rules, and the menu to choose them, are your plugin’s.
reskate.session.outfit(player)
The items another player wears, as their game sent them.
nil before their outfit has arrived, for a player not in the session, and for the local player (read yours with reskate.outfit).reskate.mods.item_origins takes. An item your game does not have is in the list all the same: it is what they wear, not what your game shows. Paid store items are left out: your game never shows them on another player.
Needs
session.read. A player that is not a player’s id raises an error.reskate.session.hide_items(lists)
Items not to show on other players, on your screen. A hidden item shows the way an item your game does not have does: a plugin’s stand-in, the slot’s default, or nothing. Only your game changes: nothing is sent, and nobody else sees a difference.
Your plugin’s whole list, which replaces the one before.
nil (or empty lists) shows them all again.Needs
session.skaters. It shares 4 calls a second with reskate.outfit.set, reskate.outfit.stand_ins and the other control calls (see shared budgets); a call with the same lists still counts. At most 4096 names in all and 64 players; each name 1 to 255 characters. A list that is not a list of names, a players not keyed by player ids, or more than those raises an error. Your plugin’s list goes when it stops.Voice
reskate.voice.set_volume(player, volume)
Sets how loud a player’s voice chat is for the local player. It changes only what this player hears.
Why not, when
ok is false: “more than 10 changes in a second”, or the session’s own answer when it refused.Needs
voice.control. At most 10 changes a second; past them it returns false and why. Raises an error for a player that is not one, and a volume outside 0 to 10.Messages
Your plugin talks to the copies of itself on the other players’ games, and to its server copy, withreskate.net.send. Messages go only to the same plugin: two copies are the same plugin when their manifest.json gives the same name (case does not matter), whatever their folders are called. A plugin with no name in its manifest.json uses its folder’s name.
The session says who sent a message: a plugin cannot pretend to be another player, or the server.
reskate.net.send(to, message)
Sends a message.
Who gets it:
"all": every other player’s copy (and the server copy).- a player, or a player’s id: that player’s copy only.
"server": the plugin’s server copy only: on the lobby’s host, or on the dedicated server. A server copy cannot send to"server": it is the server.
Needs
net.session. A message is at most 4082 bytes, and a plugin sends at most 16 KB a second (each message counts 14 bytes more for its header). Raises an error past those, for to that is not "all", "server", a player or a player’s id, for "server" from a server copy, and for a message that is not a string or a buffer.The message event
net.session.
fromis the player who sent it. A message from the server copy hasfrom.server == true; itsnameis the host’s, or"Server"on a dedicated server.messageis always a string, even when it was sent as a buffer: usebuffer.fromstringto read it as one.