mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
createTankStatus
This commit is contained in:
1 parent
4e470599e8
commit
e911f36ea3
6 files changed
+85
-343
No files matched your search
@@ -1,8 +1,12 @@
|
||||
import { TrashIcon } from "@radix-ui/react-icons";
|
||||
import { useProtagonist } from "../../hooks/useProtagonist";
|
||||
import { useStrings } from "../../hooks/useStrings";
|
||||
import { Tankopedia } from "../../stores/tankopedia";
|
||||
import { hasUpgrades } from "../../tankopedia/hasUpgrades";
|
||||
import type { ComputedCharacteristics } from "../../types/characteristics";
|
||||
import { Heading } from "../Heading";
|
||||
import { IconButton } from "../IconButton";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
interface TankopediaLoadoutProps {
|
||||
characteristics: ComputedCharacteristics;
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
createDefaultSkills,
|
||||
ShellDefinition,
|
||||
TankDefinition,
|
||||
type ModelDefinition,
|
||||
} from "@blitzkit/core";
|
||||
import type { Vector3 } from "three";
|
||||
import { Varuna } from "varuna";
|
||||
@@ -10,10 +9,8 @@ import { api } from "../blitzkit/api";
|
||||
import type { ArmorType } from "../components/Armor/components/SpacedArmorScene";
|
||||
import type { ExternalModuleVariant } from "../components/Armor/components/SpacedArmorSceneComponent";
|
||||
import type { XP_MULTIPLIERS } from "../components/Tankopedia/TechTreeSection";
|
||||
import {
|
||||
createTankState,
|
||||
type EquipmentMatrix,
|
||||
} from "../tankopedia/createTankState";
|
||||
import { createTankState } from "../tankopedia/createTankState";
|
||||
import type { TankState } from "../tankopedia/tankState";
|
||||
import { TankopediaDisplay } from "./tankopediaPersistent/constants";
|
||||
|
||||
export interface ShotLayerBase {
|
||||
@@ -81,28 +78,6 @@ export enum TankopediaRelativeAgainst {
|
||||
All,
|
||||
}
|
||||
|
||||
export interface TankState {
|
||||
tank: number;
|
||||
|
||||
engine: number;
|
||||
turret: number;
|
||||
gun: number;
|
||||
shell: number;
|
||||
track: number;
|
||||
|
||||
assault_distance: number;
|
||||
speed: number;
|
||||
|
||||
model: ModelDefinition;
|
||||
|
||||
equipment_matrix: EquipmentMatrix;
|
||||
|
||||
consumables: number[];
|
||||
provisions: number[];
|
||||
camouflage: boolean;
|
||||
cooldown_booster: number;
|
||||
}
|
||||
|
||||
interface Tankopedia {
|
||||
disturbed: boolean;
|
||||
revealed: boolean;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createDefaultProvisions, type TankDefinition } from "@blitzkit/core";
|
||||
import { api } from "../blitzkit/api";
|
||||
import type { TankState } from "../stores/tankopedia";
|
||||
import { createTankStatus } from "./createTankStatus";
|
||||
import type { TankState } from "./tankState";
|
||||
|
||||
export type EquipmentMatrix = [
|
||||
[number, number, number],
|
||||
@@ -24,7 +25,6 @@ export function createTankState(tank: TankDefinition) {
|
||||
|
||||
return {
|
||||
tank: tank.id,
|
||||
model: models.models[turret.id],
|
||||
|
||||
engine: tank.engines.at(-1)!.id,
|
||||
turret: turret.id,
|
||||
@@ -36,6 +36,9 @@ export function createTankState(tank: TankDefinition) {
|
||||
speed: 0,
|
||||
|
||||
equipment_matrix: genericDefaultEquipmentMatrix,
|
||||
status: createTankStatus(),
|
||||
|
||||
model: models.models[turret.id],
|
||||
|
||||
consumables: [],
|
||||
provisions: createDefaultProvisions(tank, gun, provisions, scripts),
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { TankState } from "./tankState";
|
||||
|
||||
export function createTankStatus() {
|
||||
const status = {
|
||||
commander_dead: false,
|
||||
gunner_dead: false,
|
||||
driver_dead: false,
|
||||
loader_dead: false,
|
||||
|
||||
fuel_tank_damaged: false,
|
||||
engine_damaged: false,
|
||||
chassis_damaged: false,
|
||||
viewport_damaged: false,
|
||||
ammo_bay_damaged: false,
|
||||
gun_damaged: false,
|
||||
turret_damaged: false,
|
||||
|
||||
caught_on_fire: false,
|
||||
shooting: false,
|
||||
turret_traversing: false,
|
||||
hull_traversing: false,
|
||||
} satisfies TankState["status"];
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { ModelDefinition } from "@blitzkit/core";
|
||||
import type { EquipmentMatrix } from "./createTankState";
|
||||
|
||||
export interface TankState {
|
||||
tank: number;
|
||||
|
||||
engine: number;
|
||||
turret: number;
|
||||
gun: number;
|
||||
shell: number;
|
||||
track: number;
|
||||
|
||||
assault_distance: number;
|
||||
speed: number;
|
||||
|
||||
equipment_matrix: EquipmentMatrix;
|
||||
status: Record<VehicleStatusKey, boolean>;
|
||||
|
||||
model: ModelDefinition;
|
||||
|
||||
consumables: number[];
|
||||
provisions: number[];
|
||||
camouflage: boolean;
|
||||
cooldown_booster: number;
|
||||
}
|
||||
|
||||
export const vehicleStatusKeys = [
|
||||
["commander_dead", "gunner_dead", "driver_dead", "loader_dead"],
|
||||
|
||||
[
|
||||
"fuel_tank_damaged",
|
||||
"engine_damaged",
|
||||
"chassis_damaged",
|
||||
"viewport_damaged",
|
||||
"ammo_bay_damaged",
|
||||
"gun_damaged",
|
||||
"turret_damaged",
|
||||
],
|
||||
|
||||
["caught_on_fire", "shooting", "turret_traversing", "hull_traversing"],
|
||||
] as const;
|
||||
|
||||
export type VehicleStatusKey = (typeof vehicleStatusKeys)[number][number];
|
||||
Reference in new issue
Block a user