mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-27 02:46:41 +01:00
Dedicated server: park mods as server-owned objects
- maps.park_mods binds a Park Editor park mod (Mods/<folder>/parks/<key>.park.json) to a name and the map it was built on; maps.park_limits caps the parks and objects spawned at once (3 and 512 by default) - park-mod list | add <name> [<name>...] [minutes] | remove <name> [<name>...] | clear, from the console, as /park-mod by admins, and by players through custom votes - A spawned park is the layout of the server's own SteamID and epoch, sent like a player's: games since 1.0.0 already show it, it counts against no player's object limit, nobody can move or delete it, and it stays when players leave - Objects players' games would not take (not Build Kit items, broken values) are skipped and logged; a missing or broken park is an error line when spawning - Optional expiry (1-1440 min) with a warning in chat a minute before; every park goes on a map change and none survive a restart - [parks] log lines name who did it: console, the admin, or "a vote"; a vote's refusal reaches chat - park-mod is reserved for custom commands; README.txt documents the settings, commands and a park/unpark vote Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2G4APEkhHgVs59RDL3XWD
This commit is contained in:
1 parent
f4292d6b73
commit
6909fe3a2e
13 files changed
+517
-6
No files matched your search
@@ -871,7 +871,9 @@ void Host::change_map(std::string_view map) {
|
||||
if (!valid_map_destination(map_destination(map_setting(map))))
|
||||
throw std::invalid_argument("That map does not name a destination.");
|
||||
if (!installed_map(map)) throw std::invalid_argument("This server does not have that map.");
|
||||
// Everything tied to the old world goes; admission and player slots stay.
|
||||
// Everything tied to the old world goes; admission and player slots stay. Park mods only fit
|
||||
// the map they were built on.
|
||||
remove_parks("map change");
|
||||
for (auto &[id, guest] : guests_) {
|
||||
auto &g = *guest;
|
||||
auto old = std::exchange(g, Guest{});
|
||||
@@ -1453,6 +1455,8 @@ void Host::sync_objects() {
|
||||
std::vector<Source> sources;
|
||||
for (const auto &[id, guest] : guests_)
|
||||
if (guest->handshaken && guest->world_ready) sources.push_back({id, guest->member.epoch, &guest->shared});
|
||||
// The spawned park mods: the server's own layout, sent like a player's.
|
||||
if (park_objects_.revision()) sources.push_back({id_, epoch_, &park_objects_});
|
||||
for (auto &[id, guest] : guests_) {
|
||||
auto &peer = *guest;
|
||||
if (!peer.handshaken || !peer.world_ready || sources.empty()) continue;
|
||||
@@ -1839,6 +1843,7 @@ void Host::tick(std::uint64_t now) {
|
||||
travel_started_ = 0;
|
||||
log_("Everyone has loaded " + map_name() + ".");
|
||||
}
|
||||
tick_parks();
|
||||
sync_objects();
|
||||
activity_.tick(now_);
|
||||
if (std::exchange(vote_recount_, false)) check_vote(false);
|
||||
|
||||
Reference in new issue
Block a user