mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 12:39:49 +01:00
hasUpgrades
This commit is contained in:
1 parent
99965118b3
commit
99317c2075
2 files changed
+12
-4
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
import { useProtagonist } from "../../hooks/useProtagonist";
|
import { useProtagonist } from "../../hooks/useProtagonist";
|
||||||
|
import { hasUpgrades } from "../../tankopedia/hasUpgrades";
|
||||||
import type { ComputedCharacteristics } from "../../types/characteristics";
|
import type { ComputedCharacteristics } from "../../types/characteristics";
|
||||||
|
|
||||||
interface TankopediaLoadoutProps {
|
interface TankopediaLoadoutProps {
|
||||||
@@ -7,10 +8,7 @@ interface TankopediaLoadoutProps {
|
|||||||
|
|
||||||
export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) {
|
export function TankopediaLoadout({ characteristics }: TankopediaLoadoutProps) {
|
||||||
const tank = useProtagonist();
|
const tank = useProtagonist();
|
||||||
|
const showModules = hasUpgrades(tank);
|
||||||
const showModules = tank.tank!.upgrade_lines.some(
|
|
||||||
(line) => line.stages.length > 1 || isAlternativeLine(line.name),
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import type { TankDefinition } from "@blitzkit/core";
|
||||||
|
|
||||||
|
export function hasUpgrades(tank: TankDefinition) {
|
||||||
|
return (
|
||||||
|
tank.tracks.length > 1 ||
|
||||||
|
tank.engines.length > 1 ||
|
||||||
|
tank.turrets.length > 1 ||
|
||||||
|
tank.turrets.some((turret) => turret.guns.length > 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user