diff --git a/scripts/buildAssets/definitions.ts b/scripts/buildAssets/definitions.ts index dacec572a..36c67867c 100644 --- a/scripts/buildAssets/definitions.ts +++ b/scripts/buildAssets/definitions.ts @@ -570,7 +570,10 @@ export async function buildDefinitions() { normalization: shell.normalizationAngle, ricochet: shell.ricochetAngle, type: blitzShellKindToBLitzkrieg[shell.kind], - explosionRadius: shell.explosionRadius, + explosionRadius: + shell.kind === 'HIGH_EXPLOSIVE' + ? shell.explosionRadius ?? 0 + : undefined, icon: shell.icon, penetration: penetrationRaw[0] === penetrationRaw[1] diff --git a/src/components/ArmorMesh/components/Armor/shaders/fragment.glsl b/src/components/ArmorMesh/components/Armor/shaders/fragment.glsl index 7b9c7a12a..6f7300009 100644 --- a/src/components/ArmorMesh/components/Armor/shaders/fragment.glsl +++ b/src/components/ArmorMesh/components/Armor/shaders/fragment.glsl @@ -44,9 +44,8 @@ void main() { bool coreArmorThreeCalibersRule = caliber > 3.0 * thickness; float spacedArmorNominalThickness = spacedArmorMaskColor.g * maxThickness; bool spacedArmorThreeCalibersRule = isUnderSpacedArmor && caliber > 3.0 * spacedArmorNominalThickness; - bool hasRicochetedSpacedArmor = !isExplosive && isUnderSpacedArmor && !spacedArmorThreeCalibersRule && spacedArmorAngle >= ricochetAngle; - bool isUnderAnything = isUnderExternalModule || isUnderSpacedArmor; - bool hasRicochetedCoreArmor = !isExplosive && !isUnderAnything && !coreArmorThreeCalibersRule && coreArmorangle >= ricochetAngle; + bool hasRicochetedSpacedArmor = isUnderSpacedArmor && !spacedArmorThreeCalibersRule && spacedArmorAngle >= ricochetAngle; + bool hasRicochetedCoreArmor = !hasRicochetedSpacedArmor && !isUnderExternalModule && !isExplosive && !coreArmorThreeCalibersRule && coreArmorangle >= ricochetAngle; if (hasRicochetedCoreArmor || hasRicochetedSpacedArmor) { penetrationChance = 0.0; @@ -57,10 +56,9 @@ void main() { if (isUnderExternalModule) { // external modules don't care about angle, they'll reduce penetration by their thickness - float externalModuleThickness = externalModuleMaskColor.g * maxThickness; + float externalModuleThickness = externalModuleMaskColor.r * maxThickness; remainingPenetration -= externalModuleThickness; } - remainingPenetration = max(remainingPenetration, 0.0); if (isUnderSpacedArmor) { // spaced armor on the other hand, does care about angle @@ -77,7 +75,6 @@ void main() { // there is a 50% penetration loss per meter for HE based shells remainingPenetration -= 0.5 * remainingPenetration * distanceFromSpacedArmor; } - remainingPenetration = max(remainingPenetration, 0.0); bool coreArmorTwoCalibersRule = caliber > 2.0 * thickness; float finalNormalization = coreArmorTwoCalibersRule ? (normalization * 1.4 * caliber) / (2.0 * thickness) : normalization; @@ -98,7 +95,8 @@ void main() { if (canSplash) { // only allow splasing if the damage equation deals more than 0 damage - float finalDamage = 0.5 * damage * (1.0 - distanceFromSpacedArmor / explosionRadius) - 1.1 * finalCoreArmorThickness; + float nominalArmorThickness = finalCoreArmorThickness - remainingPenetration; + float finalDamage = 0.5 * damage * (1.0 - distanceFromSpacedArmor / explosionRadius) - 1.1 * nominalArmorThickness; splashChance = finalDamage > 0.0 ? 1.0 : 0.0; } else { splashChance = 0.0; diff --git a/src/components/ArmorMesh/components/SpacedArmorDepth/index.tsx b/src/components/ArmorMesh/components/SpacedArmorDepth/index.tsx index fd07ae89f..1fe67c4b6 100644 --- a/src/components/ArmorMesh/components/SpacedArmorDepth/index.tsx +++ b/src/components/ArmorMesh/components/SpacedArmorDepth/index.tsx @@ -34,7 +34,6 @@ export function ArmorMeshSpacedArmorDepth(