fix: heat doesn't actually ricochet lol

This commit is contained in:
TrèsAbhi committed 2024-05-24 13:48:50 -05:00
1 parent 8e2302a6d4
commit 82933aaf1e
6 files changed
+14 -11

No files matched your search

@@ -311,7 +311,7 @@ export function Characteristics() {
<InfoWithDelta name="Normalization" decimals={0} unit="°">
{stats.shellNormalization}
</InfoWithDelta>
{shell.type !== 'he' && (
{!isExplosive(shell.type) && (
<InfoWithDelta
name="Ricochet"
decimals={0}
@@ -60,7 +60,9 @@ export function CoreArmorSceneComponent({
useEffect(() => {
async function handleShellChange(shell: ShellDefinition) {
material.uniforms.caliber.value = shell.caliber;
material.uniforms.ricochet.value = degToRad(shell.ricochet ?? 90);
material.uniforms.ricochet.value = degToRad(
isExplosive(shell.type) ? 90 : shell.ricochet!,
);
material.uniforms.normalization.value = degToRad(
shell.normalization ?? 0,
);
@@ -7,6 +7,7 @@ import {
} from 'three';
import { degToRad } from 'three/src/math/MathUtils';
import { ArmorUserData } from '../..';
import { isExplosive } from '../../../../../../core/blitz/isExplosive';
import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration';
import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment';
import { jsxTree } from '../../../../../../core/blitzkit/jsxTree';
@@ -53,7 +54,9 @@ export function SpacedArmorSubSpaced({
shell.penetration,
);
material.uniforms.caliber.value = shell.caliber;
material.uniforms.ricochet.value = degToRad(shell.ricochet ?? 90);
material.uniforms.ricochet.value = degToRad(
isExplosive(shell.type) ? 90 : shell.ricochet!,
);
material.uniforms.normalization.value = degToRad(
shell.normalization ?? 0,
);
@@ -268,7 +268,9 @@ export function SpacedArmorSceneComponent({
} else {
const type = intersection.object.userData.type;
const angle = surfaceNormal.angleTo(shellNormal);
const ricochet = degToRad(shell.ricochet ?? 90);
const ricochet = degToRad(
isExplosive(shell.type) ? 90 : shell.ricochet!,
);
const normalization = degToRad(shell.normalization ?? 0);
const threeCalibersRule =
shell.caliber > thickness * 3 || layerIndex > 0;
-7
View File
@@ -1,7 +0,0 @@
import { ShellDefinition } from '../blitzkit/tankDefinitions';
export function canRicochet(
type: ShellDefinition['type'],
): type is Exclude<ShellDefinition['type'], 'he'> {
return type !== 'he';
}
+3
View File
@@ -1,5 +1,8 @@
import { useEffect, useState } from 'react';
/**
* @deprecated DO NOT USE; CAUSES NEXT JS HYDRATION ISSUES
*/
export function useWideFormat(size = 880) {
function hasWideFormat() {
return typeof window !== 'undefined' && window.innerWidth > size;