fix: consider shells

This commit is contained in:
TrèsAbhi committed 2025-08-01 12:37:40 -05:00
1 parent e1b5b21fae
commit a704b291fd
7 files changed
+24 -13

No files matched your search

@@ -2,7 +2,10 @@ import { DragHandleDots2Icon } from '@radix-ui/react-icons';
import { Box, Flex, Text } from '@radix-ui/themes';
import { useEffect, useRef, useState } from 'react';
import { clamp } from 'three/src/math/MathUtils.js';
import { fakeLogInverse } from '../../../../../../../../../core/blitzkit/fakeLog';
import {
fakeLog,
fakeLogInverse,
} from '../../../../../../../../../core/blitzkit/fakeLog';
import { Var } from '../../../../../../../../../core/radix/var';
import { Duel } from '../../../../../../../../../stores/duel';
import './index.css';
@@ -13,7 +16,10 @@ interface Props {
}
export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) {
const [x, setX] = useState(0.5);
const assaultDistance = Duel.use(
(state) => state.protagonist.assaultDistance,
);
const [x, setX] = useState(fakeLog(assaultDistance / maxDistance, 2));
const cursor = useRef<HTMLDivElement>(null);
const mutateDuel = Duel.useMutation();
@@ -120,7 +120,7 @@ export function Firepower({ stats }: StatsAcceptorProps) {
<InfoWithDelta stats={stats} decimals={0} value="moduleDamage" />
<InfoWithDelta stats={stats} decimals={0} value="penetration" />
{gun.gun_type!.value.base.assault_ranges && (
{gun.gun_type!.value.base.assault_ranges?.types.includes(shell.type) && (
<AssaultRangesVisualizer
stats={stats}
ranges={gun.gun_type!.value.base.assault_ranges}
@@ -73,6 +73,9 @@ export function SceneProps() {
const crewSkills = TankopediaEphemeral.use((state) => state.skills);
const consumables = Duel.use((state) => state.protagonist.consumables);
const provisions = Duel.use((state) => state.protagonist.provisions);
const assaultDistance = Duel.use(
(state) => state.protagonist.assaultDistance,
);
const equipmentMatrix = Duel.use(
(state) => state.protagonist.equipmentMatrix,
);
@@ -96,7 +99,7 @@ export function SceneProps() {
stockTurret: tank.turrets[0],
stockTrack: tank.tracks[0],
track,
assaultDistance: 0,
assaultDistance,
},
{ equipmentDefinitions, provisionDefinitions, tankModelDefinition },
);