Files
ReSkate/Extension/Plugins/plugin_runtime.h
T
AyeZeeBB f37abef426 Plugins: trick events (trick_started, trick_landed, line_broken) and reskate.score.current
- With events.tricks a plugin hears the local skater's tricks: trick_started (where), trick_landed
  (points, multiplier, where it started and landed, how long it took) and line_broken (a slam or
  a wipeout); reskate.score.current() is the score HUD's line, multiplier and whether a trick is
  going on. Without the permission the events cannot be registered.
- The score HUD is read into the trick watch (Extension/Skater/score_hud.h, trick_watch.h) on the
  client tick only while a running plugin has events.tricks; a new level starts a new line.
  plugins::start takes the image base for it.
- reskate-test has a tricks module (skipped until a trick lands) and ptest trick, which waits 30 s
  for one and prints what its events said; reskate-hostile has trick-loop.

Not yet checked against real tricks in game.
2026-10-19 12:43:44 -05:00

28 lines
1.2 KiB
C++

#pragma once
#include <cstdint>
#include <string>
#include <string_view>
// Plugins in the game (Extension/Plugins): Luau scripts in mods, each in its own sandboxed VM
// (plugin_vm.h), run on the client tick. A thread looks for plugins every 2 s, so a mod switched
// on or off, or a plugin's files changed, takes effect without a restart.
//
// Every function but start is for the client thread, the one that runs console commands.
namespace dingosdk::plugins {
// Once, at startup, with the game's image base (the score HUD is read from it). Plugins load at the
// first client tick after discovery finds them.
bool start(std::uintptr_t image_base) noexcept;
void on_client_tick() noexcept;
// The level being played, or empty without one: plugins hear level_loaded and level_unloading.
void set_level(std::string_view level) noexcept;
// Runs a plugin's console command when the text starts with one. False when none matched, and
// the text goes to ReSkate's own commands.
bool run_console(const std::string& text) noexcept;
// The `plugin` console commands.
std::string describe();
std::string list_commands();
std::string reload(std::string_view id);
std::string switch_off(std::string_view id);
std::string switch_on(std::string_view id);
}