mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-24 07:26:13 +02:00
Plugins register modes (card, replaces, order, flag, players) and publish documents through reskate.throwdowns.ui: the setup page, the waiting card, HUD slots themed on the game's HUD_<theme>_* widgets, the match panel, flags and match restrictions. SmokeyDawg58's native plumbing (throwdown_menu.cpp and its .inl files) renders them and posts throwdown_ui events back. kit::flag is the one native flag registration. General services added for it: reskate.files, reskate.ui.dialog, reskate.skater push/hold/bone_cam, reskate.camera.pad_flight, reskate.physics competition, reskate.session.world, reskate.tricks feed/gesture, and world entities. His ten modes are now Lua in his plugin: the rules, referee and wire (td/rules, referee, wire), and every page and HUD document (td/ui*.lua). Extension/Modes and reskate.modes are gone, along with every race and 1-UP branch in the SDK. The plugin test drives each mode through kit events. A native setup page is never written to while it closes into flag placement: its rows are not republished, the stock page is put back once the exit is over, and the stock Players slider is left alone while a plugin flag is out. This fixes the crashes on the Deathrace button and on 1-UP's Confirm.
35 lines
2.0 KiB
C++
35 lines
2.0 KiB
C++
#pragma once
|
|
#include "plugin_vm.h"
|
|
|
|
// Inside the plugin host only: the reskate API a plugin's VM gets.
|
|
namespace dingosdk::plugins {
|
|
struct Api {
|
|
// The `reskate` table, `print` and `require`, before the VM is sandboxed.
|
|
static void install(Plugin& plugin, lua_State* L);
|
|
};
|
|
// The overlay, menu, sound, mods, session and message parts of the API (plugin_api_ui.cpp), into
|
|
// the reskate table on top of the stack.
|
|
void install_ui_api(Plugin& plugin, lua_State* L);
|
|
// Phase 3's parts of the API (plugin_api_more.cpp), into the reskate table on top of the stack.
|
|
void install_more_api(Plugin& plugin, lua_State* L);
|
|
// The wider set's game parts (plugin_api_world.cpp), into the same table.
|
|
void install_world_api(Plugin& plugin, lua_State* L);
|
|
// General services for a game layer: the skater's telemetry and Bone Cam, the pad and keys, the
|
|
// free and pad-flown cameras, the session's world, competition physics and the trick feed
|
|
// (plugin_api_services.cpp).
|
|
void install_services_api(Plugin& plugin, lua_State* L);
|
|
// The throwdown kit's documents and native flag, the plugin's data files, overlay dialogs and the
|
|
// skater's push (with its wait and reset) and hold (plugin_api_throwdowns.cpp).
|
|
void install_kit_api(Plugin& plugin, lua_State* L);
|
|
// A player as plugins get one: {id = "<SteamID64>", name, me, host}.
|
|
void push_player(lua_State* L, const SessionPlayer& player);
|
|
// A file's bytes when it is a regular file no larger than `most`; otherwise empty, and `error`
|
|
// says why ("not found" when there is none).
|
|
std::string read_package_file(const std::filesystem::path& file, std::size_t most, std::string& error);
|
|
// A file of the plugin's own package by its path there; a Lua error for one outside it.
|
|
std::filesystem::path package_file(lua_State* L, Plugin& plugin, std::string_view path);
|
|
// JSON and Lua values, both ways. Throws std::runtime_error on a value JSON cannot hold.
|
|
Json lua_to_json(lua_State* L, int index);
|
|
void push_json(lua_State* L, const Json& value);
|
|
}
|