Files
ReSkate/Server/server_parks.h
T
Robin MöllerandClaude Opus 5.5 6909fe3a2e 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
2026-10-11 17:45:49 +00:00

25 lines
1.2 KiB
C++

#pragma once
#include "server_config.h"
#include "Engine/Game/World/network_objects.h"
#include <filesystem>
#include <string>
#include <vector>
// Park mods on a dedicated server: parks built in the Park Editor and shipped as mods
// (<Mods>\<folder>\parks\<key>.park.json, as Extension/Objects/ParkEditor/park_mods.h writes
// them), spawned for everyone as objects the server owns (server_parks.cpp).
namespace dingosdk::server {
inline constexpr std::size_t max_park_file_bytes = 2 * 1024 * 1024;
struct LoadedPark {
std::string key; // the base map's park it is (bam...)
// Numbered 1, 2... in the file's order; the server gives them IDs of its own when spawned.
std::vector<NetworkObject> objects;
// Objects players' games would not take (multiplayer::valid_network_object): not Build Kit
// items, or a broken position, rotation or scale. "#<n> <item>", n counting from 1.
std::vector<std::string> skipped;
};
// Reads `park` from the mods folder. Throws std::runtime_error saying what is wrong: no such
// folder or file, not a ReSkate park, no objects players' games can show.
LoadedPark load_park_mod(const std::filesystem::path &mods, const ParkMod &park);
} // namespace dingosdk::server