mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-15 05:36:11 +01:00
feat: start of all tanks
This commit is contained in:
1 parent
53d05e73a6
commit
fcfc97b964
14 files changed
+174
-58
No files matched your search
@@ -12,6 +12,11 @@ import {
|
||||
} from "./characteristics";
|
||||
import type { TankState } from "./tankState";
|
||||
|
||||
export type ComputedCharacteristics = Record<
|
||||
CharacteristicName,
|
||||
CharacteristicOutput
|
||||
>;
|
||||
|
||||
export function computeCharacteristics(
|
||||
id: string,
|
||||
tank: TankCatalogComponent,
|
||||
@@ -23,8 +28,7 @@ export function computeCharacteristics(
|
||||
tank.upgrade_stages.slice(0, state.stage)
|
||||
);
|
||||
|
||||
const computed: Partial<Record<CharacteristicName, CharacteristicOutput>> =
|
||||
{};
|
||||
const computed: Partial<ComputedCharacteristics> = {};
|
||||
|
||||
function characteristic(name: CharacteristicName) {
|
||||
if (name in computed) return computed[name] as CharacteristicOutput;
|
||||
@@ -99,10 +103,7 @@ export function computeCharacteristics(
|
||||
}
|
||||
|
||||
return {
|
||||
characteristics: computed as Record<
|
||||
CharacteristicName,
|
||||
CharacteristicOutput
|
||||
>,
|
||||
characteristics: computed as ComputedCharacteristics,
|
||||
parameters,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { TankCatalogComponent } from "@protos/blitz_static_tank_component";
|
||||
import { TerrainHardness } from "./tankState";
|
||||
|
||||
export function createTankState(tank: TankCatalogComponent) {
|
||||
return {
|
||||
stage: tank.upgrade_stages.length,
|
||||
shell: 0,
|
||||
isGunDamaged: false,
|
||||
isHullTraversing: false,
|
||||
isShooting: false,
|
||||
isTurretTraversing: false,
|
||||
speed: 0,
|
||||
terrainHardness: TerrainHardness.Hard,
|
||||
isCaughtOnFire: false,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user