mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
fix: heat ricochet
This commit is contained in:
1 parent
170056cc55
commit
36f0299e51
3 files changed
+14
-2
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
Vector3,
|
||||
} from 'three';
|
||||
import { degToRad } from 'three/src/math/MathUtils';
|
||||
import { canRicochet } from '../../../../core/blitz/canRicochet';
|
||||
import { canSplash } from '../../../../core/blitz/canSplash';
|
||||
import { isExplosive } from '../../../../core/blitz/isExplosive';
|
||||
import { resolveNearPenetration } from '../../../../core/blitz/resolveNearPenetration';
|
||||
@@ -43,6 +44,7 @@ export function ArmorMesh({
|
||||
const initialTankopedia = useTankopediaPersistent.getState();
|
||||
const material = useRef<ShaderMaterial>(null);
|
||||
const explosionCapable = isExplosive(initialShell.type);
|
||||
const ricochetCapable = canRicochet(initialShell.type);
|
||||
const cameraNormal = new Vector3();
|
||||
const shellNormal = new Vector3();
|
||||
const surfaceNormal = new Vector3();
|
||||
@@ -66,6 +68,7 @@ export function ArmorMesh({
|
||||
function updateShellProperties() {
|
||||
const shell = useDuel.getState().antagonist!.shell;
|
||||
if (material.current) {
|
||||
material.current.uniforms.canRicochet.value = canRicochet(shell.type);
|
||||
material.current.uniforms.isExplosive.value = isExplosive(shell.type);
|
||||
material.current.uniforms.canSplash.value = canSplash(shell.type);
|
||||
material.current.uniforms.caliber.value = shell.caliber;
|
||||
@@ -211,7 +214,7 @@ export function ArmorMesh({
|
||||
|
||||
if (
|
||||
index === 0 &&
|
||||
!isExplosive(shell.type) &&
|
||||
canRicochet(shell.type) &&
|
||||
!threeCalibersRule &&
|
||||
angle >= degToRad(shell.ricochet!)
|
||||
) {
|
||||
@@ -319,6 +322,7 @@ export function ArmorMesh({
|
||||
},
|
||||
maxThickness: { value: maxThickness },
|
||||
isExplosive: { value: explosionCapable },
|
||||
canRicochet: { value: ricochetCapable },
|
||||
canSplash: { value: canSplash(initialShell.type) },
|
||||
thickness: {
|
||||
value:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
varying vec3 vViewPosition;
|
||||
varying vec3 vNormal;
|
||||
uniform bool isExplosive;
|
||||
uniform bool canRicochet;
|
||||
uniform bool canSplash;
|
||||
uniform float thickness;
|
||||
uniform float penetration;
|
||||
@@ -45,7 +46,7 @@ void main() {
|
||||
float spacedArmorNominalThickness = spacedArmorMaskColor.g * maxThickness;
|
||||
bool spacedArmorThreeCalibersRule = isUnderSpacedArmor && caliber > 3.0 * spacedArmorNominalThickness;
|
||||
bool hasRicochetedSpacedArmor = isUnderSpacedArmor && !spacedArmorThreeCalibersRule && spacedArmorAngle >= ricochetAngle;
|
||||
bool hasRicochetedCoreArmor = !hasRicochetedSpacedArmor && !isUnderExternalModule && !isExplosive && !coreArmorThreeCalibersRule && coreArmorangle >= ricochetAngle;
|
||||
bool hasRicochetedCoreArmor = !hasRicochetedSpacedArmor && !isUnderExternalModule && canRicochet && !coreArmorThreeCalibersRule && coreArmorangle >= ricochetAngle;
|
||||
|
||||
if (hasRicochetedCoreArmor || hasRicochetedSpacedArmor) {
|
||||
penetrationChance = 0.0;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ShellDefinition } from '../blitzkrieg/tankDefinitions';
|
||||
|
||||
export function canRicochet(
|
||||
type: ShellDefinition['type'],
|
||||
): type is Exclude<ShellDefinition['type'], 'he'> {
|
||||
return type !== 'he';
|
||||
}
|
||||
Reference in new issue
Block a user