mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-24 00:35:59 +02:00
Plugins: server plugins know the map and hear it change
On a dedicated server reskate.level.current() was empty and level_loaded and level_unloading never fired, so a server plugin could not tell which map ran or that it had changed. The server's plugins are now told the map's level each tick, named as players' games name it (a destination's level, after its "|"). When the server changes the map, they hear level_unloading for the old one and level_loaded for the new one, as a game's plugins do; players load it after. dingosdk_server_plugin_tests checks level.current() and both events across a map change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hs7xxJDf6SDcQUaXnzmtL5
This commit is contained in:
1 parent
45d4c64c75
commit
fd5f95467f
4 files changed
+36
No files matched your search
@@ -210,6 +210,9 @@ void ServerPlugins::tick(std::uint64_t now_us) {
|
||||
}
|
||||
const double dt = s.last_tick ? static_cast<double>(now_us - s.last_tick) / 1000.0 : 0;
|
||||
s.last_tick = now_us;
|
||||
// The map the server runs, so plugins hear level_unloading and level_loaded when it
|
||||
// changes, as a game's plugins do (when the server changes it; players load it after).
|
||||
s.plugins.set_level(s.server.map_level());
|
||||
s.plugins.tick(dt);
|
||||
for (auto &bytes : std::exchange(s.environment.outbox, {})) s.server.send_plugin_message(wire::to_of(bytes), bytes);
|
||||
} catch (const std::exception &error) {
|
||||
|
||||
Reference in new issue
Block a user