From a212d2142c31f7f7b1d5e0bdbbe5dd8da5a9199f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sat, 3 Feb 2024 12:22:52 -0600 Subject: [PATCH] fix: compare remaining penetration with 0 --- src/components/ArmorMesh/components/Armor/index.tsx | 6 +----- src/components/ShotDisplay.tsx | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/ArmorMesh/components/Armor/index.tsx b/src/components/ArmorMesh/components/Armor/index.tsx index 11074b576..8900df693 100644 --- a/src/components/ArmorMesh/components/Armor/index.tsx +++ b/src/components/ArmorMesh/components/Armor/index.tsx @@ -265,16 +265,12 @@ export function ArmorMesh({ if (gap) armorPiercingLayers.push(gap); }); - console.log(armorPiercingLayers); - let remainingPenetration = resolvedPenetration; - let accumulatedThickness = 0; const explosiveCapable = isExplosive(shell.type); armorPiercingLayers.forEach((layer) => { if (layer.type !== 'gap') { remainingPenetration -= layer.angled; - accumulatedThickness += layer.angled; } else if (explosiveCapable) { // there is a 50% penetration loss per meter for HE based shells remainingPenetration -= 0.5 * remainingPenetration * layer.gap; @@ -286,7 +282,7 @@ export function ArmorMesh({ const hasRicochet = armorPiercingLayers.some( (layer) => layer.type !== 'gap' && layer.ricochet, ); - const hasPenetrated = remainingPenetration >= accumulatedThickness; + const hasPenetrated = remainingPenetration > 0; mutateTankopediaTemporary((draft) => { draft.shot = { diff --git a/src/components/ShotDisplay.tsx b/src/components/ShotDisplay.tsx index 6910b8ea7..7bf538f63 100644 --- a/src/components/ShotDisplay.tsx +++ b/src/components/ShotDisplay.tsx @@ -23,7 +23,7 @@ export const SHOT_ICONS: Record = { }; const THICKNESS = 0.05; -const LENGTH = 2; +const LENGTH = 4; export function ShotDisplay() { const shot = useTankopediaTemporary((state) => state.shot);