Add identity-safe player moderation runtimes for T5 and T6
This commit is contained in:
+11
-2
@@ -1,7 +1,7 @@
|
||||
# TWS T5 Zombies scripts
|
||||
|
||||
Custom HUD + AFK toggle + immediate join + lobby lock + game telemetry + map records for Plutonium T5
|
||||
(Black Ops 1) zombies dedicated servers. Split across eight `.gsc` files,
|
||||
(Black Ops 1) zombies dedicated servers. Split across nine `.gsc` files,
|
||||
with `tws_t5_common` as the shared hub. Lobby lock also requires the HUD module.
|
||||
|
||||
Platform quirks and deploy commands: [NOTES.md](NOTES.md).
|
||||
@@ -18,10 +18,13 @@ Platform quirks and deploy commands: [NOTES.md](NOTES.md).
|
||||
| [tws_t5_telemetry.gsc](tws_t5_telemetry.gsc) | Direct HTTP game start, round, heartbeat, and game end reports |
|
||||
| [tws_t5_leaderboard.gsc](tws_t5_leaderboard.gsc) | Private map high-round record and all tied holders on connection |
|
||||
| [tws_t5_bank.gsc](tws_t5_bank.gsc) | Persistent shared GUID bank and private balance/deposit/withdraw commands |
|
||||
| [tws_t5_moderation.gsc](tws_t5_moderation.gsc) | Optional controller-managed bans, mutes and live moderation; requires common 1.2.0+ and native plugin 1.3.0+ |
|
||||
|
||||
## Install / upgrade
|
||||
|
||||
Copy `tws_t5_*.gsc` to `storage/t5/scripts/sp/`, then restart the map.
|
||||
Copy the desired `tws_t5_*.gsc` modules to `storage/t5/scripts/sp/`, then restart the map.
|
||||
Before adding the optional moderation module, install native plugin 1.3.0+ and
|
||||
restart the full game-server process; see [moderation setup](../../docs/moderation.md).
|
||||
When upgrading an existing installation, first remove these old scripts from
|
||||
that directory:
|
||||
|
||||
@@ -595,3 +598,9 @@ and [score tracking](https://github.com/plutoniummod/t5-scripts/blob/main/ZM/Com
|
||||
and leaderboard HTTP, JSON, type and string helpers. Install a build exposing
|
||||
the natives listed in each module's documentation, then restart the server
|
||||
process. No database is required.
|
||||
|
||||
## Moderation
|
||||
|
||||
Optional `tws_t5_moderation.gsc` 1.0.0 requires common 1.2.0 and the matching
|
||||
plugin 1.3.0. See the [moderation contract](../../docs/moderation.md) for private
|
||||
configuration, persistence, action results and deployment checks.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/* TWS moderation 1.0.0: native durable policy, connection-safe actions, HTTPS synchronization. */
|
||||
#include maps\_utility;
|
||||
#include common_scripts\utility;
|
||||
|
||||
init()
|
||||
{
|
||||
if (GetDvar(#"zombiemode") != "1")
|
||||
return;
|
||||
scripts\sp\tws_t5_common::ensure_config();
|
||||
level.moderation_ready = false;
|
||||
scripts\sp\tws_t5_common::register_connect_handler(::moderation_connected);
|
||||
level thread moderation_loop();
|
||||
}
|
||||
|
||||
moderation_connected()
|
||||
{
|
||||
self endon("disconnect");
|
||||
if (!level.moderation_ready)
|
||||
return;
|
||||
moderation_observe(self);
|
||||
moderationPump();
|
||||
}
|
||||
|
||||
moderation_observe(player)
|
||||
{
|
||||
if (!isDefined(player))
|
||||
return;
|
||||
guid = player getGuid();
|
||||
if (!isDefined(guid) || (typeof(guid) != "string" && typeof(guid) != "int"))
|
||||
return;
|
||||
// Preserve large identifiers as strings; native validation rejects ambiguous inputs.
|
||||
guid = "" + guid;
|
||||
name = player.name;
|
||||
if (!isDefined(name))
|
||||
name = "Unknown player";
|
||||
player moderationObserve(guid, name);
|
||||
}
|
||||
|
||||
moderation_loop()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (GetDvar("tws_moderation_enabled") == "0")
|
||||
{
|
||||
moderationStop();
|
||||
level.moderation_ready = false;
|
||||
wait 3;
|
||||
continue;
|
||||
}
|
||||
level.moderation_ready = moderationConfigure(GetDvar("tws_server_id"), GetDvar("tws_moderation_url"),
|
||||
GetDvar("tws_moderation_token"), GetDvarInt("tws_moderation_generation"));
|
||||
if (!level.moderation_ready)
|
||||
{
|
||||
wait 3;
|
||||
continue;
|
||||
}
|
||||
players = getPlayers();
|
||||
for (i = 0; i < players.size; i++)
|
||||
moderation_observe(players[i]);
|
||||
moderationPump();
|
||||
wait 0.5;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user