mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-28 12:23:24 +01:00
tank states
This commit is contained in:
1 parent
6c9ce58af5
commit
7d02f6311f
16 files changed
+110
-349
No files matched your search
@@ -1,7 +0,0 @@
|
||||
import type { EquipmentMatrix } from '.';
|
||||
|
||||
export const genericDefaultEquipmentMatrix: EquipmentMatrix = [
|
||||
[-1, 1, -1],
|
||||
[0, 0, 0],
|
||||
[0, 0, 0],
|
||||
];
|
||||
@@ -1,56 +0,0 @@
|
||||
import {
|
||||
ModelDefinition,
|
||||
type EngineDefinition,
|
||||
type GunDefinition,
|
||||
type ShellDefinition,
|
||||
type TankDefinition,
|
||||
type TrackDefinition,
|
||||
type TurretDefinition,
|
||||
} from "@blitzkit/core";
|
||||
import { Varuna } from "varuna";
|
||||
import { api } from "../../blitzkit/api";
|
||||
import { tankToDuelMember } from "../../core/blitzkit/tankToDuelMember";
|
||||
|
||||
type EquipmentMatrixItem = -1 | 0 | 1;
|
||||
type EquipmentMatrixRow = [
|
||||
EquipmentMatrixItem,
|
||||
EquipmentMatrixItem,
|
||||
EquipmentMatrixItem,
|
||||
];
|
||||
export type EquipmentMatrix = [
|
||||
EquipmentMatrixRow,
|
||||
EquipmentMatrixRow,
|
||||
EquipmentMatrixRow,
|
||||
];
|
||||
|
||||
export interface DuelMember {
|
||||
tank: TankDefinition;
|
||||
engine: EngineDefinition;
|
||||
turret: TurretDefinition;
|
||||
gun: GunDefinition;
|
||||
shell: ShellDefinition;
|
||||
track: TrackDefinition;
|
||||
equipmentMatrix: EquipmentMatrix;
|
||||
consumables: number[];
|
||||
provisions: number[];
|
||||
camouflage: boolean;
|
||||
cooldownBooster: number;
|
||||
assaultDistance: number;
|
||||
}
|
||||
|
||||
export interface DuelStore {
|
||||
protagonist: DuelMember;
|
||||
antagonist: DuelMember;
|
||||
equalize: boolean;
|
||||
}
|
||||
|
||||
const provisionDefinitions = await api.provisions();
|
||||
|
||||
export const Duel = new Varuna<
|
||||
DuelStore,
|
||||
{ tank: TankDefinition; model: ModelDefinition }
|
||||
>(({ tank, model }) => {
|
||||
const protagonist = tankToDuelMember(tank, provisionDefinitions);
|
||||
|
||||
return { protagonist, antagonist: protagonist, model, equalize: false };
|
||||
});
|
||||
@@ -1,6 +1,11 @@
|
||||
import {
|
||||
createDefaultSkills,
|
||||
EngineDefinition,
|
||||
GunDefinition,
|
||||
ShellDefinition,
|
||||
TankDefinition,
|
||||
TrackDefinition,
|
||||
TurretDefinition,
|
||||
type ModelDefinition,
|
||||
} from "@blitzkit/core";
|
||||
import type { Vector3 } from "three";
|
||||
@@ -9,6 +14,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 } from "../tankopedia/createTankState";
|
||||
import type { EquipmentMatrix } from "./duel";
|
||||
import { TankopediaDisplay } from "./tankopediaPersistent/constants";
|
||||
|
||||
export interface ShotLayerBase {
|
||||
@@ -76,13 +83,34 @@ export enum TankopediaRelativeAgainst {
|
||||
All,
|
||||
}
|
||||
|
||||
export interface TankState {
|
||||
tank: TankDefinition;
|
||||
model: ModelDefinition;
|
||||
|
||||
engine: EngineDefinition;
|
||||
turret: TurretDefinition;
|
||||
gun: GunDefinition;
|
||||
shell: ShellDefinition;
|
||||
track: TrackDefinition;
|
||||
|
||||
equipment_matrix: EquipmentMatrix;
|
||||
|
||||
consumables: number[];
|
||||
provisions: number[];
|
||||
camouflage: boolean;
|
||||
cooldown_booster: number;
|
||||
assault_distance: number;
|
||||
}
|
||||
|
||||
interface Tankopedia {
|
||||
disturbed: boolean;
|
||||
revealed: boolean;
|
||||
|
||||
protagonist: TankState;
|
||||
|
||||
shot?: Shot;
|
||||
skills: Record<string, number>;
|
||||
relativeAgainst: TankopediaRelativeAgainst;
|
||||
model: ModelDefinition;
|
||||
editStatic: boolean;
|
||||
highlightArmor?: {
|
||||
editingPlate: boolean;
|
||||
@@ -105,15 +133,19 @@ interface Tankopedia {
|
||||
statSearch?: string;
|
||||
}
|
||||
|
||||
const skillDefinitions = await api.skills();
|
||||
const skills = await api.skills();
|
||||
const models = await api.models();
|
||||
|
||||
export const Tankopedia = new Varuna<Tankopedia, ModelDefinition>((model) => ({
|
||||
export const Tankopedia = new Varuna<Tankopedia, TankDefinition>((tank) => ({
|
||||
disturbed: false,
|
||||
revealed: false,
|
||||
|
||||
protagonist: createTankState(tank),
|
||||
model: models.models[tank.id],
|
||||
|
||||
relativeAgainst: TankopediaRelativeAgainst.Class,
|
||||
editStatic: false,
|
||||
skills: createDefaultSkills(skillDefinitions),
|
||||
model,
|
||||
skills: createDefaultSkills(skills),
|
||||
xpMultiplier: 1,
|
||||
requestedDisplay: TankopediaDisplay.Model,
|
||||
display: TankopediaDisplay.Model,
|
||||
|
||||
Reference in new issue
Block a user