mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
fix: casing
This commit is contained in:
1 parent
ef52434a42
commit
fc8e0e55f0
34 files changed
+321
-304
No files matched your search
@@ -99,7 +99,7 @@ export function ArmorPlateDisplay() {
|
||||
const tank = draft.model;
|
||||
const turret = tank.turrets[protagonist.turret.id];
|
||||
const gun =
|
||||
turret.guns[protagonist.gun.gunType!.value.base.id];
|
||||
turret.guns[protagonist.gun.gun_type!.value.base.id];
|
||||
const track = tank.tracks[protagonist.track.id];
|
||||
|
||||
console.log(highlightArmor.name);
|
||||
@@ -154,10 +154,10 @@ export function ArmorPlateDisplay() {
|
||||
const initialTurret =
|
||||
initialTank.turrets[protagonist.turret.id];
|
||||
const gun =
|
||||
turret.guns[protagonist.gun.gunType!.value.base.id];
|
||||
turret.guns[protagonist.gun.gun_type!.value.base.id];
|
||||
const initialGun =
|
||||
initialTurret.guns[
|
||||
protagonist.gun.gunType!.value.base.id
|
||||
protagonist.gun.gun_type!.value.base.id
|
||||
];
|
||||
const track = tank.tracks[protagonist.track.id];
|
||||
const initialTrack =
|
||||
|
||||
@@ -25,10 +25,10 @@ export const PrimaryArmorScene = memo(() => {
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turretOrigin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gunOrigin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
||||
const isDynamicArmorActive = Duel.use((state) =>
|
||||
state.protagonist.consumables.includes(73),
|
||||
);
|
||||
@@ -69,7 +69,7 @@ export const PrimaryArmorScene = memo(() => {
|
||||
<group ref={turretContainer}>
|
||||
{armorNodes.map((node) => {
|
||||
const isCurrentTurret = node.name.startsWith(
|
||||
`turret_${turretModelDefinition.modelId.toString().padStart(2, '0')}`,
|
||||
`turret_${turretModelDefinition.model_id.toString().padStart(2, '0')}`,
|
||||
);
|
||||
const isVisible = isCurrentTurret;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
@@ -103,7 +103,7 @@ export const PrimaryArmorScene = memo(() => {
|
||||
<group ref={gunContainer}>
|
||||
{armorNodes.map((node) => {
|
||||
const isCurrentGun = node.name.startsWith(
|
||||
`gun_${gunModelDefinition.modelId.toString().padStart(2, '0')}`,
|
||||
`gun_${gunModelDefinition.model_id.toString().padStart(2, '0')}`,
|
||||
);
|
||||
const isVisible = isCurrentGun;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
|
||||
+4
-4
@@ -68,8 +68,8 @@ export function PrimaryArmorSceneComponent({
|
||||
);
|
||||
material.uniforms.isExplosive.value = isExplosive(shell.type);
|
||||
material.uniforms.canSplash.value = canSplash(shell.type);
|
||||
material.uniforms.damage.value = shell.armorDamage;
|
||||
material.uniforms.explosionRadius.value = shell.explosionRadius;
|
||||
material.uniforms.damage.value = shell.armor_damage;
|
||||
material.uniforms.explosionRadius.value = shell.explosion_radius;
|
||||
|
||||
const duel = duelStore.getState();
|
||||
await handleProtagonistEquipmentChange(duel.protagonist.equipmentMatrix);
|
||||
@@ -90,7 +90,7 @@ export function PrimaryArmorSceneComponent({
|
||||
const duel = duelStore.getState();
|
||||
const hasEnhancedArmor = await hasEquipment(
|
||||
110,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
material.uniforms.thickness.value = hasEnhancedArmor
|
||||
@@ -103,7 +103,7 @@ export function PrimaryArmorSceneComponent({
|
||||
const penetration = shell.penetration.near;
|
||||
const hasCalibratedShells = await hasEquipment(
|
||||
103,
|
||||
duel.antagonist.tank.equipmentPreset,
|
||||
duel.antagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turretOrigin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gunOrigin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
||||
const maskOrigin =
|
||||
gunModelDefinition.mask === undefined
|
||||
? undefined
|
||||
@@ -106,7 +106,7 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
<group ref={turretContainer}>
|
||||
{armorNodes.map((node) => {
|
||||
const isCurrentTurret = node.name.startsWith(
|
||||
`turret_${turretModelDefinition.modelId.toString().padStart(2, '0')}`,
|
||||
`turret_${turretModelDefinition.model_id.toString().padStart(2, '0')}`,
|
||||
);
|
||||
const isVisible = isCurrentTurret;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
@@ -141,7 +141,7 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
<group ref={gunContainer}>
|
||||
{armorNodes.map((node) => {
|
||||
const isCurrentGun = node.name.startsWith(
|
||||
`gun_${gunModelDefinition.modelId.toString().padStart(2, '0')}`,
|
||||
`gun_${gunModelDefinition.model_id.toString().padStart(2, '0')}`,
|
||||
);
|
||||
const isVisible = isCurrentGun;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
@@ -173,7 +173,7 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
})}
|
||||
|
||||
{modelNodes.map((node) => {
|
||||
const gunString = `gun_${gunModelDefinition.modelId
|
||||
const gunString = `gun_${gunModelDefinition.model_id
|
||||
.toString()
|
||||
.padStart(2, '0')}`;
|
||||
const isCurrentGun = gunModelDefinition.mask
|
||||
|
||||
+2
-2
@@ -58,7 +58,7 @@ export function SpacedArmorSubExternal({
|
||||
const duel = duelStore.getState();
|
||||
const hasEnhancedArmor = await hasEquipment(
|
||||
110,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
material.uniforms.thickness.value = hasEnhancedArmor
|
||||
@@ -71,7 +71,7 @@ export function SpacedArmorSubExternal({
|
||||
const penetration = shell.penetration.near;
|
||||
const hasCalibratedShells = await hasEquipment(
|
||||
103,
|
||||
duel.antagonist.tank.equipmentPreset,
|
||||
duel.antagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ export function SpacedArmorSubSpaced({
|
||||
const duel = duelStore.getState();
|
||||
const hasEnhancedArmor = await hasEquipment(
|
||||
110,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
material.uniforms.thickness.value = hasEnhancedArmor
|
||||
@@ -81,7 +81,7 @@ export function SpacedArmorSubSpaced({
|
||||
const penetration = shell.penetration.near;
|
||||
const hasCalibratedShells = await hasEquipment(
|
||||
103,
|
||||
duel.antagonist.tank.equipmentPreset,
|
||||
duel.antagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
|
||||
|
||||
+7
-7
@@ -91,7 +91,7 @@ export function SpacedArmorSceneComponent({
|
||||
const shell = antagonist.shell;
|
||||
const cameraNormal = camera.position.clone().sub(point).normalize();
|
||||
const shot: Shot = {
|
||||
splashRadius: shell.explosionRadius,
|
||||
splashRadius: shell.explosion_radius,
|
||||
damage: -1,
|
||||
containsGaps: shell.type === ShellType.HEAT,
|
||||
in: {
|
||||
@@ -103,12 +103,12 @@ export function SpacedArmorSceneComponent({
|
||||
|
||||
const hasCalibratedShells = await hasEquipment(
|
||||
103,
|
||||
antagonist.tank.equipmentPreset,
|
||||
antagonist.tank.equipment_preset,
|
||||
antagonist.equipmentMatrix,
|
||||
);
|
||||
const hasEnhancedArmor = await hasEquipment(
|
||||
110,
|
||||
protagonist.tank.equipmentPreset,
|
||||
protagonist.tank.equipment_preset,
|
||||
protagonist.equipmentMatrix,
|
||||
);
|
||||
const penetration =
|
||||
@@ -288,8 +288,8 @@ export function SpacedArmorSceneComponent({
|
||||
const finalDamage = Math.max(
|
||||
0,
|
||||
0.5 *
|
||||
shell.armorDamage *
|
||||
(1 - distanceFromSpacedArmor / shell.explosionRadius!) -
|
||||
shell.armor_damage *
|
||||
(1 - distanceFromSpacedArmor / shell.explosion_radius!) -
|
||||
1.1 *
|
||||
(lastLayer.thicknessAngled +
|
||||
Math.min(penetration, totalSpacedArmorThickness)),
|
||||
@@ -311,7 +311,7 @@ export function SpacedArmorSceneComponent({
|
||||
shot.damage = finalDamage;
|
||||
} else {
|
||||
shot.in.status = 'penetration';
|
||||
shot.damage = shell.armorDamage;
|
||||
shot.damage = shell.armor_damage;
|
||||
}
|
||||
} else {
|
||||
if (lastLayer.status === 'blocked') {
|
||||
@@ -319,7 +319,7 @@ export function SpacedArmorSceneComponent({
|
||||
shot.damage = 0;
|
||||
} else if (lastLayer.status === 'penetration') {
|
||||
shot.in.status = 'penetration';
|
||||
shot.damage = shell.armorDamage;
|
||||
shot.damage = shell.armor_damage;
|
||||
} else {
|
||||
const caster = new Raycaster();
|
||||
// https://math.stackexchange.com/a/13263/1222875
|
||||
|
||||
@@ -44,10 +44,10 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turretOrigin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gunOrigin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
||||
const mutateDuel = Duel.useMutation();
|
||||
const canvas = useThree((state) => state.gl.domElement);
|
||||
const mutateTankopediaEphemeral = TankopediaEphemeral.useMutation();
|
||||
@@ -131,7 +131,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
<group ref={turretContainer}>
|
||||
{armorNodes.map((node) => {
|
||||
const isCurrentTurret = node.name.startsWith(
|
||||
`turret_${turretModelDefinition.modelId.toString().padStart(2, '0')}`,
|
||||
`turret_${turretModelDefinition.model_id.toString().padStart(2, '0')}`,
|
||||
);
|
||||
const isVisible = isCurrentTurret;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
@@ -177,7 +177,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
const duel = duelStore.getState();
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
duel.protagonist.equipmentMatrix,
|
||||
);
|
||||
const boundingRect = canvas.getBoundingClientRect();
|
||||
@@ -226,7 +226,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
<group ref={gunContainer}>
|
||||
{armorNodes.map((node) => {
|
||||
const isCurrentGun = node.name.startsWith(
|
||||
`gun_${gunModelDefinition.modelId.toString().padStart(2, '0')}`,
|
||||
`gun_${gunModelDefinition.model_id.toString().padStart(2, '0')}`,
|
||||
);
|
||||
const isVisible = isCurrentGun;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
@@ -272,7 +272,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
const duel = duelStore.getState();
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
duel.protagonist.equipmentMatrix,
|
||||
);
|
||||
const boundingRect = canvas.getBoundingClientRect();
|
||||
@@ -317,7 +317,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
})}
|
||||
|
||||
{modelNodes.map((node) => {
|
||||
const gunString = `gun_${gunModelDefinition.modelId
|
||||
const gunString = `gun_${gunModelDefinition.model_id
|
||||
.toString()
|
||||
.padStart(2, '0')}`;
|
||||
const isCurrentGun = gunModelDefinition.mask
|
||||
@@ -354,7 +354,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
const duel = duelStore.getState();
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
duel.protagonist.equipmentMatrix,
|
||||
);
|
||||
const boundingRect = canvas.getBoundingClientRect();
|
||||
|
||||
@@ -13,7 +13,7 @@ interface BodyProps {
|
||||
export function Body({ stats }: BodyProps) {
|
||||
const members = CompareEphemeral.use((state) => state.members);
|
||||
const hasNonRegularGun = members.some(
|
||||
({ gun }) => gun.gunType!.$case !== 'regular',
|
||||
({ gun }) => gun.gun_type!.$case !== 'regular',
|
||||
);
|
||||
const mutateCompareEphemeral = CompareEphemeral.useMutation();
|
||||
|
||||
@@ -31,7 +31,7 @@ export function Body({ stats }: BodyProps) {
|
||||
<StickyColumnHeaderCell key={key} top={137}>
|
||||
<Flex justify="center">
|
||||
<Flex>
|
||||
{gun.gunType!.value.base.shells.map(
|
||||
{gun.gun_type!.value.base.shells.map(
|
||||
(thisShell, shellIndex) => (
|
||||
<IconButton
|
||||
color={thisShell.id === shell.id ? undefined : 'gray'}
|
||||
@@ -43,12 +43,12 @@ export function Body({ stats }: BodyProps) {
|
||||
shellIndex === 0 ? undefined : 0,
|
||||
borderTopRightRadius:
|
||||
shellIndex ===
|
||||
gun.gunType!.value.base.shells.length - 1
|
||||
gun.gun_type!.value.base.shells.length - 1
|
||||
? undefined
|
||||
: 0,
|
||||
borderBottomRightRadius:
|
||||
shellIndex ===
|
||||
gun.gunType!.value.base.shells.length - 1
|
||||
gun.gun_type!.value.base.shells.length - 1
|
||||
? undefined
|
||||
: 0,
|
||||
marginLeft: shellIndex === 0 ? 0 : -1,
|
||||
|
||||
@@ -169,7 +169,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
index,
|
||||
) => {
|
||||
const equipmentPreset =
|
||||
equipmentDefinitions.presets[tank.equipmentPreset];
|
||||
equipmentDefinitions.presets[tank.equipment_preset];
|
||||
const provisionsList = availableProvisions(
|
||||
tank,
|
||||
gun,
|
||||
@@ -239,7 +239,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
member.turret = member.tank.turrets[0];
|
||||
member.gun = member.turret.guns[0];
|
||||
member.shell =
|
||||
member.gun.gunType!.value.base.shells[0];
|
||||
member.gun.gun_type!.value.base.shells[0];
|
||||
member.engine = member.tank.engines[0];
|
||||
member.track = member.tank.tracks[0];
|
||||
});
|
||||
@@ -256,7 +256,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
member.turret = member.tank.turrets.at(-1)!;
|
||||
member.gun = member.turret.guns.at(-1)!;
|
||||
member.shell =
|
||||
member.gun.gunType!.value.base.shells[0];
|
||||
member.gun.gun_type!.value.base.shells[0];
|
||||
member.engine = member.tank.engines.at(-1)!;
|
||||
member.track = member.tank.tracks.at(-1)!;
|
||||
});
|
||||
@@ -329,7 +329,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
(provision) => provision.id,
|
||||
)}
|
||||
selected={provisions}
|
||||
disabled={tank.maxProvisions === provisions.length}
|
||||
disabled={tank.max_provisions === provisions.length}
|
||||
onChange={(provisions) => {
|
||||
mutateCompareEphemeral((draft) => {
|
||||
draft.members[index].provisions = provisions;
|
||||
@@ -515,7 +515,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
||||
});
|
||||
}}
|
||||
disabled={
|
||||
tank.maxConsumables === consumables.length
|
||||
tank.max_consumables === consumables.length
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ export function ModuleManager({
|
||||
const draft = { ...modules };
|
||||
draft.turret = turret;
|
||||
draft.gun = draft.turret.guns.at(-1)!;
|
||||
draft.shell = draft.gun.gunType!.value.base.shells[0];
|
||||
draft.shell = draft.gun.gun_type!.value.base.shells[0];
|
||||
|
||||
onChange?.(draft);
|
||||
setTurretMenuOpen(false);
|
||||
@@ -82,7 +82,7 @@ export function ModuleManager({
|
||||
<ModuleButton
|
||||
module="gun"
|
||||
discriminator={
|
||||
TIER_ROMAN_NUMERALS[modules.gun.gunType!.value.base.tier]
|
||||
TIER_ROMAN_NUMERALS[modules.gun.gun_type!.value.base.tier]
|
||||
}
|
||||
onClick={() => setGunMenuOpen(true)}
|
||||
/>
|
||||
@@ -94,17 +94,17 @@ export function ModuleManager({
|
||||
|
||||
<DropdownMenu.Content>
|
||||
<DropdownMenu.RadioGroup
|
||||
value={`${modules.gun.gunType!.value.base.id}`}
|
||||
value={`${modules.gun.gun_type!.value.base.id}`}
|
||||
>
|
||||
{[...modules.turret.guns].reverse().map((gun) => {
|
||||
return (
|
||||
<DropdownMenu.RadioItem
|
||||
key={gun.gunType!.value.base.id}
|
||||
value={`${gun.gunType!.value.base.id}`}
|
||||
key={gun.gun_type!.value.base.id}
|
||||
value={`${gun.gun_type!.value.base.id}`}
|
||||
onClick={() => {
|
||||
const draft = { ...modules };
|
||||
draft.gun = gun;
|
||||
draft.shell = draft.gun.gunType!.value.base.shells[0];
|
||||
draft.shell = draft.gun.gun_type!.value.base.shells[0];
|
||||
|
||||
onChange?.(draft);
|
||||
setGunMenuOpen(false);
|
||||
@@ -114,10 +114,10 @@ export function ModuleManager({
|
||||
variant="ghost"
|
||||
module="gun"
|
||||
discriminator={
|
||||
TIER_ROMAN_NUMERALS[gun.gunType!.value.base.tier]
|
||||
TIER_ROMAN_NUMERALS[gun.gun_type!.value.base.tier]
|
||||
}
|
||||
/>{' '}
|
||||
{gun.gunType!.value.base.name}
|
||||
{gun.gun_type!.value.base.name}
|
||||
</DropdownMenu.RadioItem>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -32,26 +32,26 @@ export function TankCard({ tank, onSelect }: TankCardProps) {
|
||||
|
||||
const turret = tank.turrets.at(-1)!;
|
||||
const gun = turret.guns.at(-1)!;
|
||||
const shell0 = gun.gunType!.value.base.shells[0];
|
||||
const shell1 = gun.gunType!.value.base.shells[1];
|
||||
const shell0 = gun.gun_type!.value.base.shells[0];
|
||||
const shell1 = gun.gun_type!.value.base.shells[1];
|
||||
const tracks = tank.tracks.at(-1)!;
|
||||
const engine = tank.engines.at(-1)!;
|
||||
const tankModelDefinition = modelDefinitions.models[tank.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
||||
|
||||
switch (tankopediaSort.by) {
|
||||
case 'fire.aimTime':
|
||||
return gun.gunType!.value.base.aimTime.toFixed(2);
|
||||
return gun.gun_type!.value.base.aim_time.toFixed(2);
|
||||
case 'fire.caliber':
|
||||
return shell0.caliber.toFixed(0);
|
||||
case 'fire.damage':
|
||||
return shell0.armorDamage.toFixed(0);
|
||||
return shell0.armor_damage.toFixed(0);
|
||||
case 'fire.dispersionMoving':
|
||||
return tracks.dispersionMove.toFixed(3);
|
||||
return tracks.dispersion_move.toFixed(3);
|
||||
case 'fire.dispersionStill':
|
||||
return gun.gunType!.value.base.dispersionBase.toFixed(3);
|
||||
return gun.gun_type!.value.base.dispersion_base.toFixed(3);
|
||||
case 'fire.dpm':
|
||||
return resolveDpm(gun, shell0).toFixed(0);
|
||||
case 'fire.dpmPremium':
|
||||
@@ -67,17 +67,17 @@ export function TankCard({ tank, onSelect }: TankCardProps) {
|
||||
case 'fire.gunDepression':
|
||||
return (
|
||||
gunModelDefinition.pitch.max +
|
||||
(tankModelDefinition.initialTurretRotation?.pitch ?? 0)
|
||||
(tankModelDefinition.initial_turret_rotation?.pitch ?? 0)
|
||||
).toFixed(1);
|
||||
case 'fire.gunElevation':
|
||||
return (
|
||||
-gunModelDefinition.pitch.min -
|
||||
(tankModelDefinition.initialTurretRotation?.pitch ?? 0)
|
||||
(tankModelDefinition.initial_turret_rotation?.pitch ?? 0)
|
||||
).toFixed(1);
|
||||
case 'maneuverability.forwardsSpeed':
|
||||
return tank.speedForwards.toFixed(0);
|
||||
return tank.speed_forwards.toFixed(0);
|
||||
case 'maneuverability.backwardsSpeed':
|
||||
return tank.speedBackwards.toFixed(0);
|
||||
return tank.speed_backwards.toFixed(0);
|
||||
case 'maneuverability.power':
|
||||
return engine.power.toFixed(0);
|
||||
case 'maneuverability.powerToWeight':
|
||||
@@ -87,7 +87,7 @@ export function TankCard({ tank, onSelect }: TankCardProps) {
|
||||
engine.weight +
|
||||
tracks.weight +
|
||||
turret.weight +
|
||||
gun.gunType!.value.base.weight)
|
||||
gun.gun_type!.value.base.weight)
|
||||
).toFixed(1);
|
||||
case 'maneuverability.weight':
|
||||
return (
|
||||
@@ -95,30 +95,30 @@ export function TankCard({ tank, onSelect }: TankCardProps) {
|
||||
engine.weight +
|
||||
tracks.weight +
|
||||
turret.weight +
|
||||
gun.gunType!.value.base.weight) /
|
||||
gun.gun_type!.value.base.weight) /
|
||||
1000
|
||||
).toFixed(1);
|
||||
case 'maneuverability.traverseSpeed':
|
||||
return tracks.traverseSpeed.toFixed(1);
|
||||
return tracks.traverse_speed.toFixed(1);
|
||||
case 'survivability.health':
|
||||
return (tank.health + turret.health).toFixed(0);
|
||||
case 'survivability.viewRange':
|
||||
return turret.viewRange.toFixed(0);
|
||||
return turret.view_range.toFixed(0);
|
||||
case 'survivability.camouflageStill':
|
||||
return (tank.camouflageStill * 100).toFixed(0);
|
||||
return (tank.camouflage_still * 100).toFixed(0);
|
||||
case 'survivability.camouflageMoving':
|
||||
return (tank.camouflageMoving * 100).toFixed(0);
|
||||
return (tank.camouflage_moving * 100).toFixed(0);
|
||||
case 'survivability.camouflageShooting':
|
||||
return (
|
||||
tank.camouflageStill *
|
||||
gun.gunType!.value.base.camouflageLoss *
|
||||
tank.camouflage_still *
|
||||
gun.gun_type!.value.base.camouflage_loss *
|
||||
100
|
||||
).toFixed(0);
|
||||
case 'survivability.volume': {
|
||||
const dimensions = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
tankModelDefinition.boundingBox,
|
||||
turretModelDefinition.boundingBox,
|
||||
tankModelDefinition.bounding_box,
|
||||
turretModelDefinition.bounding_box,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -128,8 +128,8 @@ export function TankCard({ tank, onSelect }: TankCardProps) {
|
||||
case 'survivability.length': {
|
||||
const bounds = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
tankModelDefinition.boundingBox,
|
||||
turretModelDefinition.boundingBox,
|
||||
tankModelDefinition.bounding_box,
|
||||
turretModelDefinition.bounding_box,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -94,31 +94,31 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'survivability.viewRange':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.viewRange - b.turrets.at(-1)!.viewRange,
|
||||
a.turrets.at(-1)!.view_range - b.turrets.at(-1)!.view_range,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'survivability.camouflageStill':
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.camouflageStill - b.camouflageStill,
|
||||
(a, b) => a.camouflage_still - b.camouflage_still,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'survivability.camouflageMoving':
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.camouflageMoving - b.camouflageMoving,
|
||||
(a, b) => a.camouflage_moving - b.camouflage_moving,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'survivability.camouflageShooting':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.camouflageStill *
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base
|
||||
.camouflageLoss -
|
||||
b.camouflageStill *
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base
|
||||
.camouflageLoss,
|
||||
a.camouflage_still *
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
||||
.camouflage_loss -
|
||||
b.camouflage_still *
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
||||
.camouflage_loss,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -132,14 +132,14 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
bTankModelDefinition.turrets[b.turrets.at(-1)!.id];
|
||||
const aSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
aTankModelDefinition.boundingBox,
|
||||
aTurretModelDefinition.boundingBox,
|
||||
aTankModelDefinition.bounding_box,
|
||||
aTurretModelDefinition.bounding_box,
|
||||
),
|
||||
);
|
||||
const bSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
bTankModelDefinition.boundingBox,
|
||||
bTurretModelDefinition.boundingBox,
|
||||
bTankModelDefinition.bounding_box,
|
||||
bTurretModelDefinition.bounding_box,
|
||||
),
|
||||
);
|
||||
const aVolume = aSize.x * aSize.y * aSize.z;
|
||||
@@ -159,14 +159,14 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
bTankModelDefinition.turrets[b.turrets.at(-1)!.id];
|
||||
const aSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
aTankModelDefinition.boundingBox,
|
||||
aTurretModelDefinition.boundingBox,
|
||||
aTankModelDefinition.bounding_box,
|
||||
aTurretModelDefinition.bounding_box,
|
||||
),
|
||||
);
|
||||
const bSize = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
bTankModelDefinition.boundingBox,
|
||||
bTurretModelDefinition.boundingBox,
|
||||
bTankModelDefinition.bounding_box,
|
||||
bTurretModelDefinition.bounding_box,
|
||||
),
|
||||
);
|
||||
const aLength = Math.max(aSize.x, aSize.y, aSize.z);
|
||||
@@ -181,11 +181,11 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
(a, b) =>
|
||||
resolveDpm(
|
||||
a.turrets.at(-1)!.guns.at(-1)!,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0],
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0],
|
||||
) -
|
||||
resolveDpm(
|
||||
b.turrets.at(-1)!.guns.at(-1)!,
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0],
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0],
|
||||
),
|
||||
);
|
||||
break;
|
||||
@@ -193,17 +193,17 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.dpmPremium':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[1]
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
||||
? resolveDpm(
|
||||
a.turrets.at(-1)!.guns.at(-1)!,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
||||
.shells[1],
|
||||
)
|
||||
: 0) -
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[1]
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
||||
? resolveDpm(
|
||||
b.turrets.at(-1)!.guns.at(-1)!,
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
||||
.shells[1],
|
||||
)
|
||||
: 0),
|
||||
@@ -221,9 +221,9 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.caliber':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.caliber -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.caliber,
|
||||
);
|
||||
break;
|
||||
@@ -231,9 +231,9 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.standardPenetration':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.penetration.near -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.penetration.near,
|
||||
);
|
||||
break;
|
||||
@@ -241,9 +241,9 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.premiumPenetration':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[1]
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
||||
?.penetration.near ?? 0) -
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[1]
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
||||
?.penetration.near ?? 0),
|
||||
);
|
||||
break;
|
||||
@@ -251,19 +251,19 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.damage':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
.armorDamage -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
.armorDamage,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.armor_damage -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.armor_damage,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.shellVelocity':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.velocity -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.velocity,
|
||||
);
|
||||
break;
|
||||
@@ -271,26 +271,26 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.aimTime':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.aimTime -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.aimTime,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.aim_time -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.aim_time,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.dispersionStill':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base
|
||||
.dispersionBase -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base
|
||||
.dispersionBase,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
||||
.dispersion_base -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
||||
.dispersion_base,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.dispersionMoving':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.tracks.at(-1)!.dispersionMove -
|
||||
b.tracks.at(-1)!.dispersionMove,
|
||||
a.tracks.at(-1)!.dispersion_move -
|
||||
b.tracks.at(-1)!.dispersion_move,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -298,14 +298,14 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
||||
.pitch.max +
|
||||
(modelDefinitions.models[a.id].initialTurretRotation?.pitch ??
|
||||
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
||||
0) -
|
||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
||||
.pitch.max -
|
||||
(modelDefinitions.models[b.id].initialTurretRotation?.pitch ??
|
||||
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
||||
0),
|
||||
);
|
||||
break;
|
||||
@@ -314,25 +314,27 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
||||
.pitch.min +
|
||||
(modelDefinitions.models[b.id].initialTurretRotation?.pitch ??
|
||||
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
||||
0) -
|
||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
||||
.pitch.min -
|
||||
(modelDefinitions.models[a.id].initialTurretRotation?.pitch ??
|
||||
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
||||
0),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'maneuverability.forwardsSpeed':
|
||||
sorted = filtered.sort((a, b) => a.speedForwards - b.speedForwards);
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.speed_forwards - b.speed_forwards,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'maneuverability.backwardsSpeed':
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.speedBackwards - b.speedBackwards,
|
||||
(a, b) => a.speed_backwards - b.speed_backwards,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -350,13 +352,14 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
a.engines.at(-1)!.weight +
|
||||
a.tracks.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.weight) -
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
||||
.weight) -
|
||||
b.engines.at(-1)!.power /
|
||||
(b.weight +
|
||||
b.engines.at(-1)!.weight +
|
||||
b.tracks.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.weight),
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.weight),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -367,19 +370,20 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
a.engines.at(-1)!.weight +
|
||||
a.tracks.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.weight -
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.weight -
|
||||
(b.weight +
|
||||
b.engines.at(-1)!.weight +
|
||||
b.tracks.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.weight),
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.weight),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'maneuverability.traverseSpeed':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.tracks.at(-1)!.traverseSpeed - b.tracks.at(-1)!.traverseSpeed,
|
||||
a.tracks.at(-1)!.traverse_speed -
|
||||
b.tracks.at(-1)!.traverse_speed,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
+13
-11
@@ -75,7 +75,7 @@ export function Characteristics() {
|
||||
const tankModelDefinition = useTankModelDefinition();
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
||||
const stats = tankCharacteristics(
|
||||
{
|
||||
tank,
|
||||
@@ -148,7 +148,7 @@ export function Characteristics() {
|
||||
<Heading size="5">Firepower</Heading>
|
||||
|
||||
<Flex>
|
||||
{gun.gunType!.value.base.shells.map((thisShell, shellIndex) => (
|
||||
{gun.gun_type!.value.base.shells.map((thisShell, shellIndex) => (
|
||||
<Tooltip content={thisShell.name} key={thisShell.id}>
|
||||
<IconButton
|
||||
color={thisShell.id === shell.id ? undefined : 'gray'}
|
||||
@@ -157,11 +157,13 @@ export function Characteristics() {
|
||||
borderTopLeftRadius: shellIndex === 0 ? undefined : 0,
|
||||
borderBottomLeftRadius: shellIndex === 0 ? undefined : 0,
|
||||
borderTopRightRadius:
|
||||
shellIndex === gun.gunType!.value.base.shells.length - 1
|
||||
shellIndex ===
|
||||
gun.gun_type!.value.base.shells.length - 1
|
||||
? undefined
|
||||
: 0,
|
||||
borderBottomRightRadius:
|
||||
shellIndex === gun.gunType!.value.base.shells.length - 1
|
||||
shellIndex ===
|
||||
gun.gun_type!.value.base.shells.length - 1
|
||||
? undefined
|
||||
: 0,
|
||||
marginLeft: shellIndex === 0 ? 0 : -1,
|
||||
@@ -183,11 +185,11 @@ export function Characteristics() {
|
||||
))}
|
||||
</Flex>
|
||||
</Flex>
|
||||
<Info name="Gun type">{GUN_TYPE_NAMES[gun.gunType!.$case]}</Info>
|
||||
<Info name="Gun type">{GUN_TYPE_NAMES[gun.gun_type!.$case]}</Info>
|
||||
<InfoWithDelta name="DPM" decimals={0} unit="hp / min">
|
||||
{stats.dpm}
|
||||
</InfoWithDelta>
|
||||
{gun.gunType!.$case === 'autoReloader' && (
|
||||
{gun.gun_type!.$case === 'auto_reloader' && (
|
||||
<InfoWithDelta
|
||||
decimals={0}
|
||||
indent
|
||||
@@ -197,10 +199,10 @@ export function Characteristics() {
|
||||
{stats.dpmEffective!}
|
||||
</InfoWithDelta>
|
||||
)}
|
||||
{gun.gunType!.$case !== 'regular' && (
|
||||
{gun.gun_type!.$case !== 'regular' && (
|
||||
<InfoWithDelta name="Shells">{stats.shells}</InfoWithDelta>
|
||||
)}
|
||||
{gun.gunType!.$case === 'autoReloader' ? (
|
||||
{gun.gun_type!.$case === 'auto_reloader' ? (
|
||||
<>
|
||||
<Info indent name="Most optimal shell index">
|
||||
{stats.mostOptimalShellIndex! + 1}
|
||||
@@ -228,8 +230,8 @@ export function Characteristics() {
|
||||
{stats.shellReload!}
|
||||
</InfoWithDelta>
|
||||
)}
|
||||
{(gun.gunType!.$case === 'autoLoader' ||
|
||||
gun.gunType!.$case === 'autoReloader') && (
|
||||
{(gun.gun_type!.$case === 'auto_loader' ||
|
||||
gun.gun_type!.$case === 'auto_reloader') && (
|
||||
<InfoWithDelta
|
||||
indent
|
||||
decimals={2}
|
||||
@@ -300,7 +302,7 @@ export function Characteristics() {
|
||||
<InfoWithDelta name="Damage" unit="hp" decimals={0}>
|
||||
{stats.damage}
|
||||
</InfoWithDelta>
|
||||
{gun.gunType!.$case !== 'regular' && (
|
||||
{gun.gun_type!.$case !== 'regular' && (
|
||||
<InfoWithDelta name="Clipping potential" indent>
|
||||
{stats.clipDamage!}
|
||||
</InfoWithDelta>
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ export function Consumables() {
|
||||
consumables={consumablesList}
|
||||
selected={consumables}
|
||||
cooldownBooster={cooldownBooster}
|
||||
disabled={protagonist.tank.maxConsumables === consumables.length}
|
||||
disabled={protagonist.tank.max_consumables === consumables.length}
|
||||
hasConsumableDeliverySystem={hasConsumableDeliverySystem}
|
||||
hasHighEndConsumables={hasHighEndConsumables}
|
||||
timers
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ export function Equipment() {
|
||||
const mutateDuel = Duel.useMutation();
|
||||
const protagonist = Duel.use((state) => state.protagonist);
|
||||
const equipmentPreset =
|
||||
equipmentDefinitions.presets[protagonist.tank.equipmentPreset];
|
||||
equipmentDefinitions.presets[protagonist.tank.equipment_preset];
|
||||
const equipmentMatrix = Duel.use(
|
||||
(state) => state.protagonist.equipmentMatrix,
|
||||
);
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ export function Miscellaneous() {
|
||||
<Heading size="4">Miscellaneous</Heading>
|
||||
|
||||
<Flex gap="2" align="center">
|
||||
{!tank.fixedCamouflage && (
|
||||
{!tank.fixed_camouflage && (
|
||||
<GenericTankComponentButton
|
||||
icon={asset('icons/camo.webp')}
|
||||
selected={camouflage}
|
||||
|
||||
+19
-17
@@ -32,8 +32,8 @@ type ModuleDefinition =
|
||||
| EngineDefinition;
|
||||
|
||||
function extractModule(raw: ModuleDefinition | TankDefinition) {
|
||||
if ('gunType' in raw) {
|
||||
return raw.gunType!.value.base;
|
||||
if ('gun_type' in raw) {
|
||||
return raw.gun_type!.value.base;
|
||||
} else
|
||||
return raw as Exclude<ModuleDefinition | TankDefinition, GunDefinition>;
|
||||
}
|
||||
@@ -172,34 +172,36 @@ export function Modules() {
|
||||
if (
|
||||
!draft.protagonist.turret.guns.some(
|
||||
(gun) =>
|
||||
gun.gunType!.value.base.id ===
|
||||
draft.protagonist.gun.gunType!.value.base.id,
|
||||
gun.gun_type!.value.base.id ===
|
||||
draft.protagonist.gun.gun_type!.value.base.id,
|
||||
)
|
||||
) {
|
||||
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
|
||||
draft.protagonist.shell =
|
||||
draft.protagonist.gun.gunType!.value.base.shells[0];
|
||||
draft.protagonist.gun.gun_type!.value.base.shells[0];
|
||||
}
|
||||
} else if (unlock.type === ModuleType.GUN) {
|
||||
const gunInTurret = draft.protagonist.turret.guns.find(
|
||||
(gun) => gun.gunType!.value.base.id === unlock.id,
|
||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
||||
);
|
||||
if (gunInTurret) {
|
||||
draft.protagonist.gun = gunInTurret;
|
||||
draft.protagonist.shell = gunInTurret.gunType!.value.base.shells[0];
|
||||
draft.protagonist.shell = gunInTurret.gun_type!.value.base.shells[0];
|
||||
} else {
|
||||
// TODO: warn somehow?
|
||||
const suitableTurret = draft.protagonist.tank.turrets.find((turret) =>
|
||||
turret.guns.some((gun) => gun.gunType!.value.base.id === unlock.id),
|
||||
turret.guns.some(
|
||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
||||
),
|
||||
)!;
|
||||
const gunInSuitableTurret = suitableTurret.guns.find(
|
||||
(gun) => gun.gunType!.value.base.id === unlock.id,
|
||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
||||
)!;
|
||||
|
||||
draft.protagonist.turret = suitableTurret;
|
||||
draft.protagonist.gun = gunInSuitableTurret;
|
||||
draft.protagonist.shell =
|
||||
gunInSuitableTurret.gunType!.value.base.shells[0];
|
||||
gunInSuitableTurret.gun_type!.value.base.shells[0];
|
||||
}
|
||||
} else if (unlock.type === ModuleType.ENGINE) {
|
||||
draft.protagonist.engine = draft.protagonist.tank.engines.find(
|
||||
@@ -232,10 +234,10 @@ export function Modules() {
|
||||
module = tank.turrets
|
||||
.find((turret) =>
|
||||
turret.guns.some(
|
||||
(gun) => gun.gunType!.value.base.id === unlock.id,
|
||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
||||
),
|
||||
)!
|
||||
.guns.find((gun) => gun.gunType!.value.base.id === unlock.id)!;
|
||||
.guns.find((gun) => gun.gun_type!.value.base.id === unlock.id)!;
|
||||
} else if (unlock.type === ModuleType.VEHICLE) {
|
||||
module = tankDefinitions.tanks[unlock.id];
|
||||
}
|
||||
@@ -298,7 +300,7 @@ export function Modules() {
|
||||
(unlock.type === ModuleType.TURRET
|
||||
? turret.id
|
||||
: unlock.type === ModuleType.GUN
|
||||
? gun.gunType!.value.base.id
|
||||
? gun.gun_type!.value.base.id
|
||||
: unlock.type === ModuleType.ENGINE
|
||||
? engine.id
|
||||
: unlock.type === ModuleType.TRACKS
|
||||
@@ -310,7 +312,7 @@ export function Modules() {
|
||||
? extractModule(module).id == topTurret.id
|
||||
: unlock.type === ModuleType.GUN
|
||||
? extractModule(module).id ===
|
||||
topGun.gunType!.value.base.id
|
||||
topGun.gun_type!.value.base.id
|
||||
: unlock.type === ModuleType.ENGINE
|
||||
? extractModule(module).id === topEngine.id
|
||||
: unlock.type === ModuleType.TRACKS
|
||||
@@ -360,7 +362,7 @@ export function Modules() {
|
||||
draft.protagonist.turret = draft.protagonist.tank.turrets[0];
|
||||
draft.protagonist.gun = draft.protagonist.turret.guns[0];
|
||||
draft.protagonist.shell =
|
||||
draft.protagonist.gun.gunType!.value.base.shells[0];
|
||||
draft.protagonist.gun.gun_type!.value.base.shells[0];
|
||||
draft.protagonist.engine = draft.protagonist.tank.engines[0];
|
||||
draft.protagonist.track = draft.protagonist.tank.tracks[0];
|
||||
});
|
||||
@@ -376,7 +378,7 @@ export function Modules() {
|
||||
draft.protagonist.tank.turrets.at(-1)!;
|
||||
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
|
||||
draft.protagonist.shell =
|
||||
draft.protagonist.gun.gunType!.value.base.shells[0];
|
||||
draft.protagonist.gun.gun_type!.value.base.shells[0];
|
||||
draft.protagonist.engine =
|
||||
draft.protagonist.tank.engines.at(-1)!;
|
||||
draft.protagonist.track =
|
||||
@@ -415,7 +417,7 @@ export function Modules() {
|
||||
{tree(ModuleType.GUN, [
|
||||
{
|
||||
cost: { type: 'xp', value: 0 },
|
||||
id: gun0.gunType!.value.base.id,
|
||||
id: gun0.gun_type!.value.base.id,
|
||||
type: ModuleType.GUN,
|
||||
},
|
||||
])}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ export function Provisions() {
|
||||
<ProvisionsManager
|
||||
provisions={provisionsList.map((provision) => provision.id)}
|
||||
selected={provisions}
|
||||
disabled={tank.maxProvisions === provisions.length}
|
||||
disabled={tank.max_provisions === provisions.length}
|
||||
onChange={(provisions) => {
|
||||
mutateDuel((draft) => {
|
||||
draft.protagonist.provisions = provisions;
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@ export function DynamicArmorSwitcher() {
|
||||
draft.protagonist.consumables =
|
||||
draft.protagonist.consumables.filter((id) => id !== 73);
|
||||
} else {
|
||||
if (draft.protagonist.consumables.length === tank.maxConsumables) {
|
||||
draft.protagonist.consumables[tank.maxConsumables - 1] = 73;
|
||||
if (draft.protagonist.consumables.length === tank.max_consumables) {
|
||||
draft.protagonist.consumables[tank.max_consumables - 1] = 73;
|
||||
} else {
|
||||
draft.protagonist.consumables.push(73);
|
||||
}
|
||||
|
||||
+4
-3
@@ -21,8 +21,9 @@ export function QuickInputs() {
|
||||
const turretModelDefinition =
|
||||
tankModelDefinition.turrets[protagonist.turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[protagonist.gun.gunType!.value.base.id];
|
||||
const initialGunPitch = tankModelDefinition.initialTurretRotation?.pitch ?? 0;
|
||||
turretModelDefinition.guns[protagonist.gun.gun_type!.value.base.id];
|
||||
const initialGunPitch =
|
||||
tankModelDefinition.initial_turret_rotation?.pitch ?? 0;
|
||||
const hasImprovedVerticalStabilizer = useEquipment(122);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -45,7 +46,7 @@ export function QuickInputs() {
|
||||
|
||||
pitchInput.current.value = (
|
||||
-radToDeg(pitch) +
|
||||
(tankModelDefinition.initialTurretRotation?.pitch ?? 0)
|
||||
(tankModelDefinition.initial_turret_rotation?.pitch ?? 0)
|
||||
).toFixed(1);
|
||||
|
||||
if (yaw === undefined) return;
|
||||
|
||||
@@ -131,7 +131,7 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
|
||||
>
|
||||
{
|
||||
TIER_ROMAN_NUMERALS[
|
||||
antagonistGun.gunType!.value.base.tier
|
||||
antagonistGun.gun_type!.value.base.tier
|
||||
]
|
||||
}
|
||||
</Text>
|
||||
@@ -155,21 +155,21 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
|
||||
.map(({ gun, turret }) => (
|
||||
<ModuleButton
|
||||
module="gun"
|
||||
key={gun.gunType!.value.base.id}
|
||||
key={gun.gun_type!.value.base.id}
|
||||
onClick={() =>
|
||||
mutateDuel((draft) => {
|
||||
draft.antagonist.turret = turret;
|
||||
draft.antagonist.gun = gun;
|
||||
draft.antagonist.shell =
|
||||
gun.gunType!.value.base.shells[0];
|
||||
gun.gun_type!.value.base.shells[0];
|
||||
})
|
||||
}
|
||||
selected={
|
||||
gun.gunType!.value.base.id ===
|
||||
antagonistGun.gunType!.value.base.id
|
||||
gun.gun_type!.value.base.id ===
|
||||
antagonistGun.gun_type!.value.base.id
|
||||
}
|
||||
discriminator={
|
||||
TIER_ROMAN_NUMERALS[gun.gunType!.value.base.tier]
|
||||
TIER_ROMAN_NUMERALS[gun.gun_type!.value.base.tier]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
@@ -184,7 +184,7 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
|
||||
}}
|
||||
overflow="hidden"
|
||||
>
|
||||
{antagonistGun.gunType!.value.base.shells.map(
|
||||
{antagonistGun.gun_type!.value.base.shells.map(
|
||||
(thisShell, shellIndex) => (
|
||||
<IconButton
|
||||
color={
|
||||
@@ -332,7 +332,7 @@ export function Options({ thicknessRange, canvas }: OptionsProps) {
|
||||
draft.antagonist.gun =
|
||||
draft.antagonist.turret.guns.at(-1)!;
|
||||
draft.antagonist.shell =
|
||||
draft.antagonist.gun.gunType!.value.base.shells[0];
|
||||
draft.antagonist.gun.gun_type!.value.base.shells[0];
|
||||
});
|
||||
setAntagonistSelectorOpen(false);
|
||||
}}
|
||||
|
||||
+10
-10
@@ -38,7 +38,7 @@ export function Controls() {
|
||||
antagonistModelDefinition.turrets[antagonist.turret.id];
|
||||
const protagonistGunModelDefinition =
|
||||
protagonistTurretModelDefinition.guns[
|
||||
protagonist.gun.gunType!.value.base.id
|
||||
protagonist.gun.gun_type!.value.base.id
|
||||
];
|
||||
const protagonistHullOrigin = new Vector3(
|
||||
protagonistTrackModelDefinition.origin.x,
|
||||
@@ -46,19 +46,19 @@ export function Controls() {
|
||||
-protagonistTrackModelDefinition.origin.z,
|
||||
);
|
||||
const protagonistTurretOrigin = new Vector3(
|
||||
protagonistModelDefinition.turretOrigin.x,
|
||||
protagonistModelDefinition.turretOrigin.y,
|
||||
-protagonistModelDefinition.turretOrigin.z,
|
||||
protagonistModelDefinition.turret_origin.x,
|
||||
protagonistModelDefinition.turret_origin.y,
|
||||
-protagonistModelDefinition.turret_origin.z,
|
||||
);
|
||||
const protagonistGunOrigin = new Vector3(
|
||||
protagonistTurretModelDefinition.gunOrigin.x,
|
||||
protagonistTurretModelDefinition.gunOrigin.y,
|
||||
-protagonistTurretModelDefinition.gunOrigin.z,
|
||||
protagonistTurretModelDefinition.gun_origin.x,
|
||||
protagonistTurretModelDefinition.gun_origin.y,
|
||||
-protagonistTurretModelDefinition.gun_origin.z,
|
||||
);
|
||||
const antagonistGunHeight =
|
||||
protagonistTrackModelDefinition.origin.y +
|
||||
antagonistModelDefinition.turretOrigin.y +
|
||||
antagonistTurretModelDefinition.gunOrigin.y;
|
||||
antagonistModelDefinition.turret_origin.y +
|
||||
antagonistTurretModelDefinition.gun_origin.y;
|
||||
const [autoRotate, setAutoRotate] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -78,7 +78,7 @@ export function Controls() {
|
||||
const duel = duelStore.getState();
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
duel.protagonist.equipmentMatrix,
|
||||
);
|
||||
|
||||
|
||||
+6
-6
@@ -29,7 +29,7 @@ export const TankModel = memo(() => {
|
||||
const turretModelDefinition =
|
||||
tankModelDefinition.turrets[protagonist.turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[protagonist.gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[protagonist.gun.gun_type!.value.base.id];
|
||||
const { gltf } = useModel(protagonist.tank.id);
|
||||
const nodes = Object.values(gltf.nodes);
|
||||
const isDynamicArmorActive = Duel.use((state) =>
|
||||
@@ -136,7 +136,7 @@ export const TankModel = memo(() => {
|
||||
const isTurret = node.name.startsWith('turret_');
|
||||
const isCurrentTurret =
|
||||
node.name ===
|
||||
`turret_${turretModelDefinition.modelId.toString().padStart(2, '0')}`;
|
||||
`turret_${turretModelDefinition.model_id.toString().padStart(2, '0')}`;
|
||||
const isVisible = isCurrentTurret;
|
||||
const position = new Vector2();
|
||||
const delta = new Vector2();
|
||||
@@ -169,7 +169,7 @@ export const TankModel = memo(() => {
|
||||
const duel = duelStore.getState();
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
duel.protagonist.equipmentMatrix,
|
||||
);
|
||||
const boundingRect = canvas.getBoundingClientRect();
|
||||
@@ -232,12 +232,12 @@ export const TankModel = memo(() => {
|
||||
{nodes.map((node) => {
|
||||
const isCurrentMantlet =
|
||||
node.name ===
|
||||
`gun_${gunModelDefinition.modelId
|
||||
`gun_${gunModelDefinition.model_id
|
||||
.toString()
|
||||
.padStart(2, '0')}_mask`;
|
||||
const isCurrentGun =
|
||||
node.name ===
|
||||
`gun_${gunModelDefinition.modelId.toString().padStart(2, '0')}`;
|
||||
`gun_${gunModelDefinition.model_id.toString().padStart(2, '0')}`;
|
||||
const isVisible = isCurrentGun || isCurrentMantlet;
|
||||
const position = new Vector2();
|
||||
const delta = new Vector2();
|
||||
@@ -269,7 +269,7 @@ export const TankModel = memo(() => {
|
||||
const duel = duelStore.getState();
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist.tank.equipmentPreset,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
duel.protagonist.equipmentMatrix,
|
||||
);
|
||||
const boundingRect = canvas.getBoundingClientRect();
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>(
|
||||
const turretModelDefinition =
|
||||
tankModelDefinition.turrets[protagonist.turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[protagonist.gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[protagonist.gun.gun_type!.value.base.id];
|
||||
const display = TankopediaPersistent.useDeferred(
|
||||
(state) => state.display,
|
||||
TankopediaDisplay.Model,
|
||||
|
||||
@@ -34,7 +34,7 @@ export function HeroSection() {
|
||||
(filtered.reduce((accumulator, thisTank) => {
|
||||
return (
|
||||
accumulator +
|
||||
thisTank.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0]
|
||||
thisTank.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
||||
.penetration.near
|
||||
);
|
||||
}, 0) /
|
||||
|
||||
@@ -105,8 +105,8 @@ export function MetaSection() {
|
||||
direction={{ initial: 'column', sm: 'row' }}
|
||||
>
|
||||
<Flex direction="column" width="100%">
|
||||
{protagonist.nameFull && (
|
||||
<Listing label="Full-name">{protagonist.nameFull}</Listing>
|
||||
{protagonist.name_full && (
|
||||
<Listing label="Full-name">{protagonist.name_full}</Listing>
|
||||
)}
|
||||
<Listing label="Nation">
|
||||
<Flex align="center" gap="1">
|
||||
@@ -199,11 +199,12 @@ export function MetaSection() {
|
||||
/>
|
||||
</Flex>
|
||||
</Listing>
|
||||
{protagonist.researchCost && (
|
||||
{protagonist.research_cost && (
|
||||
<Listing label="Research XP">
|
||||
<Flex align="center" gap="1">
|
||||
{(
|
||||
protagonist.researchCost.researchCostType!.value as number
|
||||
protagonist.research_cost.research_cost_type!
|
||||
.value as number
|
||||
).toLocaleString()}
|
||||
<img
|
||||
style={{ width: '1em', height: '1em' }}
|
||||
|
||||
@@ -22,15 +22,17 @@ export function Node({ id, highlight, nextIds }: NodeProps) {
|
||||
const tank = tankDefinitions.tanks[id];
|
||||
const nextTanks = nextIds?.map((id) => tankDefinitions.tanks[id]);
|
||||
const thisTankXp =
|
||||
tank.researchCost === undefined || tank.tier === 1
|
||||
tank.research_cost === undefined || tank.tier === 1
|
||||
? 0
|
||||
: (tank.researchCost.researchCostType!.value as number)! / xpMultiplier;
|
||||
: (tank.research_cost.research_cost_type!.value as number)! /
|
||||
xpMultiplier;
|
||||
const nextTanksXp = nextTanks?.reduce(
|
||||
(xp, tank) =>
|
||||
xp +
|
||||
(tank.researchCost === undefined || tank.tier === 1
|
||||
(tank.research_cost === undefined || tank.tier === 1
|
||||
? 0
|
||||
: (tank.researchCost.researchCostType!.value as number) / xpMultiplier),
|
||||
: (tank.research_cost.research_cost_type!.value as number) /
|
||||
xpMultiplier),
|
||||
0,
|
||||
);
|
||||
const averages = averageDefinitions.averages[tank.id]?.mu;
|
||||
|
||||
@@ -53,10 +53,10 @@ export function TechTreeSection() {
|
||||
const totalXp = line.reduce(
|
||||
(xp, id) =>
|
||||
xp +
|
||||
(tankDefinitions.tanks[id].researchCost === undefined ||
|
||||
(tankDefinitions.tanks[id].research_cost === undefined ||
|
||||
tankDefinitions.tanks[id].tier === 1
|
||||
? 0
|
||||
: (tankDefinitions.tanks[id].researchCost.researchCostType!
|
||||
: (tankDefinitions.tanks[id].research_cost.research_cost_type!
|
||||
.value as number)),
|
||||
0,
|
||||
);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import type { GunDefinition } from '@blitzkit/core';
|
||||
|
||||
export function resolveReload(gun: GunDefinition) {
|
||||
if (gun.gunType!.$case === 'regular') {
|
||||
return gun.gunType!.value.extension.reload;
|
||||
} else if (gun.gunType!.$case === 'autoLoader') {
|
||||
if (gun.gun_type!.$case === 'regular') {
|
||||
return gun.gun_type!.value.extension.reload;
|
||||
} else if (gun.gun_type!.$case === 'auto_loader') {
|
||||
return (
|
||||
gun.gunType!.value.extension.clipReload +
|
||||
(gun.gunType!.value.extension.shellCount - 1) *
|
||||
gun.gunType!.value.extension.intraClip
|
||||
gun.gun_type!.value.extension.clip_reload +
|
||||
(gun.gun_type!.value.extension.shell_count - 1) *
|
||||
gun.gun_type!.value.extension.intra_clip
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
gun.gunType!.value.extension.shellReloads.reduce((a, b) => a + b, 0) +
|
||||
(gun.gunType!.value.extension.shellCount - 1) *
|
||||
gun.gunType!.value.extension.intraClip
|
||||
gun.gun_type!.value.extension.shell_reloads.reduce((a, b) => a + b, 0) +
|
||||
(gun.gun_type!.value.extension.shell_count - 1) *
|
||||
gun.gun_type!.value.extension.intra_clip
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -77,10 +77,10 @@ export function tankCharacteristics(
|
||||
provisionDefinitions: ProvisionDefinitions;
|
||||
},
|
||||
) {
|
||||
const preset = equipmentDefinitions.presets[tank.equipmentPreset];
|
||||
const preset = equipmentDefinitions.presets[tank.equipment_preset];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition =
|
||||
turretModelDefinition.guns[gun.gunType!.value.base.id];
|
||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
||||
|
||||
function equipment(id: number) {
|
||||
return preset.slots.some((slot, index) => {
|
||||
@@ -129,7 +129,8 @@ export function tankCharacteristics(
|
||||
const hasGearOil = provision(44);
|
||||
const hasImprovedGearOil = provision(45);
|
||||
|
||||
const gunDefaultPitch = tankModelDefinition.initialTurretRotation?.pitch ?? 0;
|
||||
const gunDefaultPitch =
|
||||
tankModelDefinition.initial_turret_rotation?.pitch ?? 0;
|
||||
const provisionCrewBonus =
|
||||
provisions.reduce(
|
||||
(total, provision) =>
|
||||
@@ -159,7 +160,7 @@ export function tankCharacteristics(
|
||||
const reloadCoefficient =
|
||||
(coefficient([hasGunRammer, -0.05]) *
|
||||
coefficient([true, degressiveStat(loaderMastery)])) /
|
||||
coefficient([hasAdrenaline && gun.gunType!.$case === 'regular', 0.17]);
|
||||
coefficient([hasAdrenaline && gun.gun_type!.$case === 'regular', 0.17]);
|
||||
const penetrationCoefficient = coefficient([
|
||||
hasCalibratedShells,
|
||||
resolvePenetrationCoefficient(true, shell.type) - 1,
|
||||
@@ -310,8 +311,8 @@ export function tankCharacteristics(
|
||||
|
||||
const size = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
tankModelDefinition.boundingBox,
|
||||
turretModelDefinition.boundingBox,
|
||||
tankModelDefinition.bounding_box,
|
||||
turretModelDefinition.bounding_box,
|
||||
),
|
||||
);
|
||||
const weightKg =
|
||||
@@ -319,14 +320,14 @@ export function tankCharacteristics(
|
||||
engine.weight +
|
||||
track.weight +
|
||||
turret.weight +
|
||||
gun.gunType!.value.base.weight;
|
||||
gun.gun_type!.value.base.weight;
|
||||
const weightTons = weightKg / 1000;
|
||||
const stockWeight =
|
||||
tank.weight +
|
||||
stockEngine.weight +
|
||||
stockTrack.weight +
|
||||
stockTurret.weight +
|
||||
stockGun.gunType!.value.base.weight;
|
||||
stockGun.gun_type!.value.base.weight;
|
||||
const resolvedEnginePower = engine.power * enginePowerCoefficient;
|
||||
const dpm = resolveDpm(
|
||||
gun,
|
||||
@@ -336,12 +337,12 @@ export function tankCharacteristics(
|
||||
intraClipCoefficient,
|
||||
);
|
||||
const intraClip =
|
||||
gun.gunType?.$case === 'regular'
|
||||
gun.gun_type?.$case === 'regular'
|
||||
? undefined
|
||||
: gun.gunType!.value.extension.intraClip * intraClipCoefficient;
|
||||
: gun.gun_type!.value.extension.intra_clip * intraClipCoefficient;
|
||||
const mostOptimalShellIndex =
|
||||
gun.gunType!.$case === 'autoReloader'
|
||||
? gun.gunType!.value.extension.shellReloads.reduce<null | {
|
||||
gun.gun_type!.$case === 'auto_reloader'
|
||||
? gun.gun_type!.value.extension.shell_reloads.reduce<null | {
|
||||
index: number;
|
||||
reload: number;
|
||||
}>((current, reloadRaw, index) => {
|
||||
@@ -354,82 +355,86 @@ export function tankCharacteristics(
|
||||
return current;
|
||||
}, null)!.index
|
||||
: undefined;
|
||||
const damage = shell.armorDamage * damageCoefficient;
|
||||
const damage = shell.armor_damage * damageCoefficient;
|
||||
const dpmEffective =
|
||||
gun.gunType!.$case === 'autoReloader'
|
||||
? gun.gunType!.value.extension.shellReloads[0] >
|
||||
gun.gunType!.value.extension.shellReloads[1] +
|
||||
gun.gunType!.value.extension.intraClip
|
||||
? ((damageCoefficient * shell.armorDamage) /
|
||||
(gun.gunType!.value.extension.shellReloads.at(-1)! *
|
||||
gun.gun_type!.$case === 'auto_reloader'
|
||||
? gun.gun_type!.value.extension.shell_reloads[0] >
|
||||
gun.gun_type!.value.extension.shell_reloads[1] +
|
||||
gun.gun_type!.value.extension.intra_clip
|
||||
? ((damageCoefficient * shell.armor_damage) /
|
||||
(gun.gun_type!.value.extension.shell_reloads.at(-1)! *
|
||||
reloadCoefficient +
|
||||
gun.gunType!.value.extension.intraClip * intraClipCoefficient)) *
|
||||
gun.gun_type!.value.extension.intra_clip *
|
||||
intraClipCoefficient)) *
|
||||
(60 -
|
||||
(gun.gunType!.value.extension.shellReloads.slice(0, -1).length -
|
||||
(gun.gun_type!.value.extension.shell_reloads.slice(0, -1).length -
|
||||
1) *
|
||||
gun.gunType!.value.extension.intraClip *
|
||||
gun.gun_type!.value.extension.intra_clip *
|
||||
intraClipCoefficient) +
|
||||
damageCoefficient *
|
||||
shell.armorDamage *
|
||||
gun.gunType!.value.extension.shellReloads.slice(0, -1).length
|
||||
: ((damageCoefficient * shell.armorDamage) /
|
||||
(gun.gunType!.value.extension.shellReloads[0] * reloadCoefficient +
|
||||
gun.gunType!.value.extension.intraClip * intraClipCoefficient)) *
|
||||
shell.armor_damage *
|
||||
gun.gun_type!.value.extension.shell_reloads.slice(0, -1).length
|
||||
: ((damageCoefficient * shell.armor_damage) /
|
||||
(gun.gun_type!.value.extension.shell_reloads[0] *
|
||||
reloadCoefficient +
|
||||
gun.gun_type!.value.extension.intra_clip *
|
||||
intraClipCoefficient)) *
|
||||
(60 -
|
||||
(gun.gunType!.value.extension.shellReloads.slice(1).length - 1) *
|
||||
gun.gunType!.value.extension.intraClip *
|
||||
(gun.gun_type!.value.extension.shell_reloads.slice(1).length -
|
||||
1) *
|
||||
gun.gun_type!.value.extension.intra_clip *
|
||||
intraClipCoefficient) +
|
||||
damageCoefficient *
|
||||
shell.armorDamage *
|
||||
gun.gunType!.value.extension.shellReloads.slice(1).length
|
||||
shell.armor_damage *
|
||||
gun.gun_type!.value.extension.shell_reloads.slice(1).length
|
||||
: undefined;
|
||||
const shells =
|
||||
gun.gunType!.$case === 'regular'
|
||||
gun.gun_type!.$case === 'regular'
|
||||
? 1
|
||||
: gun.gunType!.value.extension.shellCount;
|
||||
: gun.gun_type!.value.extension.shell_count;
|
||||
const shellReloads =
|
||||
gun.gunType!.$case === 'autoReloader'
|
||||
? gun.gunType!.value.extension.shellReloads.map(
|
||||
gun.gun_type!.$case === 'auto_reloader'
|
||||
? gun.gun_type!.value.extension.shell_reloads.map(
|
||||
(reload) => reload * reloadCoefficient,
|
||||
)
|
||||
: undefined;
|
||||
const shellReload =
|
||||
gun.gunType!.$case === 'autoReloader'
|
||||
gun.gun_type!.$case === 'auto_reloader'
|
||||
? undefined
|
||||
: (gun.gunType!.$case === 'regular'
|
||||
? gun.gunType!.value.extension.reload
|
||||
: gun.gunType!.value.extension.clipReload) * reloadCoefficient;
|
||||
: (gun.gun_type!.$case === 'regular'
|
||||
? gun.gun_type!.value.extension.reload
|
||||
: gun.gun_type!.value.extension.clip_reload) * reloadCoefficient;
|
||||
const caliber = shell.caliber;
|
||||
const penetration = shell.penetration.near * penetrationCoefficient;
|
||||
const clipDamage =
|
||||
gun.gunType!.$case === 'regular'
|
||||
gun.gun_type!.$case === 'regular'
|
||||
? undefined
|
||||
: gun.gunType!.value.extension.shellCount * damage;
|
||||
const moduleDamage = shell.moduleDamage * damageCoefficient;
|
||||
const explosionRadius = shell.explosionRadius;
|
||||
: gun.gun_type!.value.extension.shell_count * damage;
|
||||
const moduleDamage = shell.module_damage * damageCoefficient;
|
||||
const explosionRadius = shell.explosion_radius;
|
||||
const shellVelocity = shell.velocity * shellVelocityCoefficient;
|
||||
const aimTime = gun.gunType!.value.base.aimTime * aimTimeCoefficient;
|
||||
const aimTime = gun.gun_type!.value.base.aim_time * aimTimeCoefficient;
|
||||
const dispersion =
|
||||
gun.gunType!.value.base.dispersionBase * dispersionStillCoefficient;
|
||||
gun.gun_type!.value.base.dispersion_base * dispersionStillCoefficient;
|
||||
const maxDispersion =
|
||||
gun.gunType!.value.base.dispersionBase *
|
||||
gun.gun_type!.value.base.dispersion_base *
|
||||
Math.sqrt(
|
||||
((gun.gunType!.value.base.dispersionTraverse * turret.traverseSpeed) **
|
||||
((gun.gun_type!.value.base.dispersion_traverse * turret.traverse_speed) **
|
||||
2 +
|
||||
(track.traverseSpeed * track.traverseSpeed) ** 2 +
|
||||
track.dispersionMove * tank.speedForwards) **
|
||||
(track.traverse_speed * track.traverse_speed) ** 2 +
|
||||
track.dispersion_move * tank.speed_forwards) **
|
||||
2,
|
||||
);
|
||||
const dispersionMoving = track.dispersionMove * dispersionMovingCoefficient;
|
||||
const dispersionMoving = track.dispersion_move * dispersionMovingCoefficient;
|
||||
const dispersionHullTraversing =
|
||||
track.traverseSpeed * dispersionHullTraverseCoefficient;
|
||||
track.traverse_speed * dispersionHullTraverseCoefficient;
|
||||
const dispersionTurretTraversing =
|
||||
gun.gunType!.value.base.dispersionTraverse *
|
||||
gun.gun_type!.value.base.dispersion_traverse *
|
||||
dispersionTurretTraverseCoefficient;
|
||||
const dispersionShooting =
|
||||
gun.gunType!.value.base.dispersionShot * dispersionAfterShotCoefficient;
|
||||
gun.gun_type!.value.base.dispersion_shot * dispersionAfterShotCoefficient;
|
||||
const dispersionGunDamaged =
|
||||
gun.gunType!.value.base.dispersionDamaged * dispersionDamagedCoefficient;
|
||||
gun.gun_type!.value.base.dispersion_damaged * dispersionDamagedCoefficient;
|
||||
const gunDepression =
|
||||
gunModelDefinition.pitch.max +
|
||||
gunDefaultPitch +
|
||||
@@ -450,17 +455,17 @@ export function tankCharacteristics(
|
||||
? -turretModelDefinition.yaw.min
|
||||
: undefined;
|
||||
const azimuthRight = turretModelDefinition.yaw?.max;
|
||||
const speedForwards = tank.speedForwards + speedForwardsSum;
|
||||
const speedBackwards = tank.speedBackwards + speedBackwardsSum;
|
||||
const speedForwards = tank.speed_forwards + speedForwardsSum;
|
||||
const speedBackwards = tank.speed_backwards + speedBackwardsSum;
|
||||
const enginePower = resolvedEnginePower;
|
||||
const hardTerrainCoefficientRaw =
|
||||
track.resistanceHard * resistanceHardCoefficient;
|
||||
track.resistance_hard * resistanceHardCoefficient;
|
||||
const hardTerrainCoefficient = 100 / hardTerrainCoefficientRaw;
|
||||
const mediumTerrainCoefficientRaw =
|
||||
track.resistanceMedium * resistanceMediumCoefficient;
|
||||
track.resistance_medium * resistanceMediumCoefficient;
|
||||
const mediumTerrainCoefficient = 100 / mediumTerrainCoefficientRaw;
|
||||
const softTerrainCoefficientRaw =
|
||||
track.resistanceSoft * resistanceSoftCoefficient;
|
||||
track.resistance_soft * resistanceSoftCoefficient;
|
||||
const softTerrainCoefficient = 100 / softTerrainCoefficientRaw;
|
||||
const powerToWeightRatioHardTerrain =
|
||||
resolvedEnginePower / weightTons / hardTerrainCoefficientRaw;
|
||||
@@ -469,44 +474,44 @@ export function tankCharacteristics(
|
||||
const powerToWeightRatioSoftTerrain =
|
||||
resolvedEnginePower / weightTons / softTerrainCoefficientRaw;
|
||||
const weight = weightTons;
|
||||
const turretTraverseSpeed = turret.traverseSpeed * turretTraverseCoefficient;
|
||||
const turretTraverseSpeed = turret.traverse_speed * turretTraverseCoefficient;
|
||||
const hullTraverseHardTerrain =
|
||||
(resolvedEnginePower / stockEngine.power) *
|
||||
track.traverseSpeed *
|
||||
track.traverse_speed *
|
||||
hullTraverseCoefficient *
|
||||
(track.resistanceHard / hardTerrainCoefficientRaw) *
|
||||
(track.resistance_hard / hardTerrainCoefficientRaw) *
|
||||
(stockWeight / weightKg);
|
||||
const hullTraverseMediumTerrain =
|
||||
(resolvedEnginePower / stockEngine.power) *
|
||||
track.traverseSpeed *
|
||||
track.traverse_speed *
|
||||
hullTraverseCoefficient *
|
||||
(track.resistanceHard / mediumTerrainCoefficientRaw) *
|
||||
(track.resistance_hard / mediumTerrainCoefficientRaw) *
|
||||
(stockWeight / weightKg);
|
||||
const hullTraverseSoftTerrain =
|
||||
(resolvedEnginePower / stockEngine.power) *
|
||||
track.traverseSpeed *
|
||||
track.traverse_speed *
|
||||
hullTraverseCoefficient *
|
||||
(track.resistanceHard / softTerrainCoefficientRaw) *
|
||||
(track.resistance_hard / softTerrainCoefficientRaw) *
|
||||
(stockWeight / weightKg);
|
||||
const health = (tank.health + turret.health) * healthCoefficient;
|
||||
const fireChance = engine.fireChance * fireChanceCoefficient;
|
||||
const viewRange = turret.viewRange * viewRangeCoefficient;
|
||||
const camouflageStill = tank.camouflageStill * camouflageCoefficientStill;
|
||||
const fireChance = engine.fire_chance * fireChanceCoefficient;
|
||||
const viewRange = turret.view_range * viewRangeCoefficient;
|
||||
const camouflageStill = tank.camouflage_still * camouflageCoefficientStill;
|
||||
const camouflageMoving =
|
||||
tank.class === TankClass.LIGHT
|
||||
? tank.camouflageStill * camouflageCoefficientStill
|
||||
: tank.camouflageMoving * camouflageCoefficientMoving;
|
||||
? tank.camouflage_still * camouflageCoefficientStill
|
||||
: tank.camouflage_moving * camouflageCoefficientMoving;
|
||||
const camouflageShootingStill =
|
||||
tank.camouflageStill *
|
||||
gun.gunType!.value.base.camouflageLoss *
|
||||
tank.camouflage_still *
|
||||
gun.gun_type!.value.base.camouflage_loss *
|
||||
camouflageCoefficientStill;
|
||||
const camouflageShootingMoving =
|
||||
(tank.class === TankClass.LIGHT
|
||||
? tank.camouflageStill * camouflageCoefficientStill
|
||||
: tank.camouflageMoving * camouflageCoefficientMoving) *
|
||||
gun.gunType!.value.base.camouflageLoss;
|
||||
? tank.camouflage_still * camouflageCoefficientStill
|
||||
: tank.camouflage_moving * camouflageCoefficientMoving) *
|
||||
gun.gun_type!.value.base.camouflage_loss;
|
||||
const camouflageCaughtOnFire =
|
||||
tank.camouflageOnFire * tank.camouflageStill * camouflageCoefficientStill;
|
||||
tank.camouflage_onFire * tank.camouflage_still * camouflageCoefficientStill;
|
||||
const width = size.z;
|
||||
const height = size.x;
|
||||
const length = size.y;
|
||||
|
||||
@@ -37,11 +37,11 @@ export function tankToDuelMember(
|
||||
infinityFallback(PROVISION_PREFERENCES.indexOf(b.id)),
|
||||
)
|
||||
.sort((a, b) => (b.crew ?? 0) - (a.crew ?? 0))
|
||||
.slice(0, tank.maxProvisions)
|
||||
.slice(0, tank.max_provisions)
|
||||
.map(({ id }) => id),
|
||||
engine: tank.engines.at(-1)!,
|
||||
gun,
|
||||
shell: tank.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0],
|
||||
shell: tank.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0],
|
||||
tank,
|
||||
track: tank.tracks.at(-1)!,
|
||||
yaw: 0,
|
||||
|
||||
@@ -8,7 +8,7 @@ export function useEquipment(id: number, antagonist = false) {
|
||||
const member = Duel.use(
|
||||
(state) => state[antagonist ? 'antagonist' : 'protagonist']!,
|
||||
);
|
||||
const preset = equipmentDefinitions.presets[member.tank.equipmentPreset];
|
||||
const preset = equipmentDefinitions.presets[member.tank.equipment_preset];
|
||||
const equipmentMatrix = Duel.use(
|
||||
(state) =>
|
||||
state[antagonist ? 'antagonist' : 'protagonist']!.equipmentMatrix,
|
||||
|
||||
@@ -22,8 +22,8 @@ export function useTankTransform(
|
||||
const turretModelDefinition = tankModelDefinition.turrets[member.turret.id];
|
||||
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turretOrigin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gunOrigin);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
||||
const turretPosition = new Vector3();
|
||||
const turretRotation = new Euler();
|
||||
const gunPosition = new Vector3();
|
||||
@@ -52,15 +52,15 @@ export function useTankTransform(
|
||||
.applyAxisAngle(new Vector3(0, 0, 1), yaw);
|
||||
turretRotation.set(0, 0, yaw);
|
||||
|
||||
if (tankModelDefinition.initialTurretRotation) {
|
||||
if (tankModelDefinition.initial_turret_rotation) {
|
||||
const initialPitch = -degToRad(
|
||||
tankModelDefinition.initialTurretRotation.pitch,
|
||||
tankModelDefinition.initial_turret_rotation.pitch,
|
||||
);
|
||||
const initialYaw = -degToRad(
|
||||
tankModelDefinition.initialTurretRotation.yaw,
|
||||
tankModelDefinition.initial_turret_rotation.yaw,
|
||||
);
|
||||
const initialRoll = -degToRad(
|
||||
tankModelDefinition.initialTurretRotation.roll,
|
||||
tankModelDefinition.initial_turret_rotation.roll,
|
||||
);
|
||||
|
||||
turretPosition
|
||||
|
||||
Reference in new issue
Block a user