mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: gun defs
This commit is contained in:
1 parent
66dbc5b2ed
commit
dabeab8612
1 file changed
+24
-16
+24
-16
@@ -52,6 +52,8 @@ interface GunDefinitionsList {
|
|||||||
tags: string;
|
tags: string;
|
||||||
level: number;
|
level: number;
|
||||||
pitchLimits: string;
|
pitchLimits: string;
|
||||||
|
burst?: { count: number; rate: number };
|
||||||
|
clip?: { count: number; rate: number };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -149,9 +151,27 @@ if (allTargets || targets?.includes('definitions')) {
|
|||||||
(turretKey) => {
|
(turretKey) => {
|
||||||
const turret = tankDefinition.root.turrets0[turretKey];
|
const turret = tankDefinition.root.turrets0[turretKey];
|
||||||
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
|
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
|
||||||
const turretGuns = Object.keys(turret.guns).map((gunKey) =>
|
const turretGuns = Object.keys(turret.guns).map((gunKey) => {
|
||||||
toUniqueId(nation, gunList.root.ids[gunKey]),
|
const turretGunEntry = turret.guns[gunKey];
|
||||||
);
|
const gunId = toUniqueId(nation, gunList.root.ids[gunKey]);
|
||||||
|
const gun = gunList.root.shared[gunKey];
|
||||||
|
const pitchLimitsRaw =
|
||||||
|
turretGunEntry.pitchLimits ?? gun.pitchLimits;
|
||||||
|
|
||||||
|
gunDefinitions[gunId] = {
|
||||||
|
id: gunId,
|
||||||
|
pitch: (typeof pitchLimitsRaw === 'string'
|
||||||
|
? pitchLimitsRaw
|
||||||
|
: pitchLimitsRaw.at(-1)!
|
||||||
|
)
|
||||||
|
.split(' ')
|
||||||
|
.map(Number) as [number, number],
|
||||||
|
name: strings[gun.userString] ?? gunKey.replaceAll('_', ' '),
|
||||||
|
tier: gun.level,
|
||||||
|
};
|
||||||
|
|
||||||
|
return gunId;
|
||||||
|
});
|
||||||
|
|
||||||
turretDefinitions[turretId] = {
|
turretDefinitions[turretId] = {
|
||||||
id: turretId,
|
id: turretId,
|
||||||
@@ -163,7 +183,7 @@ if (allTargets || targets?.includes('definitions')) {
|
|||||||
tier: turret.level,
|
tier: turret.level,
|
||||||
yaw: (typeof turret.yawLimits === 'string'
|
yaw: (typeof turret.yawLimits === 'string'
|
||||||
? turret.yawLimits
|
? turret.yawLimits
|
||||||
: turret.yawLimits[0]
|
: turret.yawLimits.at(-1)!
|
||||||
)
|
)
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.map(Number) as [number, number],
|
.map(Number) as [number, number],
|
||||||
@@ -194,18 +214,6 @@ if (allTargets || targets?.includes('definitions')) {
|
|||||||
turrets: tankTurrets,
|
turrets: tankTurrets,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(gunList.root.ids).forEach((gunKey) => {
|
|
||||||
const gun = gunList.root.shared[gunKey];
|
|
||||||
const gunId = toUniqueId(nation, gunList.root.ids[gunKey]);
|
|
||||||
|
|
||||||
gunDefinitions[gunId] = {
|
|
||||||
id: gunId,
|
|
||||||
name: strings[gun.userString] ?? gunKey.replaceAll('_', ' '),
|
|
||||||
tier: gun.level,
|
|
||||||
pitch: gun.pitchLimits.split(' ').map(Number) as [number, number],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user