feat: antagonist gun selector

This commit is contained in:
TrèsAbhi committed 2024-07-13 19:19:49 -05:00
1 parent ef5169f669
commit 7e22f4596d
2 files changed
+108 -33

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import { forEachRight } from 'lodash';
import { GunDefinition, TurretDefinition } from './tankDefinitions';
export function uniqueGuns(turrets: TurretDefinition[]) {
const gunIds = new Set<number>();
const guns: { turret: TurretDefinition; gun: GunDefinition }[] = [];
forEachRight(turrets, (turret) => {
forEachRight(turret.guns, (gun) => {
if (!gunIds.has(gun.id)) {
gunIds.add(gun.id);
guns.push({ turret, gun });
}
});
});
return guns;
}