mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-19 11:53:25 +01:00
tank states
This commit is contained in:
1 parent
6c9ce58af5
commit
7d02f6311f
16 files changed
+110
-349
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { createDefaultProvisions, type TankDefinition } from "@blitzkit/core";
|
||||
import { api } from "../blitzkit/api";
|
||||
import type { EquipmentMatrix } from "../stores/duel";
|
||||
import type { TankState } from "../stores/tankopedia";
|
||||
|
||||
const models = await api.models();
|
||||
const provisions = await api.provisions();
|
||||
const scripts = await api.scripts();
|
||||
|
||||
export const genericDefaultEquipmentMatrix: EquipmentMatrix = [
|
||||
[-1, 1, -1],
|
||||
[0, 0, 0],
|
||||
[0, 0, 0],
|
||||
];
|
||||
|
||||
export function createTankState(tank: TankDefinition) {
|
||||
const turret = tank.turrets.at(-1)!;
|
||||
const gun = turret.guns.at(-1)!;
|
||||
|
||||
return {
|
||||
tank,
|
||||
model: models.models[turret.id],
|
||||
|
||||
engine: tank.engines.at(-1)!,
|
||||
turret,
|
||||
gun,
|
||||
shell: gun.shells[0],
|
||||
track: tank.tracks.at(-1)!,
|
||||
|
||||
equipment_matrix: genericDefaultEquipmentMatrix,
|
||||
|
||||
consumables: [],
|
||||
provisions: createDefaultProvisions(tank, gun, provisions, scripts),
|
||||
camouflage: true,
|
||||
cooldown_booster: 0,
|
||||
assault_distance: (gun.assault_ranges?.ranges[0].distance ?? 0) / 2,
|
||||
} satisfies TankState;
|
||||
}
|
||||
Reference in new issue
Block a user