Throwdowns: the throwdown kit, so a mode is a plugin and the SDK knows no particular mode

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.
This commit is contained in:
AyeZeeBB committed 2026-10-20 01:04:54 -05:00
1 parent e14064250c
commit 8444553402
186 files changed
+28015 -2747

No files matched your search

+11 -2
View File
@@ -17,14 +17,15 @@ namespace {
struct Event {
std::string_view name, permission;
};
constexpr std::array<Event, 25> events{{
constexpr std::array<Event, 26> events{{
{"load", {}}, {"unload", {}}, {"tick", {}}, {"level_loaded", {}}, {"level_unloading", {}},
{"trick_started", "events.tricks"}, {"trick_landed", "events.tricks"}, {"line_broken", "events.tricks"},
{"draw", "overlay"}, {"player_joined", "session.read"}, {"player_left", "session.read"}, {"message", "net.session"},
{"skater_state", "events.skater"}, {"bail", "events.skater"}, {"chat", "chat.read"}, {"track_changed", "music"},
{"throwdown", "throwdowns"}, {"action", "input"}, {"screen_closed", "ui.screen"},
{"board_landed", "events.skater"}, {"body_hit", "events.skater"}, {"bail_end", "events.skater"},
{"physics_step", "events.physics"}, {"grind_exit", "events.skater"}, {"throwdown_mode", "throwdowns"},
{"physics_step", "events.physics"}, {"grind_exit", "events.skater"}, {"trick_notes", "events.tricks"},
{"throwdown_ui", "throwdowns"},
}};
constexpr std::size_t maximum_key = 128;
constexpr std::size_t maximum_command = 48;
@@ -82,6 +83,12 @@ Json to_json(lua_State* L, int index, int depth, Budget& budget) {
budget.spend(0, length);
return std::string(text, length);
}
case LUA_TVECTOR: { // a position: [x, y, z]
const float* v = lua_tovector(L, index);
if (!std::isfinite(v[0]) || !std::isfinite(v[1]) || !std::isfinite(v[2])) throw std::runtime_error("JSON has no NaN or infinity");
budget.spend(3, 0);
return Json::array({static_cast<double>(v[0]), static_cast<double>(v[1]), static_cast<double>(v[2])});
}
case LUA_TTABLE: {
luaL_checkstack(L, 4, "tables nested too deep");
const int length = lua_objlen(L, index);
@@ -676,6 +683,8 @@ void Api::install(Plugin& plugin, lua_State* L) {
install_ui_api(plugin, L);
install_more_api(plugin, L);
install_world_api(plugin, L);
install_services_api(plugin, L);
install_kit_api(plugin, L);
readonly();
lua_setglobal(L, "reskate");
lua_pushcfunction(L, ApiFunctions::print, "print");