mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-21 04:43:31 +01:00
feat: upgrade tankopedia stores
This commit is contained in:
1 parent
5bf9f8ca9e
commit
84bbb05d43
26 files changed
+356
-356
No files matched your search
@@ -0,0 +1,80 @@
|
||||
import { Vector3 } from 'three';
|
||||
import { create } from 'zustand';
|
||||
import { subscribeWithSelector } from 'zustand/middleware';
|
||||
import { ArmorType } from '../components/Armor/components/SpacedArmorScene';
|
||||
import { ExternalModuleVariant } from '../components/Armor/components/SpacedArmorSceneComponent';
|
||||
import { createNextSafeStore } from '../core/zustand/createNextSafeStore';
|
||||
|
||||
interface TankopediaEphemeral {
|
||||
shot?: Shot;
|
||||
skills: Record<string, number>;
|
||||
controlsEnabled: boolean;
|
||||
}
|
||||
|
||||
export interface ShotLayerBase {
|
||||
index: number;
|
||||
thickness: number;
|
||||
point: Vector3;
|
||||
surfaceNormal: Vector3;
|
||||
status: 'blocked' | 'penetration' | 'ricochet';
|
||||
}
|
||||
|
||||
interface ShotLayerExternal extends ShotLayerBase {
|
||||
type: ArmorType.External;
|
||||
variant: ExternalModuleVariant;
|
||||
}
|
||||
|
||||
export interface ShotLayerNonExternal extends ShotLayerBase {
|
||||
type: Exclude<ArmorType, ArmorType.External>;
|
||||
angle: number;
|
||||
thicknessAngled: number;
|
||||
}
|
||||
|
||||
export interface ShotLayerGap {
|
||||
type: null;
|
||||
status: 'penetration' | 'blocked';
|
||||
distance: number;
|
||||
}
|
||||
|
||||
export type ShotLayer = ShotLayerExternal | ShotLayerNonExternal | ShotLayerGap;
|
||||
|
||||
export type Shot = {
|
||||
containsGaps: boolean;
|
||||
damage: number;
|
||||
|
||||
in: {
|
||||
surfaceNormal: Vector3;
|
||||
status: ShotStatus;
|
||||
layers: ShotLayer[];
|
||||
};
|
||||
out?: {
|
||||
surfaceNormal: Vector3;
|
||||
status: ShotStatus;
|
||||
layers: ShotLayer[];
|
||||
};
|
||||
};
|
||||
|
||||
export type ShotStatus = 'penetration' | 'blocked' | 'ricochet' | 'splash';
|
||||
|
||||
export type ArmorPiercingLayer =
|
||||
| {
|
||||
distance: number;
|
||||
nominal: number;
|
||||
angled: number;
|
||||
ricochet: boolean;
|
||||
type: 'core' | 'spaced' | 'external';
|
||||
}
|
||||
| {
|
||||
type: 'gap';
|
||||
gap: number;
|
||||
};
|
||||
|
||||
export const { Provider, use, useMutation, useStore } = createNextSafeStore(
|
||||
() =>
|
||||
create<TankopediaEphemeral>()(
|
||||
subscribeWithSelector<TankopediaEphemeral>(() => ({
|
||||
skills: {},
|
||||
controlsEnabled: true,
|
||||
})),
|
||||
),
|
||||
);
|
||||
Reference in new issue
Block a user