fix(render): only show transport attack rings for the local player's boats

Filter extractAttackRings to the local player's smallID so FxAttackRingPass
only draws rings on the player's own transports. Drop the unused
extractAttackRingsFromIds variant and the dead frame/index.ts barrel
re-exports.
This commit is contained in:
evanpelle
2026-05-27 15:54:17 -07:00
parent 23fbc3114a
commit 9bf6b5af74
3 changed files with 9 additions and 37 deletions
+2 -23
View File
@@ -8,34 +8,13 @@ import { UT_TRANSPORT } from "../../types";
export function extractAttackRings(
units: ReadonlyMap<number, UnitState>,
mapW: number,
ownerFilter?: number,
owner: number,
): AttackRingInput[] {
const rings: AttackRingInput[] = [];
for (const u of units.values()) {
if (u.unitType !== UT_TRANSPORT) continue;
if (u.targetTile === null || !u.isActive || u.retreating) continue;
if (ownerFilter !== undefined && u.ownerID !== ownerFilter) continue;
const t = u.targetTile;
rings.push({ x: t % mapW, y: (t - (t % mapW)) / mapW, unitId: u.id });
}
return rings;
}
/**
* Targeted variant — iterates only pre-classified transport IDs instead of all units.
* Used by the live path where UnitClassifier maintains the transport ID set.
*/
export function extractAttackRingsFromIds(
transportIds: readonly number[],
units: ReadonlyMap<number, UnitState>,
mapW: number,
ownerFilter?: number,
): AttackRingInput[] {
const rings: AttackRingInput[] = [];
for (const id of transportIds) {
const u = units.get(id);
if (!u || u.targetTile === null || !u.isActive || u.retreating) continue;
if (ownerFilter !== undefined && u.ownerID !== ownerFilter) continue;
if (u.ownerID !== owner) continue;
const t = u.targetTile;
rings.push({ x: t % mapW, y: (t - (t % mapW)) / mapW, unitId: u.id });
}
-13
View File
@@ -1,19 +1,6 @@
// Re-export the boundary contract type
export type { FrameData } from "../types";
// Shared derive functions
export { computeAllianceClusters } from "./derive/AllianceClusters";
export {
extractAttackRings,
extractAttackRingsFromIds,
} from "./derive/AttackRings";
export {
extractNukeTelegraphs,
extractNukeTelegraphsFromIds,
} from "./derive/NukeTelegraphs";
export { computePlayerStatus } from "./derive/PlayerStatus";
export { buildRelationMatrix, buildTeamMap } from "./derive/RelationMatrix";
// Upload
export type { RelationMatrixResult } from "./derive/RelationMatrix";
export { uploadFrameData } from "./Upload";
+7 -1
View File
@@ -494,7 +494,13 @@ export class GameView implements GameMap {
this._unitStates,
this._map.width(),
);
f.attackRings = extractAttackRings(this._unitStates, this._map.width());
f.attackRings = this._myPlayer
? extractAttackRings(
this._unitStates,
this._map.width(),
this._myPlayer.smallID(),
)
: [];
f.structuresDirty = this._structuresDirty;
// First populate: signal "full upload required" by nulling changedTiles.