feat: shell range

This commit is contained in:
tresabhi committed 2024-11-09 16:00:15 -06:00
1 parent 594b1eb311
commit 0722ff6bfb
7 files changed
+32 -1

No files matched your search

@@ -1650,7 +1650,6 @@ export async function definitions() {
}; };
}); });
return;
await commitAssets('definitions', [ await commitAssets('definitions', [
{ {
content: encodePBBuffer(GameDefinitions, gameDefinitions), content: encodePBBuffer(GameDefinitions, gameDefinitions),
@@ -151,6 +151,12 @@ export function Body({ stats }: BodyProps) {
value="shellVelocity" value="shellVelocity"
decimals={0} decimals={0}
/> />
<CompareRow
stats={stats}
name="Shell range"
value="shellRange"
decimals={0}
/>
<CompareRow <CompareRow
stats={stats} stats={stats}
name="Aim time" name="Aim time"
@@ -116,6 +116,14 @@ export function Sort() {
> >
Shell velocity Shell velocity
</DropdownMenu.CheckboxItem> </DropdownMenu.CheckboxItem>
<DropdownMenu.CheckboxItem
checked={tankopediaSort.by === 'fire.shellRange'}
onClick={() => {
$tankopediaSort.setKey('by', 'fire.shellRange');
}}
>
Shell range
</DropdownMenu.CheckboxItem>
<DropdownMenu.CheckboxItem <DropdownMenu.CheckboxItem
checked={tankopediaSort.by === 'fire.aimTime'} checked={tankopediaSort.by === 'fire.aimTime'}
onClick={() => { onClick={() => {
@@ -265,6 +265,16 @@ export const TankSearch = memo<TankSearchProps>(
); );
break; break;
case 'fire.shellRange':
sorted = filtered.sort(
(a, b) =>
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
.range -
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
.range,
);
break;
case 'fire.aimTime': case 'fire.aimTime':
sorted = filtered.sort( sorted = filtered.sort(
(a, b) => (a, b) =>
@@ -329,6 +329,10 @@ export function Characteristics() {
<InfoWithDelta name="Shell velocity" unit="m/s" decimals={0}> <InfoWithDelta name="Shell velocity" unit="m/s" decimals={0}>
{stats.shellVelocity} {stats.shellVelocity}
</InfoWithDelta> </InfoWithDelta>
<InfoWithDelta name="Shell range" unit="m/s" decimals={0}>
{stats.shellRange}
</InfoWithDelta>
<InfoWithDelta <InfoWithDelta
decimals={2} decimals={2}
name="Aim time" name="Aim time"
@@ -505,6 +505,7 @@ export function tankCharacteristics(
const shellNormalization = shell.normalization ?? 0; const shellNormalization = shell.normalization ?? 0;
const shellRicochet = isExplosive(shell.type) ? undefined : shell.ricochet; const shellRicochet = isExplosive(shell.type) ? undefined : shell.ricochet;
const crewCount = tank.crew.length; const crewCount = tank.crew.length;
const shellRange = shell.range;
return { return {
crewCount, crewCount,
@@ -568,5 +569,6 @@ export function tankCharacteristics(
height, height,
length, length,
volume, volume,
shellRange,
}; };
} }
@@ -15,6 +15,7 @@ export const SORT_UNITS: Record<TankopediaSortBy, string | undefined> = {
'fire.premiumPenetration': 'mm', 'fire.premiumPenetration': 'mm',
'fire.reload': 's', 'fire.reload': 's',
'fire.shellVelocity': 'm/s', 'fire.shellVelocity': 'm/s',
'fire.shellRange': 'm',
'fire.standardPenetration': 'mm', 'fire.standardPenetration': 'mm',
'maneuverability.backwardsSpeed': 'kph', 'maneuverability.backwardsSpeed': 'kph',
'maneuverability.forwardsSpeed': 'kph', 'maneuverability.forwardsSpeed': 'kph',
@@ -46,6 +47,7 @@ export const SORT_NAMES = {
'fire.premiumPenetration': 'premium penetration', 'fire.premiumPenetration': 'premium penetration',
'fire.damage': 'damage', 'fire.damage': 'damage',
'fire.shellVelocity': 'shell velocity', 'fire.shellVelocity': 'shell velocity',
'fire.shellRange': 'shell range',
'fire.aimTime': 'aim time', 'fire.aimTime': 'aim time',
'fire.dispersionStill': 'dispersion still', 'fire.dispersionStill': 'dispersion still',
'fire.dispersionMoving': 'dispersion moving', 'fire.dispersionMoving': 'dispersion moving',