fix: tankopedia compare acknoledge selected shell

This commit is contained in:
TrèsAbhi committed 2025-07-27 20:26:58 -05:00
1 parent af699ff5b7
commit fcd084a86f
1 file changed
+14 -3
@@ -65,6 +65,11 @@ export function InfoWithDelta({
: (stats[props.value] as number); : (stats[props.value] as number);
const delta = useDelta(uhWhatDoICallThisVariable); const delta = useDelta(uhWhatDoICallThisVariable);
const protagonistTank = Duel.use((state) => state.protagonist.tank); const protagonistTank = Duel.use((state) => state.protagonist.tank);
const shellIndex = Duel.use((state) =>
state.protagonist.gun.gun_type!.value.base.shells.indexOf(
state.protagonist.shell,
),
);
const others = useMemo(() => { const others = useMemo(() => {
const defaultSkills = createDefaultSkills(skillDefinitions); const defaultSkills = createDefaultSkills(skillDefinitions);
@@ -86,6 +91,10 @@ export function InfoWithDelta({
provisionDefinitions, provisionDefinitions,
); );
if (member.gun.gun_type!.value.base.shells[shellIndex] === undefined) {
return undefined;
}
return tankCharacteristics( return tankCharacteristics(
{ {
applyDynamicArmor: false, applyDynamicArmor: false,
@@ -98,7 +107,7 @@ export function InfoWithDelta({
engine: member.engine, engine: member.engine,
gun: member.gun, gun: member.gun,
equipmentMatrix: member.equipmentMatrix, equipmentMatrix: member.equipmentMatrix,
shell: member.shell, shell: member.gun.gun_type!.value.base.shells[shellIndex],
stockEngine: tank.engines[0], stockEngine: tank.engines[0],
stockGun: tank.turrets[0].guns[0], stockGun: tank.turrets[0].guns[0],
stockTrack: tank.tracks[0], stockTrack: tank.tracks[0],
@@ -115,14 +124,16 @@ export function InfoWithDelta({
); );
}) })
.filter((tank) => { .filter((tank) => {
if (tank === undefined) return false;
const othersValue = const othersValue =
typeof props.value === 'function' typeof props.value === 'function'
? props.value(tank)! ? props.value(tank)!
: (tank[props.value] as number); : (tank[props.value] as number);
return othersValue !== undefined; return othersValue !== undefined;
}); }) as TankCharacteristics[];
}, [relativeAgainst]); }, [relativeAgainst, shellIndex]);
const betterTanks = others.filter((tank) => { const betterTanks = others.filter((tank) => {
const othersValue = const othersValue =
typeof props.value === 'function' typeof props.value === 'function'