Plugins: board.parameters reads the board's shader values, and set_parameter holds its colours and numbers

Each part of the local board (deck, grip, trucks, wheels) has a material instance with a few
shader values of its own, found in the running game. reskate.board.parameters lists them by key
and type. set_parameter holds a colour or a number there each tick, published until it shows, and
the board's own value comes back when the plugin lets go or stops. Integers and switches pick how
the board is drawn, the store's foil looks among them, so plugins only read those. Only your own
screen changes.
This commit is contained in:
AyeZeeBB committed 2026-10-22 20:17:09 -05:00
1 parent 1671403500
commit e35e33d66d
10 files changed
+847 -1

No files matched your search

+21
View File
@@ -18,6 +18,7 @@
#include "Extension/Skater/skater_events.h"
#include "Extension/Skater/outfit_overlay.h"
#include "Extension/Skater/board_pose.h"
#include "Extension/Customization/board_material.h"
#include "Engine/Vfs/mod_catalog.h"
#include "Engine/Core/Log/logging.h"
#include <mutex>
@@ -518,6 +519,24 @@ public:
if (!fit) return board_pose::fit(plugin, std::nullopt);
return board_pose::fit(plugin, board_pose::Fit{fit->plates, fit->axle});
}
std::optional<std::vector<BoardParameter>> board_parameters(int part) override {
const auto found = board_material::read(static_cast<board_material::Part>(part));
if (!found) return std::nullopt;
std::vector<BoardParameter> out;
for (const auto& p : *found) {
using board_material::Kind;
const char* type = p.kind == Kind::colour ? "colour" : p.kind == Kind::number ? "number" : p.kind == Kind::integer ? "integer"
: p.kind == Kind::toggle ? "switch" : "other";
out.push_back({p.key, type, p.value, p.integer});
}
return out;
}
std::string board_set_parameter(std::string_view plugin, int part, std::uint64_t key, std::array<float, 3> value, bool colour) override {
return board_material::set(plugin, static_cast<board_material::Part>(part), key, value, colour);
}
void board_clear_parameter(std::string_view plugin, int part, std::optional<std::uint64_t> key) override {
board_material::clear(plugin, part < 0 ? std::nullopt : std::optional(static_cast<board_material::Part>(part)), key);
}
// ---- variants ------------------------------------------------------------------------------------
// The mod's folder is read again at most every 2 s: a menu page asks every frame.
std::optional<VariantState> variants(std::string_view plugin, const std::filesystem::path& package) override {
@@ -1154,6 +1173,7 @@ public:
launches::tick(client);
outfit_overlay::tick();
board_pose::tick(base, local_skater_component(base, client));
board_material::tick(base, client);
const bool allowed = !multiplayer::local_throwdown_active();
const auto component = local_skater_component(base, client);
skater_animation::tick(base, component, allowed);
@@ -1651,6 +1671,7 @@ public:
board_pose::clear(plugin);
board_pose::park(plugin, {});
(void)board_pose::fit(plugin, std::nullopt);
board_material::clear(plugin);
cancel_throwdown(plugin);
multiplayer::custom_throwdowns::remove_plugin(plugin);
if (capturer_ == plugin) capturer_.clear();