mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
fix: compare remaining penetration with 0
This commit is contained in:
1 parent
d89575b25d
commit
a212d2142c
2 files changed
+2
-6
No files matched your search
@@ -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 = {
|
||||
|
||||
@@ -23,7 +23,7 @@ export const SHOT_ICONS: Record<Shot['type'], ReactNode> = {
|
||||
};
|
||||
|
||||
const THICKNESS = 0.05;
|
||||
const LENGTH = 2;
|
||||
const LENGTH = 4;
|
||||
|
||||
export function ShotDisplay() {
|
||||
const shot = useTankopediaTemporary((state) => state.shot);
|
||||
|
||||
Reference in new issue
Block a user