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.
This commit is contained in:
AyeZeeBB committed 2026-10-19 12:43:44 -05:00
1 parent 373c141381
commit f37abef426
13 files changed
+333 -15

No files matched your search

+14
View File
@@ -1,6 +1,7 @@
#include "plugin_host.h"
#include "plugin_api.h"
#include "Engine/Core/Console/console_core.h"
#include <algorithm>
#include <format>
#include <utility>
@@ -130,6 +131,19 @@ void Host::set_level(std::string level) {
}
}
void Host::trick(const TrickNews& news) {
for (auto& [id, entry] : entries_) {
if (!entry.plugin || !entry.plugin->has("events.tricks")) continue;
entry.plugin->trick(news);
collect(entry);
}
}
bool Host::wants_tricks() const {
return std::any_of(entries_.begin(), entries_.end(),
[](const auto& item) { return item.second.plugin && item.second.plugin->has("events.tricks"); });
}
bool Host::run_console(std::string_view text) {
if (commands_.empty()) return false;
const auto parsed = parse_console_command(text);