mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-18 11:25:25 +01:00
feat: start of monorepo
This commit is contained in:
1 parent
14f39d71ac
commit
73c7bdf0c0
260 files changed
+1236
-1235
No files matched your search
@@ -0,0 +1,68 @@
|
||||
'use client';
|
||||
|
||||
import { createNextSafeStore } from '@blitzkit/core/src/zustand/createNextSafeStore';
|
||||
import { create } from 'zustand';
|
||||
import { subscribeWithSelector } from 'zustand/middleware';
|
||||
import { ProvisionDefinitions } from '../../../../../src/core/blitzkit/provisionDefinitions';
|
||||
import {
|
||||
EngineDefinition,
|
||||
GunDefinition,
|
||||
ShellDefinition,
|
||||
TankDefinition,
|
||||
TrackDefinition,
|
||||
TurretDefinition,
|
||||
} from '../../../../../src/core/blitzkit/tankDefinitions';
|
||||
import { tankToDuelMember } from '../../../../../src/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;
|
||||
pitch: number;
|
||||
yaw: number;
|
||||
consumables: number[];
|
||||
crewMastery: number;
|
||||
provisions: number[];
|
||||
camouflage: boolean;
|
||||
cooldownBooster: number;
|
||||
}
|
||||
|
||||
export interface Duel {
|
||||
protagonist: DuelMember;
|
||||
antagonist: DuelMember;
|
||||
}
|
||||
|
||||
export const { Provider, use, useMutation, useStore } = createNextSafeStore(
|
||||
({
|
||||
tank,
|
||||
provisionDefinitions,
|
||||
}: {
|
||||
tank: TankDefinition;
|
||||
provisionDefinitions: ProvisionDefinitions;
|
||||
}) => {
|
||||
const protagonist = tankToDuelMember(tank, provisionDefinitions);
|
||||
|
||||
return create<Duel>()(
|
||||
subscribeWithSelector<Duel>(() => ({
|
||||
protagonist,
|
||||
antagonist: protagonist,
|
||||
})),
|
||||
);
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user