Add majority lock and unlock voting for T5 and T6

This commit is contained in:
2026-10-18 16:01:57 -04:00
parent caaaa102a4
commit 9ef5932d36
10 changed files with 816 additions and 78 deletions
+55 -1
View File
@@ -173,6 +173,59 @@ Modules currently in each tree:
| bank | `tws_t5_bank.gsc` | `tws_t6_bank.gsc` — persistent shared GUID bank |
| leaderboard | `t5/scripts/tws_t5_leaderboard.gsc` | `t6/scripts/tws_t6_leaderboard.gsc` |
## Lobby lock voting (T5 and T6)
Lock scripts `1.1.0` add exact, case-insensitive `.lock` and `.unlock` chat
commands, also listed in `.help` when the lock module is installed. `.lock`
is available **after round 5 (round 6 onward)**; `.unlock` is available whenever
the server is locked. Both require a strict majority of the current connected
players: 1 of 1, 2 of 2, 2 of 3, or 3 of 4. Dead, spectating and AFK players
count equally. Larger lobbies use `floor(players / 2) + 1`.
Typing the command starts a 60-second vote and casts your vote; teammates type
the same command to support it. Solo commands apply immediately. Each connection
gets one vote per ballot. Repeats neither add votes nor extend the deadline.
Joins and disconnects update the majority; disconnected votes are discarded,
and reconnecting does not restore a vote. A smaller roster can pass an ongoing
vote with the remaining votes. An expired vote needs fresh votes from everyone.
Typing the command for the current state only replies privately; it does not
withdraw a vote or cancel an ongoing ballot.
Automatic locking remains at `tws_lock_round` (default `20`) and happens at
most once per match. A successful `.unlock` vote keeps the lobby open for the
rest of that match, including when players lock and unlock before round 20.
Players can still vote `.lock` again. An `.unlock` request while already open
does not disable the automatic lock. Automatic locking clears any unfinished
manual lock ballot. Each activation generates a fresh `g_password`; existing
players remain connected. Startup and game over clear the password and votes.
There is no automatic prompt at round 6. Vote progress and state changes use
ordinary message text, with private replies for unavailable/repeated commands;
no center-screen popup or recurring reminder is added.
Compatibility: no new dependency requirement; keep the matching common and HUD
modules installed (common `1.0.0+`, HUD `1.0.0+`). HUD supplies round notifications.
Copy each updated lock script to its existing game script directory and restart
the map. No native plugin update, full server-process restart or other deployment
action is required.
Run `node tools/check_lock.mjs` and `node tools/check_hud.mjs` for portable vote,
lifecycle and help pagination checks. Compile the T6 script using the
[T6 compiler check](t6/scripts/README.md#validation). Before rollout, verify on
live T5 and T6 servers:
1. Try `.lock` in rounds 5 and 6, then both commands with 1–4 players. Confirm
the exact majority, instant solo behavior, private duplicate replies and
ordinary vote text. Check both commands in `.help` and `.commands`.
2. Let a vote expire, then retry; disconnect a voter, disconnect a non-voter,
reconnect and join mid-vote. Verify the current roster and fresh votes count.
3. Allow round-20 auto-lock, unlock, advance another round and relock. Also
lock/unlock early and cross round 20. Confirm a new client is blocked when
locked and can join when unlocked; connected players stay in the game.
4. End the match with a lock or pending vote, then restart the map. Confirm
the next lobby is open and old votes cannot change it. Check a custom
`tws_lock_round` and confirm it does not change the round-6 manual gate.
## Player bank (T5 and T6)
Install `tws_t5_bank.gsc` or `tws_t6_bank.gsc` alongside the game's common and
@@ -396,7 +449,8 @@ and the stock HUD remain unaffected.
Common owns one unboxed service area at the upper right. `.help` and its
`.commands` alias show installed commands in pages of up to nine rows with command
and description columns: `.help`, `.hud`, `.afk`, `.back`, `.join`, `.leaders`,
`.b`, `.d`, `.w`. Missing modules' commands are omitted. Bank syntax remains
`.b`, `.d`, `.w`, plus registered commands such as `.lock` and `.unlock`.
Missing modules' commands are omitted. Bank syntax remains
`.d <amount|all>` and `.w <amount|all>`, and `.join` identifies its newcomer
restriction. Additional registered commands use pages of nine rows; a page
count appears only when more than one page is needed. Each page lasts