mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-25 07:14:41 +01:00
config in sections
Server config: - Written in sections, in reading order: server, access, maps, players, anti_cheat, network, votes. A config from an older version, flat and under older names, is read as it is and written back this way on first start; only settings that are really new are reported as new. - Renamed: no_bail, noclip, boosts, parties, voice_chat to allow_*; global_bans to use_global_bans; welcome to welcome_message; speed_check to speed_hack; score_check to modified_scoring; score_allow to allowed_scoring_mods; map_pool and map_rotation_minutes to maps.pool and maps.rotation_minutes. Console and admin commands are unchanged. - Bans are kept in data/bans.json beside the config. A config that holds them has them moved there; a bans file that cannot be read stops the server from starting. - Reserved slots are one list, "reserved_players_slots": a slot is kept for each listed player who is not on. "reserved_slots" and the "reserved slots <n>" command are gone; admins may take a kept slot but none is kept for them. - "tps" is no longer in the file: dedicated servers run at 20. - "bone_scale_limit" is 1 by default: resized body parts are off unless a server allows them. - New: "pack_ms" (10), how long Steam may hold a message to pack it with others; "finger_distance" (25); "steam_debug", which logs what Steam's networking says, for connection faults.
This commit is contained in:
1 parent
38d86e1b72
commit
2833ab1f88
9 files changed
+531
-384
No files matched your search
+14
-20
@@ -149,19 +149,18 @@ bool Host::start(std::string &error) {
|
||||
return false;
|
||||
}
|
||||
direct_port_ = 0;
|
||||
if (config_.connection == "direct") {
|
||||
const auto port = config_.direct_port ? config_.direct_port : config_.port;
|
||||
if (!config_.use_steam_relay) {
|
||||
const auto port = config_.port;
|
||||
if (transport_.listen_direct(port)) {
|
||||
direct_port_ = port;
|
||||
log_("Connection: direct, on UDP port " + std::to_string(port) +
|
||||
(config_.direct_address.empty() ? std::string{} : " at " + config_.direct_address) +
|
||||
". The port must be open to the internet; players it does not reach come through Steam's relays.");
|
||||
} else {
|
||||
log_("Connection: direct was asked for, but Steam could not listen on UDP port " + std::to_string(port) +
|
||||
" (in use, or not allowed here). Players connect through Steam's relays only.");
|
||||
}
|
||||
} else {
|
||||
log_("Connection: through Steam's relays (\"connection\": \"direct\" lets players connect straight to the server).");
|
||||
log_("Connection: through Steam's relays (\"use_steam_relay\": false lets players connect straight to the server).");
|
||||
}
|
||||
id_ = transport_.status().local_id;
|
||||
secret_ = nonce();
|
||||
@@ -412,7 +411,7 @@ void Host::broadcast(const Packet &packet, bool reliable, bool fresh, std::uint6
|
||||
if (distance > p.crowd.half || (config_.distances.valid() && distance > reach * reach)) continue;
|
||||
}
|
||||
// Frequent gameplay streams skip the server once the receiver confirms a direct route.
|
||||
if (source && !config_.relay_everything && (packet.kind == PacketKind::pose || packet.kind == PacketKind::audio) &&
|
||||
if (source && (packet.kind == PacketKind::pose || packet.kind == PacketKind::audio) &&
|
||||
!needs_relay(p.direct_routes, p.route_reported, source->member, now_))
|
||||
continue;
|
||||
// Sound is sent with everyone else's they hear, once a pass (flush_poses).
|
||||
@@ -1399,7 +1398,9 @@ void Host::tick(std::uint64_t now) {
|
||||
continue;
|
||||
}
|
||||
if (!guest) {
|
||||
if (!individual_steam_id(link.id) || !may_join(config_, link.id, guests_.size())) {
|
||||
const auto reserved_on = static_cast<std::size_t>(std::count_if(
|
||||
config_.reserved.begin(), config_.reserved.end(), [&](std::uint64_t id) { return guests_.contains(id); }));
|
||||
if (!individual_steam_id(link.id) || !may_join(config_, link.id, guests_.size(), reserved_on)) {
|
||||
// Full for them: for everyone, or with only the reserved slots left.
|
||||
transport_.disconnect(link.id, guests_.size() >= config_.max_players || !individual_steam_id(link.id)
|
||||
? "The server is full."
|
||||
@@ -2113,34 +2114,27 @@ std::string Host::command(std::string_view line, std::uint64_t admin) {
|
||||
(config_.world_layer_sync ? "." : ". Turn on layer-sync to apply it to everyone."));
|
||||
}
|
||||
if (name == "reserved") {
|
||||
// reserved | reserved slots <n> | reserved add|remove <player or SteamID64>
|
||||
// reserved | reserved add|remove <player or SteamID64>
|
||||
if (!console) return "Only the server console manages reserved slots.";
|
||||
const auto [sub, who] = split(argument);
|
||||
if (sub.empty()) {
|
||||
std::string text = std::to_string(config_.reserved_slots) + " of " + std::to_string(config_.max_players) +
|
||||
" slots are reserved for " + std::to_string(config_.reserved.size()) + " players and the admins";
|
||||
std::string text = std::to_string(config_.reserved.size()) + " of " + std::to_string(config_.max_players) +
|
||||
" slots are reserved, one for each of these players while they are not on";
|
||||
for (const auto id : config_.reserved) {
|
||||
const auto *guest = find(id);
|
||||
text += "\n " + std::to_string(id) + (guest ? " " + guest_name(*guest) : std::string{});
|
||||
}
|
||||
return text;
|
||||
}
|
||||
if (sub == "slots") {
|
||||
const auto slots = number(who);
|
||||
if (!slots || *slots >= config_.max_players) return "reserved slots <0-" + std::to_string(config_.max_players - 1) + ">";
|
||||
config_.reserved_slots = static_cast<unsigned>(*slots);
|
||||
return changed(*slots ? std::to_string(*slots) + " slots are kept for reserved players and admins."
|
||||
: std::string("No slots are reserved."));
|
||||
}
|
||||
auto *guest = target(who);
|
||||
const auto id = guest ? guest->member.id : number(who).value_or(0);
|
||||
if (!individual_steam_id(id) || (sub != "add" && sub != "remove")) return "reserved | reserved slots <n> | reserved add|remove <player or SteamID64>";
|
||||
if (!individual_steam_id(id) || (sub != "add" && sub != "remove")) return "reserved | reserved add|remove <player or SteamID64>";
|
||||
const bool listed = std::find(config_.reserved.begin(), config_.reserved.end(), id) != config_.reserved.end();
|
||||
if (sub == "add") {
|
||||
if (!listed && config_.reserved.size() >= 1024) return "The reserved list is full.";
|
||||
if (!listed && config_.reserved.size() + 1 >= config_.max_players)
|
||||
return "Every slot but one is reserved already: a slot is kept for each reserved player.";
|
||||
if (!listed) config_.reserved.push_back(id);
|
||||
return changed(std::to_string(id) + " has a reserved slot." +
|
||||
(config_.reserved_slots ? std::string{} : " No slots are reserved yet: reserved slots <n>."));
|
||||
return changed(std::to_string(id) + " has a reserved slot.");
|
||||
}
|
||||
std::erase(config_.reserved, id);
|
||||
return changed(std::to_string(id) + " no longer has a reserved slot.");
|
||||
|
||||
Reference in new issue
Block a user