diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index e1ca671f5..d1471e5fb 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -227,7 +227,8 @@ "burst_size": "Burst size", "intra_burst": "Intra-burst", "penetration": "Penetration", - "penetration_loss": "Penetration loss", + "penetration_loss_by_distance": "Penetration loss by distance", + "penetration_loss_after_ricochet": "Penetration loss after ricochet", "shell_velocity": "Shell velocity", "shell_range": "Shell range", "shell_capacity": "Shell capacity", diff --git a/packages/website-ue/src/components/TankopediaCharacteristics/index.tsx b/packages/website-ue/src/components/TankopediaCharacteristics/index.tsx index 90444791b..c7672b49d 100644 --- a/packages/website-ue/src/components/TankopediaCharacteristics/index.tsx +++ b/packages/website-ue/src/components/TankopediaCharacteristics/index.tsx @@ -21,9 +21,16 @@ export function TankopediaCharacteristics({ return (
- {characteristicsOrder.map((group) => ( - - ))} + {characteristicsOrder.map((group) => { + const items = group.order.filter( + (item) => "name" in item && characteristics[item.name] !== null, + ).length; + const shouldRender = items > 0; + + if (!shouldRender) return null; + + return ; + })}
); diff --git a/packages/website-ue/src/tankopedia/characteristics.ts b/packages/website-ue/src/tankopedia/characteristics.ts index f4e9f4800..ee4f1696c 100644 --- a/packages/website-ue/src/tankopedia/characteristics.ts +++ b/packages/website-ue/src/tankopedia/characteristics.ts @@ -1,5 +1,6 @@ import { TankClass } from "@protos/blitz_static_tank_component"; import { + ModuleUpgrade_AttributeName, ShellUpgradeSingleChange_AttributeName, StageParameters, TankAttributeChange_AttributeName, @@ -8,7 +9,6 @@ import type { Tank } from "@protos/tank"; import { radToDeg } from "three/src/math/MathUtils.js"; import { applyPitchYawLimits } from "./applyPitchYawLimits"; import { TerrainHardness, type TankState } from "./tankState"; -import { attribute } from "three/src/nodes/core/AttributeNode.js"; export type CharacteristicOutput = number | number[] | string | null; @@ -458,7 +458,19 @@ export const characteristics = { return -Infinity; }, - penetration_loss() { - return -Infinity; + penetration_loss_after_ricochet({ shell }) { + const loss = shell( + ShellUpgradeSingleChange_AttributeName.ATTRIBUTE_NAME_PIERCING_POWER_LOSS_AFTER_HIT, + ); + + return loss; + }, + + penetration_loss_by_distance({ attributeSafe }) { + const loss = attributeSafe( + TankAttributeChange_AttributeName.ATTRIBUTE_NAME_SHELLS_PIERCING_POWER_LOSS_REDUCTION, + ); + + return loss ?? 0; }, } satisfies Record; diff --git a/packages/website-ue/src/tankopedia/characteristicsOrder.tsx b/packages/website-ue/src/tankopedia/characteristicsOrder.tsx index 312d1461f..0073dbdbd 100644 --- a/packages/website-ue/src/tankopedia/characteristicsOrder.tsx +++ b/packages/website-ue/src/tankopedia/characteristicsOrder.tsx @@ -143,13 +143,14 @@ export const characteristicsOrder: CharacteristicsGroup[] = [ render: CharacteristicsGroupRender.Statistical, order: [ { name: "penetration", units: "mm" }, - { name: "penetration_loss" }, + { name: "penetration_loss_by_distance" }, + { name: "penetration_loss_after_ricochet" }, { name: "shell_velocity", units: "m_s" }, { name: "shell_range", units: "m" }, { name: "shell_capacity" }, { name: "caliber", units: "mm" }, - { name: "normalization", units: "deg" }, { name: "ricochet", units: "deg" }, + { name: "normalization", units: "deg" }, { toy: "ricochet" }, ],