fix: update all

This commit is contained in:
TrèsAbhi committed 2026-03-31 14:11:45 -05:00
1 parent bdea9fdab3
commit e2f50871ec
86 files changed
+1939 -1537

No files matched your search

@@ -24,7 +24,7 @@ export function Crew({ stats }: StatsAcceptorProps) {
provisionDefinitions.provisions[provision].crew
? total + provisionDefinitions.provisions[provision].crew! / 100
: total,
0
0,
) + (hasImprovedVentilation ? 0.08 : 0);
const commanderMastery = 1 + provisionCrewBonus;
@@ -71,7 +71,7 @@ export function Crew({ stats }: StatsAcceptorProps) {
decimals={0}
noRanking
value={() =>
(member.type === CrewType.COMMANDER
(member.type === CrewType.CREW_TYPE_COMMANDER
? commanderMastery
: commanderMastery * 1.1) * 100
}
@@ -93,7 +93,7 @@ export function Crew({ stats }: StatsAcceptorProps) {
? strings.website.tools.tankopedia.crew[
CREW_MEMBER_NAMES[sub]
]
: sub
: sub,
)
.join(", ")}
</Flex>
@@ -38,7 +38,7 @@ export function Firepower({
const selected = thisShell.id === shell.id;
return (
<Tooltip content={unwrap(thisShell.name)} key={thisShell.id}>
<Tooltip content={unwrap(thisShell.name!)} key={thisShell.id}>
<IconButton
color={selected ? undefined : "gray"}
variant={selected ? "solid" : "soft"}
@@ -59,7 +59,7 @@ export function Firepower({
}}
>
<img
alt={unwrap(thisShell.name)}
alt={unwrap(thisShell.name!)}
width={16}
height={16}
src={asset(`icons/shells/${thisShell.icon}.webp`)}
@@ -119,7 +119,7 @@ export function Firepower({
name={literals(
strings.website.tools.tankopedia.characteristics.values
.shell_index,
{ index: index + 1 }
{ index: index + 1 },
)}
decimals={2}
deltaType="lowerIsBetter"
@@ -191,7 +191,7 @@ export function Firepower({
name={literals(
strings.website.tools.tankopedia.characteristics.values
.dispersion_at_distance,
{ distance: 100 }
{ distance: 100 },
)}
/>
<InfoWithDelta
@@ -249,7 +249,7 @@ export function Firepower({
/>
<InfoWithDelta value="gunDepression" stats={stats} decimals={1} indent />
<InfoWithDelta stats={stats} decimals={1} indent value="gunElevation" />
{gunModelDefinition.pitch.front && (
{gunModelDefinition.pitch!.front && (
<>
<InfoWithDelta
stats={stats}
@@ -265,7 +265,7 @@ export function Firepower({
/>
</>
)}
{gunModelDefinition.pitch.back && (
{gunModelDefinition.pitch!.back && (
<>
<InfoWithDelta
stats={stats}
@@ -1,13 +1,13 @@
import type { QuicklimeEvent } from 'quicklime';
import { useEffect, useRef } from 'react';
import type { Group } from 'three';
import { awaitableModelDefinitions } from '../../../../../../../../core/awaitables/modelDefinitions';
import type { QuicklimeEvent } from "quicklime";
import { useEffect, useRef } from "react";
import type { Group } from "three";
import { awaitableModelDefinitions } from "../../../../../../../../core/awaitables/modelDefinitions";
import {
modelTransformEvent,
type ModelTransformEventData,
} from '../../../../../../../../core/blitzkit/modelTransform';
import { Duel } from '../../../../../../../../stores/duel';
import { ModelChunk } from './ModelChunk';
} from "../../../../../../../../core/blitzkit/modelTransform";
import { Duel } from "../../../../../../../../stores/duel";
import { ModelChunk } from "./ModelChunk";
const modelDefinitions = await awaitableModelDefinitions;
@@ -39,8 +39,8 @@ export function CanvasContent() {
}, []);
return (
<>
<group ref={hullWrapper} position={[0, 0, turretModel.gun_origin.z]}>
<group position={[0, 0, -turretModel.gun_origin.z]}>
<group ref={hullWrapper} position={[0, 0, turretModel.gun_origin!.z]}>
<group position={[0, 0, -turretModel.gun_origin!.z]}>
<ModelChunk only="body" />
</group>
</group>
@@ -1,13 +1,13 @@
import { mauveDark } from '@radix-ui/colors';
import { LineBasicMaterial, MeshBasicMaterial } from 'three';
import { awaitableModelDefinitions } from '../../../../../../../../core/awaitables/modelDefinitions';
import { jsxTree } from '../../../../../../../../core/blitzkit/jsxTree';
import { useModel } from '../../../../../../../../hooks/useModel';
import { Duel } from '../../../../../../../../stores/duel';
import { mauveDark } from "@radix-ui/colors";
import { LineBasicMaterial, MeshBasicMaterial } from "three";
import { awaitableModelDefinitions } from "../../../../../../../../core/awaitables/modelDefinitions";
import { jsxTree } from "../../../../../../../../core/blitzkit/jsxTree";
import { useModel } from "../../../../../../../../hooks/useModel";
import { Duel } from "../../../../../../../../stores/duel";
const modelDefinitions = await awaitableModelDefinitions;
const surfaceMaterial: Record<Props['only'], MeshBasicMaterial> = {
const surfaceMaterial: Record<Props["only"], MeshBasicMaterial> = {
gun: new MeshBasicMaterial({
color: mauveDark.mauve8,
toneMapped: false,
@@ -23,7 +23,7 @@ const surfaceMaterial: Record<Props['only'], MeshBasicMaterial> = {
opacity: 0.5,
}),
};
const outlineMaterial: Record<Props['only'], LineBasicMaterial> = {
const outlineMaterial: Record<Props["only"], LineBasicMaterial> = {
gun: new LineBasicMaterial({
color: mauveDark.mauve11,
toneMapped: false,
@@ -41,7 +41,7 @@ const outlineMaterial: Record<Props['only'], LineBasicMaterial> = {
};
interface Props {
only: 'gun' | 'turret' | 'body';
only: "gun" | "turret" | "body";
}
export function ModelChunk({ only }: Props) {
@@ -53,8 +53,8 @@ export function ModelChunk({ only }: Props) {
const turretModel = tankModel.turrets[turret.id];
const gunModel = turretModel.guns[gun.id];
const originZ = tankModel.turret_origin.z + turretModel.gun_origin.z;
const originY = tankModel.turret_origin.y + turretModel.gun_origin.y;
const originZ = tankModel.turret_origin!.z + turretModel.gun_origin!.z;
const originY = tankModel.turret_origin!.y + turretModel.gun_origin!.y;
const { gltf } = useModel(tank.id);
const nodes = Object.values(gltf.nodes);
@@ -64,25 +64,25 @@ export function ModelChunk({ only }: Props) {
{nodes.map((node) => {
const isCurrentMantlet =
node.name ===
`gun_${gunModel.model_id.toString().padStart(2, '0')}_mask`;
`gun_${gunModel.model_id.toString().padStart(2, "0")}_mask`;
const isCurrentGun =
node.name === `gun_${gunModel.model_id.toString().padStart(2, '0')}`;
node.name === `gun_${gunModel.model_id.toString().padStart(2, "0")}`;
const isGun = isCurrentGun || isCurrentMantlet;
const isCurrentTurret =
node.name ===
`turret_${turretModel.model_id.toString().padStart(2, '0')}`;
`turret_${turretModel.model_id.toString().padStart(2, "0")}`;
const isTurret = isCurrentTurret;
const isHull = node.name === 'hull';
const isWheel = node.name.startsWith('chassis_wheel_');
const isTrack = node.name.startsWith('chassis_track_');
const isHull = node.name === "hull";
const isWheel = node.name.startsWith("chassis_wheel_");
const isTrack = node.name.startsWith("chassis_track_");
const isBody = isHull || isWheel || isTrack;
if (
(only === 'gun' && !isGun) ||
(only === 'turret' && !isTurret) ||
(only === 'body' && !isBody)
(only === "gun" && !isGun) ||
(only === "turret" && !isTurret) ||
(only === "body" && !isBody)
) {
return null;
}
@@ -51,21 +51,21 @@ export function GunFlexibilityVisualizer({
const [yaw, setYaw] = useState(0);
const [pitch, setPitch] = useState(0);
const [minPitch, setMinPitch] = useState(
-degToRad(gunModel.pitch.front?.max ?? gunModel.pitch.max)
-degToRad(gunModel.pitch!.front?.max ?? gunModel.pitch!.max),
);
const [maxPitch, setMaxPitch] = useState(
-degToRad(gunModel.pitch.front?.min ?? gunModel.pitch.min)
-degToRad(gunModel.pitch!.front?.min ?? gunModel.pitch!.min),
);
const container = useRef<HTMLDivElement>(null);
const highlighter = useRef<HTMLDivElement>(null);
const pointer = useRef<HTMLDivElement>(null);
const p = gunModel.pitch;
const p = gunModel.pitch!;
const y = turretModel.yaw;
const f = p.front;
const b = p.back;
const t = gunModel.pitch.transition ?? DEFAULT_PITCH_TRANSITION;
const t = gunModel.pitch!.transition ?? DEFAULT_PITCH_TRANSITION;
let d = "";
@@ -223,12 +223,12 @@ export function GunFlexibilityVisualizer({
const hasImprovedVerticalStabilizer = hasEquipment(
122,
Duel.state.protagonist.tank.equipment_preset,
Duel.state.protagonist.equipmentMatrix
Duel.state.protagonist.equipmentMatrix,
);
const hasDownImprovedVerticalStabilizer = hasEquipment(
124,
Duel.state.protagonist.tank.equipment_preset,
Duel.state.protagonist.equipmentMatrix
Duel.state.protagonist.equipmentMatrix,
);
const min = applyPitchYawLimits(
@@ -237,7 +237,7 @@ export function GunFlexibilityVisualizer({
p,
y,
hasImprovedVerticalStabilizer,
hasDownImprovedVerticalStabilizer
hasDownImprovedVerticalStabilizer,
);
const max = applyPitchYawLimits(
Math.PI,
@@ -245,7 +245,7 @@ export function GunFlexibilityVisualizer({
p,
y,
hasImprovedVerticalStabilizer,
hasDownImprovedVerticalStabilizer
hasDownImprovedVerticalStabilizer,
);
yaw = min[1];
@@ -15,7 +15,7 @@ export function ShellSwitcher() {
const selected = thisShell.id === shell.id;
return (
<Tooltip content={unwrap(thisShell.name)} key={thisShell.id}>
<Tooltip content={unwrap(thisShell.name!)} key={thisShell.id}>
<IconButton
size="3"
color={selected ? undefined : "gray"}
@@ -36,7 +36,7 @@ export function ShellSwitcher() {
}}
>
<img
alt={unwrap(thisShell.name)}
alt={unwrap(thisShell.name!)}
style={{ width: "1.125rem", height: "1.125rem" }}
src={asset(`icons/shells/${thisShell.icon}.webp`)}
/>
@@ -26,13 +26,13 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
const consumables = Duel.use((state) => state.protagonist.consumables);
const camouflage = Duel.use((state) => state.protagonist.camouflage);
const assaultDistance = Duel.use(
(state) => state.protagonist.assaultDistance
(state) => state.protagonist.assaultDistance,
);
const equipmentMatrix = Duel.use(
(state) => state.protagonist.equipmentMatrix
(state) => state.protagonist.equipmentMatrix,
);
const { tank, turret, gun, engine, track, shell } = Duel.use(
(state) => state.protagonist
(state) => state.protagonist,
);
const stockEngine = tank.engines[0];
const stockTrack = tank.tracks[0];
@@ -67,7 +67,7 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
tankModelDefinition,
equipmentDefinitions: equipmentDefinitions,
provisionDefinitions: provisionDefinitions,
}
},
);
const hasImprovedVerticalStabilizer = useEquipment(122);
@@ -77,10 +77,10 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
const [pitch, yaw] = applyPitchYawLimits(
modelTransformEvent.last!.pitch,
modelTransformEvent.last!.yaw,
gunModelDefinition.pitch,
gunModelDefinition.pitch!,
turretModelDefinition.yaw,
hasImprovedVerticalStabilizer,
hasDownImprovedVerticalStabilizer
hasDownImprovedVerticalStabilizer,
);
modelTransformEvent.dispatch({ pitch, yaw });
@@ -43,11 +43,11 @@ interface ModuleWithUnlocks {
}
const moduleTypeTypeIconName: Record<ModuleType, string> = {
[ModuleType.VEHICLE]: "",
[ModuleType.ENGINE]: "engine",
[ModuleType.TRACKS]: "chassis",
[ModuleType.TURRET]: "turret",
[ModuleType.GUN]: "gun",
[ModuleType.MODULE_TYPE_VEHICLE]: "",
[ModuleType.MODULE_TYPE_ENGINE]: "engine",
[ModuleType.MODULE_TYPE_TRACKS]: "chassis",
[ModuleType.MODULE_TYPE_TURRET]: "turret",
[ModuleType.MODULE_TYPE_GUN]: "gun",
};
function ModuleButton({
@@ -63,7 +63,7 @@ function ModuleButton({
top: boolean;
onClick: () => void;
}) {
const isTank = unlock.type === ModuleType.VEHICLE;
const isTank = unlock.type === ModuleType.MODULE_TYPE_VEHICLE;
const { locale } = useLocale();
const button = (
@@ -91,7 +91,7 @@ function ModuleButton({
{TIER_ROMAN_NUMERALS[tier]}
</Text>
{unlock.cost.value > 0 && (
{unlock.cost!.value > 0 && (
<Flex
style={{
position: "absolute",
@@ -103,12 +103,12 @@ function ModuleButton({
gap={isTank ? "1" : undefined}
>
<Text size="1" color="gray">
{formatCompact(locale, unlock.cost.value)}
{formatCompact(locale, unlock.cost!.value)}
</Text>
<img
alt={unlock.cost.type}
src={asset(`icons/currencies/${unlock.cost.type}.webp`)}
alt={unlock.cost!.type}
src={asset(`icons/currencies/${unlock.cost!.type}.webp`)}
style={{
width: 12,
height: 12,
@@ -171,16 +171,16 @@ export function Modules() {
function setByUnlock(unlock: Unlock) {
Duel.mutate((draft) => {
if (unlock.type === ModuleType.TURRET) {
if (unlock.type === ModuleType.MODULE_TYPE_TURRET) {
draft.protagonist.turret = draft.protagonist.tank.turrets.find(
(turret) => turret.id === unlock.id
(turret) => turret.id === unlock.id,
)!;
// Check if current gun exists in new turret
const gunInNewTurret = draft.protagonist.turret.guns.find(
(gun) => gun.id === draft.protagonist.gun.id
(gun) => gun.id === draft.protagonist.gun.id,
);
if (gunInNewTurret) {
// Gun exists - get it FROM this turret
draft.protagonist.gun = gunInNewTurret;
@@ -190,9 +190,9 @@ export function Modules() {
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
draft.protagonist.shell = draft.protagonist.gun.shells[0];
}
} else if (unlock.type === ModuleType.GUN) {
} else if (unlock.type === ModuleType.MODULE_TYPE_GUN) {
const gunInTurret = draft.protagonist.turret.guns.find(
(gun) => gun.id === unlock.id
(gun) => gun.id === unlock.id,
);
if (gunInTurret) {
draft.protagonist.gun = gunInTurret;
@@ -200,23 +200,23 @@ export function Modules() {
} else {
// TODO: warn somehow?
const suitableTurret = draft.protagonist.tank.turrets.find((turret) =>
turret.guns.some((gun) => gun.id === unlock.id)
turret.guns.some((gun) => gun.id === unlock.id),
)!;
const gunInSuitableTurret = suitableTurret.guns.find(
(gun) => gun.id === unlock.id
(gun) => gun.id === unlock.id,
)!;
draft.protagonist.turret = suitableTurret;
draft.protagonist.gun = gunInSuitableTurret;
draft.protagonist.shell = gunInSuitableTurret.shells[0];
}
} else if (unlock.type === ModuleType.ENGINE) {
} else if (unlock.type === ModuleType.MODULE_TYPE_ENGINE) {
draft.protagonist.engine = draft.protagonist.tank.engines.find(
(engine) => engine.id === unlock.id
(engine) => engine.id === unlock.id,
)!;
} else if (unlock.type === ModuleType.TRACKS) {
} else if (unlock.type === ModuleType.MODULE_TYPE_TRACKS) {
draft.protagonist.track = draft.protagonist.tank.tracks.find(
(track) => track.id === unlock.id
(track) => track.id === unlock.id,
)!;
}
});
@@ -231,19 +231,19 @@ export function Modules() {
const central = !first && !last;
let module: ModuleDefinition | TankDefinition | undefined = undefined;
if (unlock.type === ModuleType.TRACKS) {
if (unlock.type === ModuleType.MODULE_TYPE_TRACKS) {
module = tank.tracks.find((track) => track.id === unlock.id)!;
} else if (unlock.type === ModuleType.ENGINE) {
} else if (unlock.type === ModuleType.MODULE_TYPE_ENGINE) {
module = tank.engines.find((engine) => engine.id === unlock.id)!;
} else if (unlock.type === ModuleType.TURRET) {
} else if (unlock.type === ModuleType.MODULE_TYPE_TURRET) {
module = tank.turrets.find((turret) => turret.id === unlock.id)!;
} else if (unlock.type === ModuleType.GUN) {
} else if (unlock.type === ModuleType.MODULE_TYPE_GUN) {
module = tank.turrets
.find((turret) =>
turret.guns.some((gun) => gun.id === unlock.id)
turret.guns.some((gun) => gun.id === unlock.id),
)!
.guns.find((gun) => gun.id === unlock.id)!;
} else if (unlock.type === ModuleType.VEHICLE) {
} else if (unlock.type === ModuleType.MODULE_TYPE_VEHICLE) {
module = tankDefinitions.tanks[unlock.id];
}
@@ -257,7 +257,7 @@ export function Modules() {
gap="2"
position="relative"
>
{unlock.cost.value > 0 && (
{unlock.cost!.value > 0 && (
<>
{unlocks.length > 1 && (
<div
@@ -302,24 +302,24 @@ export function Modules() {
unlock={unlock}
tier={extractModule(module).tier}
selected={
(unlock.type === ModuleType.TURRET
(unlock.type === ModuleType.MODULE_TYPE_TURRET
? turret.id
: unlock.type === ModuleType.GUN
: unlock.type === ModuleType.MODULE_TYPE_GUN
? gun.id
: unlock.type === ModuleType.ENGINE
: unlock.type === ModuleType.MODULE_TYPE_ENGINE
? engine.id
: unlock.type === ModuleType.TRACKS
: unlock.type === ModuleType.MODULE_TYPE_TRACKS
? track.id
: -1) === unlock.id
}
top={
unlock.type === ModuleType.TURRET
unlock.type === ModuleType.MODULE_TYPE_TURRET
? extractModule(module).id == topTurret.id
: unlock.type === ModuleType.GUN
: unlock.type === ModuleType.MODULE_TYPE_GUN
? extractModule(module).id === topGun.id
: unlock.type === ModuleType.ENGINE
: unlock.type === ModuleType.MODULE_TYPE_ENGINE
? extractModule(module).id === topEngine.id
: unlock.type === ModuleType.TRACKS
: unlock.type === ModuleType.MODULE_TYPE_TRACKS
? extractModule(module).id === topTrack.id
: false
}
@@ -342,7 +342,7 @@ export function Modules() {
{(extractModule(module) as ModuleWithUnlocks).unlocks &&
tree(
type,
(extractModule(module) as ModuleWithUnlocks).unlocks!
(extractModule(module) as ModuleWithUnlocks).unlocks!,
)}
</Flex>
);
@@ -397,32 +397,32 @@ export function Modules() {
</Flex>
<Flex gap="2" wrap="wrap" gapY="6">
{tree(ModuleType.ENGINE, [
{tree(ModuleType.MODULE_TYPE_ENGINE, [
{
cost: { type: "xp", value: 0 },
id: engine0.id,
type: ModuleType.ENGINE,
type: ModuleType.MODULE_TYPE_ENGINE,
},
])}
{tree(ModuleType.TRACKS, [
{tree(ModuleType.MODULE_TYPE_TRACKS, [
{
cost: { type: "xp", value: 0 },
id: track0.id,
type: ModuleType.TRACKS,
type: ModuleType.MODULE_TYPE_TRACKS,
},
])}
{tree(ModuleType.TURRET, [
{tree(ModuleType.MODULE_TYPE_TURRET, [
{
cost: { type: "xp", value: 0 },
id: turret0.id,
type: ModuleType.TURRET,
type: ModuleType.MODULE_TYPE_TURRET,
},
])}
{tree(ModuleType.GUN, [
{tree(ModuleType.MODULE_TYPE_GUN, [
{
cost: { type: "xp", value: 0 },
id: gun0.id,
type: ModuleType.GUN,
type: ModuleType.MODULE_TYPE_GUN,
},
])}
</Flex>