From 46f9d605f70c5bb1939dc9621c500592776575fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 12 Mar 2024 16:53:42 -0500
Subject: [PATCH 1/6] fix: intra clip spelling
---
.../tools/tankopedia/[id]/components/Characteristics/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
index a7b4b308c..0acab5ee4 100644
--- a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
+++ b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
@@ -319,7 +319,7 @@ export function Characteristics() {
From 6d1ed1e56efcb0b728d671bc02b77acbad48677f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 12 Mar 2024 17:09:21 -0500
Subject: [PATCH 2/6] fix: reveals a few hidden values
---
scripts/buildAssets/definitions.ts | 4 +-
.../[id]/components/Characteristics/index.tsx | 48 ++++++++++---------
src/core/blitzkrieg/resolveDpm.ts | 6 +--
src/core/blitzkrieg/resolveReload.ts | 4 +-
src/core/blitzkrieg/tankDefinitions.ts | 4 +-
5 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/scripts/buildAssets/definitions.ts b/scripts/buildAssets/definitions.ts
index d73cf9208..78aa8972b 100644
--- a/scripts/buildAssets/definitions.ts
+++ b/scripts/buildAssets/definitions.ts
@@ -674,7 +674,7 @@ export async function definitions(production: boolean) {
: turretGunEntry.reloadTime;
const gunClipCount =
gunType === 'regular' ? undefined : turretGunEntry.clip!.count;
- const gunInterClip =
+ const gunIntraClip =
gunType === 'regular'
? undefined
: 60 / turretGunEntry.clip!.rate;
@@ -722,7 +722,7 @@ export async function definitions(production: boolean) {
type: gunType,
reload: gunReload,
count: gunClipCount,
- interClip: gunInterClip,
+ intraClip: gunIntraClip,
camouflageLoss:
typeof turretGunEntry.invisibilityFactorAtShot === 'number'
? turretGunEntry.invisibilityFactorAtShot
diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
index 0acab5ee4..284d9a5c8 100644
--- a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
+++ b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
@@ -113,7 +113,7 @@ export function Characteristics() {
// TODO: add max rolls
[hasTungsten, 0.15],
);
- const interClipCoefficient = coefficient([hasShellReloadBoost, -0.3]);
+ const intraClipCoefficient = coefficient([hasShellReloadBoost, -0.3]);
const shellVelocityCoefficient = coefficient(
[hasSupercharger, 0.3],
[hasImprovedGunPowder, 0.3],
@@ -210,7 +210,7 @@ export function Characteristics() {
shell,
damageCoefficient,
reloadCoefficient,
- interClipCoefficient,
+ intraClipCoefficient,
);
useEffect(() => {
@@ -255,7 +255,7 @@ export function Characteristics() {
<>
{gun.reload.at(-1)! < gun.reload.at(-2)!
- ? (shell.damage.armor / (gun.reload.at(-1)! + gun.interClip)) *
+ ? (shell.damage.armor / (gun.reload.at(-1)! + gun.intraClip)) *
60
: (shell.damage.armor / gun.reload[0]) * 60}
@@ -266,12 +266,12 @@ export function Characteristics() {
unit="hp / min"
>
{gun.reload.at(-1)! < gun.reload.at(-2)!
- ? (shell.damage.armor / (gun.reload.at(-1)! + gun.interClip)) *
+ ? (shell.damage.armor / (gun.reload.at(-1)! + gun.intraClip)) *
(60 -
- (gun.reload.slice(0, -1).length - 1) * gun.interClip) +
+ (gun.reload.slice(0, -1).length - 1) * gun.intraClip) +
shell.damage.armor * gun.reload.slice(0, -1).length
- : (shell.damage.armor / (gun.reload[0] + gun.interClip)) *
- (60 - (gun.reload.slice(1).length - 1) * gun.interClip) +
+ : (shell.damage.armor / (gun.reload[0] + gun.intraClip)) *
+ (60 - (gun.reload.slice(1).length - 1) * gun.intraClip) +
shell.damage.armor * gun.reload.slice(1).length}
}
/>
-
- {gun.reload.at(-1)! < gun.reload.at(-2)! ? gun.reload.length : 1}
-
>
)}
{gun.type === 'autoReloader' ? (
<>
-
+ {gun.reload.length}
+
+ {gun.reload.at(-1)! < gun.reload.at(-2)! ? gun.reload.length : 1}
+
+
{gun.reload.map((reload, index) => (
- {reload}
+ {reload * reloadCoefficient}
))}
>
@@ -315,17 +316,18 @@ export function Characteristics() {
{gun.reload * reloadCoefficient}
)}
- {gun.type === 'autoLoader' && (
-
- {gun.interClip * interClipCoefficient}
-
- )}
+ {gun.type === 'autoLoader' ||
+ (gun.type === 'autoReloader' && (
+
+ {gun.intraClip * intraClipCoefficient}
+
+ ))}
{shell.caliber}
diff --git a/src/core/blitzkrieg/resolveDpm.ts b/src/core/blitzkrieg/resolveDpm.ts
index 440f610ba..9224442b8 100644
--- a/src/core/blitzkrieg/resolveDpm.ts
+++ b/src/core/blitzkrieg/resolveDpm.ts
@@ -5,7 +5,7 @@ export function resolveDpm(
shell: ShellDefinition,
damageCoefficient = 1,
reloadCoefficient = 1,
- interClipCoefficient = 1,
+ intraClipCoefficient = 1,
) {
const alpha = shell.damage.armor * damageCoefficient;
@@ -14,14 +14,14 @@ export function resolveDpm(
} else if (gun.type === 'autoLoader') {
return (
((alpha * gun.count) /
- (gun.reload + (gun.count - 1) * gun.interClip * interClipCoefficient)) *
+ (gun.reload + (gun.count - 1) * gun.intraClip * intraClipCoefficient)) *
60
);
} else {
return (
((alpha * gun.count) /
(gun.reload.reduce((a, b) => a + b, 0) +
- (gun.count - 1) * gun.interClip)) *
+ (gun.count - 1) * gun.intraClip)) *
60
);
}
diff --git a/src/core/blitzkrieg/resolveReload.ts b/src/core/blitzkrieg/resolveReload.ts
index 358683428..c9c2b9840 100644
--- a/src/core/blitzkrieg/resolveReload.ts
+++ b/src/core/blitzkrieg/resolveReload.ts
@@ -4,10 +4,10 @@ export function resolveReload(gun: GunDefinition) {
if (gun.type === 'regular') {
return gun.reload;
} else if (gun.type === 'autoLoader') {
- return gun.reload + (gun.count - 1) * gun.interClip;
+ return gun.reload + (gun.count - 1) * gun.intraClip;
} else {
return (
- gun.reload.reduce((a, b) => a + b, 0) + (gun.count - 1) * gun.interClip
+ gun.reload.reduce((a, b) => a + b, 0) + (gun.count - 1) * gun.intraClip
);
}
}
diff --git a/src/core/blitzkrieg/tankDefinitions.ts b/src/core/blitzkrieg/tankDefinitions.ts
index 7258cf30d..3322f34f9 100644
--- a/src/core/blitzkrieg/tankDefinitions.ts
+++ b/src/core/blitzkrieg/tankDefinitions.ts
@@ -125,13 +125,13 @@ interface GunDefinitionRegular extends GunDefinitionBase {
interface GunDefinitionAutoLoader extends GunDefinitionBase {
type: 'autoLoader';
reload: number;
- interClip: number;
+ intraClip: number;
count: number;
}
interface GunDefinitionAutoReloader extends GunDefinitionBase {
type: 'autoReloader';
reload: number[];
- interClip: number;
+ intraClip: number;
count: number;
}
export type ShellDefinition = {
From fd408d677764f35f495a934856088158e64dcc93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 12 Mar 2024 17:39:46 -0500
Subject: [PATCH 3/6] fix: use initial gun pitches correctly
---
.../[id]/components/Characteristics/index.tsx | 5 ++-
.../[id]/components/QuickInputs/index.tsx | 43 +++++++++----------
src/core/blitzkrieg/assignDuelMember.ts | 6 ++-
3 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
index 284d9a5c8..8a1846a10 100644
--- a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
+++ b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
@@ -56,6 +56,7 @@ export function Characteristics() {
turretModelDefinition.boundingBox,
),
);
+ const gunDefaultPitch = tankModelDefinition.turretRotation?.pitch ?? 0;
const weight =
tank.weight + engine.weight + track.weight + turret.weight + gun.weight;
const weightTons = weight / 1000;
@@ -459,10 +460,12 @@ export function Characteristics() {
{gunModelDefinition.pitch.max +
+ gunDefaultPitch +
(hasImprovedVerticalStabilizer ? 3 : 0)}
- {-gunModelDefinition.pitch.min +
+ {-gunModelDefinition.pitch.min -
+ gunDefaultPitch +
(hasImprovedVerticalStabilizer ? 3 : 0)}
{gunModelDefinition.pitch.front && (
diff --git a/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx b/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
index 9001f3a6f..fada3703f 100644
--- a/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
+++ b/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
@@ -1,5 +1,6 @@
import { Flex, TextField } from '@radix-ui/themes';
import { use, useEffect, useRef } from 'react';
+import { degToRad, radToDeg } from 'three/src/math/MathUtils';
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
import { modelDefinitions } from '../../../../../../core/blitzkrieg/modelDefinitions';
import { modelTransformEvent } from '../../../../../../core/blitzkrieg/modelTransform';
@@ -20,22 +21,20 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
const mode = useTankopediaPersistent((state) => state.mode);
const hasCalibratedShells = useEquipment(103, true);
const hasEnhancedArmor = useEquipment(110);
-
- useEffect(() => {
- turretYawInput.current!.value = `${-Math.round(
- protagonist.yaw * (180 / Math.PI),
- )}`;
- }, [protagonist.yaw]);
- useEffect(() => {
- gunPitchInput.current!.value = `${-Math.round(
- protagonist.pitch * (180 / Math.PI),
- )}`;
- }, [protagonist.pitch]);
-
const tankModelDefinition = awaitedModelDefinitions[protagonist.tank.id];
const turretModelDefinition =
tankModelDefinition.turrets[protagonist.turret.id];
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
+ const initialGunPitch = tankModelDefinition.turretRotation?.pitch ?? 0;
+
+ useEffect(() => {
+ turretYawInput.current!.value = radToDeg(protagonist.yaw).toFixed(0);
+ }, [protagonist.yaw]);
+ useEffect(() => {
+ gunPitchInput.current!.value = (
+ -radToDeg(protagonist.pitch) + initialGunPitch
+ ).toFixed(0);
+ }, [protagonist.pitch]);
return (
{
const [pitch, yaw] = applyPitchYawLimits(
protagonist.pitch,
- -Number(turretYawInput.current?.value) * (Math.PI / 180),
+ degToRad(Number(turretYawInput.current!.value)),
gunModelDefinition.pitch,
turretModelDefinition.yaw,
);
@@ -81,9 +79,9 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
state.protagonist!.pitch = pitch;
state.protagonist!.yaw = yaw;
});
- turretYawInput.current!.value = `${Math.round(
- yaw * (180 / Math.PI),
- )}`;
+ turretYawInput.current!.value = radToDeg(protagonist.yaw).toFixed(
+ 0,
+ );
}}
onKeyDown={(event) => {
if (event.key === 'Enter') {
@@ -116,10 +114,11 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
Pitch
{
const [pitch, yaw] = applyPitchYawLimits(
- -Number(gunPitchInput.current?.value) * (Math.PI / 180),
+ degToRad(
+ -Number(gunPitchInput.current!.value) + initialGunPitch,
+ ),
protagonist.yaw,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
@@ -129,9 +128,9 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
state.protagonist!.pitch = pitch;
state.protagonist!.yaw = yaw;
});
- gunPitchInput.current!.value = `${Math.round(
- pitch * (180 / Math.PI),
- )}`;
+ gunPitchInput.current!.value = (
+ -radToDeg(protagonist.pitch) + initialGunPitch
+ ).toFixed(0);
}}
onKeyDown={(event) => {
if (event.key === 'Enter') {
diff --git a/src/core/blitzkrieg/assignDuelMember.ts b/src/core/blitzkrieg/assignDuelMember.ts
index aef3eab48..dd204dd7b 100644
--- a/src/core/blitzkrieg/assignDuelMember.ts
+++ b/src/core/blitzkrieg/assignDuelMember.ts
@@ -1,9 +1,11 @@
+import { degToRad } from 'three/src/math/MathUtils';
import {
DuelMember,
genericDefaultEquipmentMatrix,
mutateDuel,
} from '../../stores/duel';
import { availableProvisions } from './availableProvisions';
+import { modelDefinitions } from './modelDefinitions';
import { provisionDefinitions } from './provisionDefinitions';
import { tankDefinitions } from './tankDefinitions';
@@ -13,6 +15,8 @@ export async function assignDuelMember(
) {
const awaitedTankDefinitions = await tankDefinitions;
const awaitedProvisionDefinitions = await provisionDefinitions;
+ const awaitedModelDefinitions = await modelDefinitions;
+ const tankModelDefinition = awaitedModelDefinitions[id];
const tank = awaitedTankDefinitions[id];
const turret = tank.turrets.at(-1)!;
const gun = turret.guns.at(-1)!;
@@ -32,7 +36,7 @@ export async function assignDuelMember(
shell,
track,
equipment: genericDefaultEquipmentMatrix,
- pitch: 0,
+ pitch: degToRad(tankModelDefinition.turretRotation?.pitch ?? 0),
yaw: 0,
camouflage: true,
consumables: [],
From 01c491aee0f25b1158642e00ad2dd167e2534974 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 12 Mar 2024 17:40:58 -0500
Subject: [PATCH 4/6] feat: 1 more decimal in pitch and yaw
---
.../tankopedia/[id]/components/QuickInputs/index.tsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx b/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
index fada3703f..64e64ec3c 100644
--- a/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
+++ b/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
@@ -28,12 +28,12 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
const initialGunPitch = tankModelDefinition.turretRotation?.pitch ?? 0;
useEffect(() => {
- turretYawInput.current!.value = radToDeg(protagonist.yaw).toFixed(0);
+ turretYawInput.current!.value = radToDeg(protagonist.yaw).toFixed(1);
}, [protagonist.yaw]);
useEffect(() => {
gunPitchInput.current!.value = (
-radToDeg(protagonist.pitch) + initialGunPitch
- ).toFixed(0);
+ ).toFixed(1);
}, [protagonist.pitch]);
return (
@@ -80,7 +80,7 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
state.protagonist!.yaw = yaw;
});
turretYawInput.current!.value = radToDeg(protagonist.yaw).toFixed(
- 0,
+ 1,
);
}}
onKeyDown={(event) => {
@@ -130,7 +130,7 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
});
gunPitchInput.current!.value = (
-radToDeg(protagonist.pitch) + initialGunPitch
- ).toFixed(0);
+ ).toFixed(1);
}}
onKeyDown={(event) => {
if (event.key === 'Enter') {
From caff7bb6d06be9ba516917443bdeba5f0762e54a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 12 Mar 2024 18:00:00 -0500
Subject: [PATCH 5/6] feat: improved vertical stablizer model compat
---
.../[id]/components/Characteristics/index.tsx | 12 +++++++
.../tankopedia/[id]/components/Control.tsx | 7 +++-
.../[id]/components/Model/TankSandbox.tsx | 6 ++++
.../components/Model/components/TankModel.tsx | 10 ++++--
.../[id]/components/QuickInputs/index.tsx | 3 ++
src/core/blitz/applyPitchYawLimits.ts | 35 +++++++++----------
6 files changed, 51 insertions(+), 22 deletions(-)
diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
index 8a1846a10..48efd9cc0 100644
--- a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
+++ b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx
@@ -4,6 +4,7 @@ import { debounce } from 'lodash';
import { use, useEffect, useRef, useState } from 'react';
import { lerp } from 'three/src/math/MathUtils';
import { ShellButton } from '../../../../../../components/ModuleButtons/ShellButton';
+import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
import { isExplosive } from '../../../../../../core/blitz/isExplosive';
import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration';
import { coefficient } from '../../../../../../core/blitzkrieg/coefficient';
@@ -219,6 +220,17 @@ export function Characteristics() {
penetrationDistanceInput.current.value = `${penetrationDistance}`;
}
}, [penetrationDistance]);
+ useEffect(() => {
+ mutateDuel((draft) => {
+ [draft.protagonist!.pitch, draft.protagonist!.yaw] = applyPitchYawLimits(
+ draft.protagonist!.pitch,
+ draft.protagonist!.yaw,
+ gunModelDefinition.pitch,
+ turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
+ );
+ });
+ }, [hasImprovedVerticalStabilizer]);
return (
diff --git a/src/app/tools/tankopedia/[id]/components/Control.tsx b/src/app/tools/tankopedia/[id]/components/Control.tsx
index 8cef95e33..956c9815f 100644
--- a/src/app/tools/tankopedia/[id]/components/Control.tsx
+++ b/src/app/tools/tankopedia/[id]/components/Control.tsx
@@ -4,6 +4,7 @@ import { useEffect, useRef } from 'react';
import { Vector3 } from 'three';
import { OrbitControls as OrbitControlsClass } from 'three-stdlib';
import { applyPitchYawLimits } from '../../../../../core/blitz/applyPitchYawLimits';
+import { hasEquipment } from '../../../../../core/blitzkrieg/hasEquipment';
import { modelDefinitions } from '../../../../../core/blitzkrieg/modelDefinitions';
import { Pose, poseEvent } from '../../../../../core/blitzkrieg/pose';
import { useAwait } from '../../../../../hooks/useAwait';
@@ -67,7 +68,9 @@ export function Controls() {
},
);
- function handlePoseEvent(event: Pose) {
+ async function handlePoseEvent(event: Pose) {
+ const hasImprovedVerticalStabilizer = await hasEquipment(122);
+
switch (event) {
case Pose.HullDown: {
const [pitch] = applyPitchYawLimits(
@@ -75,6 +78,7 @@ export function Controls() {
0,
protagonistGunModelDefinition.pitch,
protagonistTurretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
camera.position
@@ -106,6 +110,7 @@ export function Controls() {
0,
protagonistGunModelDefinition.pitch,
protagonistTurretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
camera.position
diff --git a/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx b/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx
index 3e077f02b..8d814b3ca 100644
--- a/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx
+++ b/src/app/tools/tankopedia/[id]/components/Model/TankSandbox.tsx
@@ -11,6 +11,7 @@ import { modelDefinitions } from '../../../../../../core/blitzkrieg/modelDefinit
import { modelTransformEvent } from '../../../../../../core/blitzkrieg/modelTransform';
import { Pose, poseEvent } from '../../../../../../core/blitzkrieg/pose';
import { tankIcon } from '../../../../../../core/blitzkrieg/tankIcon';
+import { useEquipment } from '../../../../../../hooks/useEquipment';
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
import mutateTankopediaPersistent, {
@@ -29,6 +30,7 @@ import { TankModel } from './components/TankModel';
export function TankSandbox() {
const canvas = useRef(null);
+ const hasImprovedVerticalStabilizer = useEquipment(122);
const awaitedModelDefinitions = use(modelDefinitions);
const canvasWrapper = useRef(null);
const [isFullScreen, setIsFullScreen] = useState(false);
@@ -70,6 +72,7 @@ export function TankSandbox() {
0,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
@@ -87,6 +90,7 @@ export function TankSandbox() {
0,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
@@ -104,6 +108,7 @@ export function TankSandbox() {
0,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
@@ -131,6 +136,7 @@ export function TankSandbox() {
draft.protagonist!.yaw,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
});
}, [protagonist.gun, protagonist.turret]);
diff --git a/src/app/tools/tankopedia/[id]/components/Model/components/TankModel.tsx b/src/app/tools/tankopedia/[id]/components/Model/components/TankModel.tsx
index e5253be2e..ac88d0f86 100644
--- a/src/app/tools/tankopedia/[id]/components/Model/components/TankModel.tsx
+++ b/src/app/tools/tankopedia/[id]/components/Model/components/TankModel.tsx
@@ -4,6 +4,7 @@ import { Euler, Group, Vector3 } from 'three';
import { degToRad } from 'three/src/math/MathUtils';
import { I_HAT, J_HAT, K_HAT } from '../../../../../../../constants/axis';
import { applyPitchYawLimits } from '../../../../../../../core/blitz/applyPitchYawLimits';
+import { hasEquipment } from '../../../../../../../core/blitzkrieg/hasEquipment';
import { jsxTree } from '../../../../../../../core/blitzkrieg/jsxTree';
import { modelDefinitions } from '../../../../../../../core/blitzkrieg/modelDefinitions';
import {
@@ -106,7 +107,6 @@ export const TankModel = memo(() => {
const turretModelDefinition =
tankModelDefinition.turrets[protagonist.turret.id];
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
-
const { gltf } = useModel(protagonist.tank.id);
const nodes = Object.values(gltf.nodes);
@@ -161,12 +161,14 @@ export const TankModel = memo(() => {
window.addEventListener('pointerup', handlePointerUp);
}
}
- function handlePointerMove(event: PointerEvent) {
+ async function handlePointerMove(event: PointerEvent) {
+ const hasImprovedVerticalStabilizer = await hasEquipment(122);
[pitch, yaw] = applyPitchYawLimits(
pitch,
yaw + event.movementX * (Math.PI / canvas.width),
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
}
@@ -220,12 +222,14 @@ export const TankModel = memo(() => {
window.addEventListener('pointermove', handlePointerMove);
window.addEventListener('pointerup', handlePointerUp);
}
- function handlePointerMove(event: PointerEvent) {
+ async function handlePointerMove(event: PointerEvent) {
+ const hasImprovedVerticalStabilizer = await hasEquipment(122);
[pitch, yaw] = applyPitchYawLimits(
pitch - event.movementY * (Math.PI / canvas.height),
yaw + event.movementX * (Math.PI / canvas.width),
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
}
diff --git a/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx b/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
index 64e64ec3c..e827b1dc6 100644
--- a/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
+++ b/src/app/tools/tankopedia/[id]/components/QuickInputs/index.tsx
@@ -26,6 +26,7 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
tankModelDefinition.turrets[protagonist.turret.id];
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
const initialGunPitch = tankModelDefinition.turretRotation?.pitch ?? 0;
+ const hasImprovedVerticalStabilizer = useEquipment(122);
useEffect(() => {
turretYawInput.current!.value = radToDeg(protagonist.yaw).toFixed(1);
@@ -73,6 +74,7 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
degToRad(Number(turretYawInput.current!.value)),
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
mutateDuel((state) => {
@@ -122,6 +124,7 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
protagonist.yaw,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
+ hasImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
mutateDuel((state) => {
diff --git a/src/core/blitz/applyPitchYawLimits.ts b/src/core/blitz/applyPitchYawLimits.ts
index 7565ac3bf..580e1f545 100644
--- a/src/core/blitz/applyPitchYawLimits.ts
+++ b/src/core/blitz/applyPitchYawLimits.ts
@@ -1,4 +1,5 @@
import { clamp } from 'lodash';
+import { degToRad } from 'three/src/math/MathUtils';
import { PitchLimits, YawLimits } from '../blitzkrieg/modelDefinitions';
import { normalizeAngleRad } from '../math/normalizeAngleRad';
@@ -7,33 +8,31 @@ export function applyPitchYawLimits(
yaw: number, // rad
pitchLimits: PitchLimits, // deg
yawLimits?: YawLimits, // deg
+ verticalStabilizer = false,
) {
let newPitch = pitch;
let newYaw = yaw;
if (yawLimits) {
newYaw = normalizeAngleRad(
- clamp(
- newYaw,
- -yawLimits.max * (Math.PI / 180),
- -yawLimits.min * (Math.PI / 180),
- ),
+ clamp(newYaw, -degToRad(yawLimits.max), -degToRad(yawLimits.min)),
);
}
- let lowerPitch = -pitchLimits.max * (Math.PI / 180);
- let upperPitch = -pitchLimits.min * (Math.PI / 180);
- const transition = (pitchLimits.transition ?? 10) * (Math.PI / 180);
+ const pitchBuff = verticalStabilizer ? degToRad(3) : 0;
+ let lowerPitch = -degToRad(pitchLimits.max) - pitchBuff;
+ let upperPitch = -degToRad(pitchLimits.min) + pitchBuff;
+ const transition = degToRad(pitchLimits.transition ?? 10);
if (pitchLimits.back) {
- const range = pitchLimits.back.range * (Math.PI / 180);
+ const range = degToRad(pitchLimits.back.range);
const yawRotatedAbs = Math.abs(normalizeAngleRad(newYaw - Math.PI));
if (yawRotatedAbs <= range + transition) {
if (yawRotatedAbs <= range) {
// inside range
- lowerPitch = -pitchLimits.back.max * (Math.PI / 180);
- upperPitch = -pitchLimits.back.min * (Math.PI / 180);
+ lowerPitch = -degToRad(pitchLimits.back.max);
+ upperPitch = -degToRad(pitchLimits.back.min);
} else {
// inside transition
const transitionProgress = (yawRotatedAbs - range) / transition;
@@ -44,21 +43,21 @@ export function applyPitchYawLimits(
(1 - transitionProgress) * pitchLimits.back.min +
transitionProgress * pitchLimits.min;
- lowerPitch = -maxInterpolatedPitch * (Math.PI / 180);
- upperPitch = -minInterpolatedPitch * (Math.PI / 180);
+ lowerPitch = -degToRad(maxInterpolatedPitch);
+ upperPitch = -degToRad(minInterpolatedPitch);
}
}
}
if (pitchLimits.front) {
- const range = pitchLimits.front.range * (Math.PI / 180);
+ const range = degToRad(pitchLimits.front.range);
const yawAbs = Math.abs(normalizeAngleRad(newYaw));
if (yawAbs <= range + transition) {
if (yawAbs <= range) {
// inside range
- lowerPitch = -pitchLimits.front.max * (Math.PI / 180);
- upperPitch = -pitchLimits.front.min * (Math.PI / 180);
+ lowerPitch = -degToRad(pitchLimits.front.max);
+ upperPitch = -degToRad(pitchLimits.front.min);
} else {
// inside transition
const transitionProgress = (yawAbs - range) / transition;
@@ -69,8 +68,8 @@ export function applyPitchYawLimits(
(1 - transitionProgress) * pitchLimits.front.min +
transitionProgress * pitchLimits.min;
- lowerPitch = -maxInterpolatedPitch * (Math.PI / 180);
- upperPitch = -minInterpolatedPitch * (Math.PI / 180);
+ lowerPitch = -degToRad(maxInterpolatedPitch);
+ upperPitch = -degToRad(minInterpolatedPitch);
}
}
}
From 37a2ba35660f3057ddd99408d0f02ecba84ac804 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 12 Mar 2024 18:07:32 -0500
Subject: [PATCH 6/6] feat: docs
---
.vscode/settings.json | 1 +
docs/changelogs/1.16.2 copy.md | 36 ++++++++++++++++++++++++++++++++++
docs/changelogs/1.16.3.md | 21 ++++++++++++++++++++
3 files changed, 58 insertions(+)
create mode 100644 docs/changelogs/1.16.2 copy.md
create mode 100644 docs/changelogs/1.16.3.md
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 40ca50cf8..b72b99f10 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -73,6 +73,7 @@
"lods",
"metallicness",
"minitelrose",
+ "Minotauro",
"MIPMAPCOUNT",
"modeltransform",
"MURICA",
diff --git a/docs/changelogs/1.16.2 copy.md b/docs/changelogs/1.16.2 copy.md
new file mode 100644
index 000000000..09b4bce4d
--- /dev/null
+++ b/docs/changelogs/1.16.2 copy.md
@@ -0,0 +1,36 @@
+# Blitzkrieg 1.16.2
+
+¡Hola desde el mundo del español!
+
+## Features
+
+- Added translations for Spanish to the bot
+ - Your language will be inferred automatically from your Discord settings
+ - Any untranslated languages and words we forgot to translate will be left in English
+ - If you have your language set to Spanish and see English in any places, please let us know on [the official Discord server](https://discord.gg/nDt7AjGJQH)
+ - All `/about` commands except for `commands` remain in English
+ - Tank names are still in English
+ - The website remains unchanged
+- The title bar (featured as the big text on top of most commands) has now been made more compact
+
+## Changes
+
+- "Tank type" is now called "tank class"
+- Removed `/player-achievements` and `search-tanks`
+ - They will be reintroduced in the future in a far better way
+ - Also removed a `SKLLD` server exclusive `/eligible` command
+ - This will be generalized for all clans in the future
+
+## Fixes
+
+- Fixed the red glowing floor underneath the tank sandbox
+ - This has been replaced with a static image
+- The refresh button is now properly removed when lacking permissions
+- Tank names that start with a number are now properly inferred from command inputs
+
+## Technical Changes
+
+- Command registration is now error tolerant meaning that if a single command fails to initiate, it will be discarded until the next restart
+ - We are currently looking into how we can allow the command to retry registration after a fixed amount of time
+- Due to the implications of the code added which can be very easily exploited by hackers, a single file has been added to the repository as a closed source submodule and will remain closed unless a third party open-source implementation is made public
+- Removed preview commands
diff --git a/docs/changelogs/1.16.3.md b/docs/changelogs/1.16.3.md
new file mode 100644
index 000000000..d510ba31d
--- /dev/null
+++ b/docs/changelogs/1.16.3.md
@@ -0,0 +1,21 @@
+# Blitzkrieg 1.16.3
+
+Further polishing and corrections for the Tankopedia.
+
+## Features
+
+- Added a few more stats to view for the Tankopedia
+ - Added the count of shells in the magazine for auto-reloaders
+ - The optimal shell index was moved below this stats
+ - Shell reloads for auto-reloaders now abide crew stats
+ - Intra-clip is now also shown for auto-reloaders
+- Added 1 more decimal place worth of precision when viewing and changing gun pitch and yaw
+
+## Fixes
+
+- "Inter-clip" is now correctly spelled as "intra-clip"
+- Tanks with initial gun pitches (like the Minotauro) are now handled correctly
+ - The stats now reflect the fact that the gun is naturally pitched downwards
+ - The view model now compensates for the natural pitch
+- Tanks with the improved vertical stabilizer equipment are now handled correctly
+ - The view model now allows you to pitch the gun further as intended when the equipment is on