Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/simulate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,20 @@ console.log("\n=== scenario: B6 — LLM-off economy drop coda (kitted primary
const second = economyLine(kitted(econ), latch);
expect(!!first && first.includes("Mouse"), "first drop call names the broke friend");
expect(!/Mouse/.test(second ?? ""), "the drop latch suppresses re-naming the same friend next freeze");

// Mid-match Steam-name change: the latch keys on the stable SteamID64, so the same
// broke friend renaming between freezes still can't re-trigger the drop coda.
const renameLatch = new Set<string>();
const before = economyLine(kitted([
{ isPrimary: true, money: 3000, equipValue: 4000, alive: true },
{ steamid: "76561198000000001", isPrimary: false, name: "Mouse", money: 1000, alive: true },
]), renameLatch);
const afterRename = economyLine(kitted([
{ isPrimary: true, money: 3000, equipValue: 4000, alive: true },
{ steamid: "76561198000000001", isPrimary: false, name: "m0use", money: 1000, alive: true },
]), renameLatch);
expect(!!before && before.includes("Mouse"), "drop call fires before the rename");
expect(!/m0use/.test(afterRename ?? ""), "a mid-match Steam-name change doesn't dodge the drop latch (keyed on SteamID)");
}

// ---------------------------------------------------------------------------
Expand Down
9 changes: 6 additions & 3 deletions src/coach/lines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,12 @@ function appendDrop(line: string, ctx: MatchContext, droppedTo?: Set<string>): s
const who = broke.name as string;
// Anti-repeat: the economy cooldown is shorter than a round, so without a latch
// this would re-name the same broke friend freezetime after freezetime. The caller
// owns the per-match set (cleared at matchStart), mirroring weakLinkCalled.
if (droppedTo?.has(who)) return line;
droppedTo?.add(who);
// owns the per-match set (cleared at matchStart), mirroring weakLinkCalled. Key on
// the stable SteamID64 (falling back to the name only when a fixture omits it) so a
// mid-match Steam-name change can't dodge the latch and re-fire the same drop call.
const key = (broke.steamid as string | undefined) ?? who;
if (droppedTo?.has(key)) return line;
droppedTo?.add(key);
return `${line} ${pick("dropCoda", [
`And ${who}'s broke, sling them a rifle, you can afford it.`,
`${who}'s got nothing. Drop them a gun, quit hoarding.`,
Expand Down
1 change: 1 addition & 0 deletions src/gsi/roster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ export class RosterManager {
.map(([id, f], i) => {
const m = members[i]; // members[0..live.length-1] align with live by construction
return {
steamid: id, // feed key = SteamID64; the drop latch dedups on this, not the name
name: m.name,
money: m.money,
isPrimary: m.isPrimary,
Expand Down
6 changes: 4 additions & 2 deletions src/gsi/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ export interface TeamContext {
* gear and alive, so the coach can tell a kitted $5k from a force-buy $5k and
* never name a drop to a dead teammate. equipValue is present only for the
* primary's own feed (the only feed whose own gear we read); alive mirrors the
* member's. Present only when team tactics are enabled; covers only the wired subset.
* member's. steamid is the feed's stable SteamID64 — the key the drop latch dedups
* on so a mid-match Steam-name change can't re-fire the same drop call. Present only
* when team tactics are enabled; covers only the wired subset.
*/
econ?: { name?: string; money: number; isPrimary: boolean; equipValue?: number; alive?: boolean }[];
econ?: { steamid?: string; name?: string; money: number; isPrimary: boolean; equipValue?: number; alive?: boolean }[];
/**
* Cross-round buy-sync read for a coordinating squad — e.g. "Andy full-bought
* while Mouse and Cadian saved". Present whenever 2+ wired buyers are visible at
Expand Down
Loading