Report cumulative player scores alongside balances

This commit is contained in:
2026-10-12 13:57:36 -04:00
parent 158916b664
commit b508b6739b
6 changed files with 121 additions and 18 deletions
+12 -1
View File
@@ -131,11 +131,22 @@ It sends four event types over the life of a match, mirroring the T5 script:
Each event payload includes `event`, `server`, `map`, `match`, `seq`, `round` (except `game_start`)
and a `players` array with `name`, `guid`, `kills`, `headshots`, `downs`, `revives`
and `score` per player. `guid` reads Plutonium's `player.guid` engine property
and `score` plus `score_total` per player in stat reports. `game_start` includes
only player identity. `guid` reads Plutonium's `player.guid` engine property
(T5 uses the `player getGuid()` method — T6 has no such method, but the field is
equivalent for identity purposes). `kills`/`headshots`/`downs`/`revives` read
from T6's stock match counters in `player.pers[]`; missing or negative values
are reported as `0`. `score` is the player's current spendable `player.score`.
`score_total` reads `player.score_total`, the stock cumulative match score used
by the final scoreboard. Spending does not reduce it; stock grants can opt out
of adding to the total. Missing or negative totals report as `0`, independently
of the balance. Deploy Electric Cherry's receiver support before these scripts;
older payloads without totals remain valid and their totals are unknown.
Stock `end_game` yields before `player_intermission` replaces the balance with
the total. The reporter serializes both at the first end signal without yielding,
so retries and replay keep the original balance and total. Custom end sequences
must emit a supported end signal before overwriting the balance.
Delivery uses one in-flight request and a FIFO queue. Every match receives a
native-generated key; `seq` starts at 1 for `game_start` and increases at capture.
+4 -1
View File
@@ -165,6 +165,8 @@ telemetry_report_round()
telemetry_game_end_watcher()
{
// One waiter consumes the first end signal, even if a map fires all three.
// Stock end_game yields before player_intermission replaces score with
// score_total. Serialize here without waiting so score stays spendable.
level waittill_any("end_game", "game_ended", "intermission");
telemetry_log(1, "Game-end signal received; stopping producers and draining queue");
@@ -240,8 +242,9 @@ telemetry_players_json(include_stats)
data["headshots"] = telemetry_stat(player, "headshots");
data["downs"] = telemetry_stat(player, "downs");
data["revives"] = telemetry_stat(player, "revives");
// Current spendable points, not the lifetime points-earned stat.
// Stock match total is independent of the spendable balance.
data["score"] = telemetry_nonnegative_int(player.score);
data["score_total"] = telemetry_nonnegative_int(player.score_total);
}
if (body != "[")