Files
ReSkate/Server/server_plugins.h
T
AyeZeeBB 2d3b77701d Plugins: drone, Board Break and Road Rash are plugin mods now; their C++ is gone
The three features are Lua plugins in contrib/plugins (fpv-drone, board-break,
road-rash), built on what this adds to the plugin API: flight input, gamepad and
joystick reads with input capture, a rolled camera, a package's own sounds and a
synthesised motor (plugin_sound, plugin_wave, motor_synth), the skater's physics
events (skater_events), items worn over the outfit (outfit_overlay, skater_items),
the board's bones (board_pose), skater animation (anim_core), plugin images,
throwdowns started for chosen players, and server copies of plugins on a lobby
host and the dedicated server (server_plugins).

Removed from core: Extension/RoadRash, Extension/BoardBreak, the drone's flight,
radio, follow, OSD, beacon, outfit and sound code, its prop models (native_prop),
the DRONE, BOARD BREAK and ROAD RASH menu pages, home tiles and native menu rows,
their console commands, the drone follow debug action, the drone marker packet
(kind 36 stays unused; the roster keeps its byte) and the server's drones setting.

Kept in core, since every board needs it whichever plugins run: the breakable
deck packs (breakable_deck: which deck, its label and wheel spacing, the
boarddeck command and the BREAKABLE DECK card on the Mods page), and board_pose
keeping a deck pack's stretches out of sight, the baseplates on the deck and the
wheels at the deck's spacing on every board.
2026-10-19 16:22:15 -05:00

40 lines
1.5 KiB
C++

#pragma once
#include <cstdint>
#include <filesystem>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
// Plugins' server copies on a dedicated server (Extension/Plugins): the session's authority, where
// a game mode's rules run. The operator installs them in Plugins beside the server, a folder a
// plugin (with its reskate-plugin.json, "side" "server" or "both"); they load, reload and unload as
// the folder changes, checked every 2 s. The server has no game: what a plugin may do here is the
// session's messages, its players, the server API (kick, say, tell, move) and its storage.
// Everything here runs on the server's tick thread.
namespace dingosdk::server {
class Host;
class ServerPlugins {
public:
using Log = std::function<void(const std::string &)>;
ServerPlugins(Host &host, std::filesystem::path folder, std::filesystem::path storage, Log log);
~ServerPlugins();
ServerPlugins(const ServerPlugins &) = delete;
ServerPlugins &operator=(const ServerPlugins &) = delete;
void tick(std::uint64_t now_us);
// A player's plugin message (plugin_wire.h): for the authority, or for everyone.
void receive(std::uint64_t from, const std::vector<std::uint8_t> &bytes);
// A console line for the plugins: "plugin list|reload|off|on" or a plugin's own command.
// Empty when it is neither.
std::optional<std::string> command(std::string_view line);
private:
struct State;
std::unique_ptr<State> state_;
};
} // namespace dingosdk::server