feat: armor modes

This commit is contained in:
TrèsAbhi committed 2024-09-22 21:12:18 -05:00
1 parent ffa1395b50
commit f1410cf321
42 files changed
+293 -264

No files matched your search

@@ -1,4 +1,4 @@
import { EquipmentMatrix } from '.';
import type { EquipmentMatrix } from '.';
export const genericDefaultEquipmentMatrix: EquipmentMatrix = [
[-1, 1, -1],
@@ -1,4 +1,4 @@
import lodash from 'lodash-es';
import * as lodash from 'lodash-es';
import { create } from 'zustand';
import { persist, subscribeWithSelector } from 'zustand/middleware';
import { createContextualStore } from '../../core/zustand/createContextualStore';
@@ -1,8 +1,8 @@
import type { ModelDefinition } from '@blitzkit/core';
import { Vector3 } from 'three';
import type { Vector3 } from 'three';
import { create } from 'zustand';
import { subscribeWithSelector } from 'zustand/middleware';
import { ArmorType } from '../components/Armor/components/SpacedArmorScene';
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 { createContextualStore } from '../core/zustand/createContextualStore';
@@ -66,19 +66,6 @@ export type ArmorPiercingLayer =
gap: number;
};
export const TankopediaEphemeral = createContextualStore(
(model: ModelDefinition) =>
create<TankopediaEphemeral>()(
subscribeWithSelector<TankopediaEphemeral>(() => ({
editStatic: false,
skills: {},
model,
controlsEnabled: true,
xpMultiplier: 1,
})),
),
);
interface TankopediaEphemeral {
shot?: Shot;
skills: Record<string, number>;
@@ -101,3 +88,16 @@ interface TankopediaEphemeral {
);
xpMultiplier: (typeof XP_MULTIPLIERS)[number];
}
export const TankopediaEphemeral = createContextualStore(
(model: ModelDefinition) =>
create<TankopediaEphemeral>()(
subscribeWithSelector<TankopediaEphemeral>(() => ({
editStatic: false,
skills: {},
model,
controlsEnabled: true,
xpMultiplier: 1,
})),
),
);
@@ -1,6 +1,6 @@
import * as lodash from 'lodash-es';
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { persist, subscribeWithSelector } from 'zustand/middleware';
import { ENVIRONMENTS } from '../../constants/lightingEnvironments';
import { createContextualStore } from '../../core/zustand/createContextualStore';
import { SORT_NAMES, TankopediaDisplay } from './constants';
@@ -31,13 +31,13 @@ export interface TankopediaPersistentStore {
export const TankopediaPersistent = createContextualStore(() =>
create<TankopediaPersistentStore>()(
persist(
(set) => ({
subscribeWithSelector<TankopediaPersistentStore>(() => ({
wireframe: false,
opaque: false,
environment: ENVIRONMENTS[0],
showGrid: true,
greenPenetration: true,
showEnvironment: true,
greenPenetration: false,
showEnvironment: false,
showSpacedArmor: true,
showExternalModules: true,
showPrimaryArmor: true,
@@ -46,7 +46,7 @@ export const TankopediaPersistent = createContextualStore(() =>
direction: 'ascending',
},
display: TankopediaDisplay.Model,
}),
})),
{ name: 'tankopedia', merge: (a, b) => lodash.merge(b, a) },
),
),