mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: antagonist gun selector
This commit is contained in:
1 parent
ef5169f669
commit
7e22f4596d
2 files changed
+108
-33
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user