mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: more data
This commit is contained in:
1 parent
de52b525fb
commit
2b37e08f19
5 files changed
+96
-31
No files matched your search
@@ -65,9 +65,15 @@ interface EngineDefinitionsList {
|
||||
userString: string;
|
||||
level: number;
|
||||
fireStartingChance: number;
|
||||
weight: number;
|
||||
power: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
export interface ChassisDefinitionsList {
|
||||
nextAvailableId: number;
|
||||
ids: Record<string, number>;
|
||||
}
|
||||
type VehicleDefinitionArmor = Record<
|
||||
string,
|
||||
number | { vehicleDamageFactor: 0; '#text': number }
|
||||
@@ -90,9 +96,12 @@ interface VehicleDefinitions {
|
||||
turretPositions: { turret: string };
|
||||
turretInitialRotation?: { yaw: 0; pitch: 6.5; roll: 0 };
|
||||
maxHealth: number;
|
||||
weight: number;
|
||||
};
|
||||
chassis: {
|
||||
[key: string]: {
|
||||
weight: number;
|
||||
terrainResistance: string;
|
||||
rotationSpeed: number;
|
||||
shotDispersionFactors: {
|
||||
vehicleMovement: number;
|
||||
@@ -123,6 +132,7 @@ interface VehicleDefinitions {
|
||||
turrets0: {
|
||||
[key: string]: {
|
||||
rotationSpeed: number;
|
||||
weight: number;
|
||||
circularVisionRadius: number;
|
||||
maxHealth: number;
|
||||
armor: VehicleDefinitionArmor;
|
||||
@@ -196,6 +206,7 @@ interface GunDefinitionsList {
|
||||
shared: {
|
||||
[key: string]: {
|
||||
rotationSpeed: number;
|
||||
weight: number;
|
||||
shotDispersionFactors: {
|
||||
turretRotation: number;
|
||||
afterShot: number;
|
||||
@@ -357,6 +368,11 @@ export async function definitions(production: boolean) {
|
||||
}>(
|
||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/components/engines.xml.dvpl`,
|
||||
);
|
||||
const chassisList = await readXMLDVPL<{
|
||||
root: ChassisDefinitionsList;
|
||||
}>(
|
||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/components/chassis.xml.dvpl`,
|
||||
);
|
||||
|
||||
for (const tankKey in tankList.root) {
|
||||
const tank = tankList.root[tankKey];
|
||||
@@ -370,19 +386,12 @@ export async function definitions(production: boolean) {
|
||||
const tankParameters = await readYAMLDVPL<TankParameters>(
|
||||
`${DATA}/${POI.tankParameters}/${nation}/${tankKey}.yaml.dvpl`,
|
||||
);
|
||||
const defaultChassis = Object.values(tankDefinition.root.chassis).at(
|
||||
-1,
|
||||
)!;
|
||||
const turretOrigin = tankDefinition.root.hull.turretPositions.turret
|
||||
.split(' ')
|
||||
.map(Number) as Vector3Tuple;
|
||||
const hullOrigin = defaultChassis.hullPosition
|
||||
.split(' ')
|
||||
.map(Number) as Vector3Tuple;
|
||||
const tankId = toUniqueId(nation, tank.id);
|
||||
const tankTags = tank.tags.split(' ');
|
||||
const hullArmor: ModelArmor = { thickness: {} };
|
||||
const trackArmorRaw = defaultChassis.armor.leftTrack;
|
||||
const equipment = tankDefinition.root.optDevicePreset;
|
||||
tankStringIdMap[`${nation}:${tankKey}`] = tankId;
|
||||
|
||||
@@ -408,12 +417,13 @@ export async function definitions(production: boolean) {
|
||||
});
|
||||
|
||||
tankDefinitions[tankId] = {
|
||||
id: tankId,
|
||||
weight: tankDefinition.root.hull.weight,
|
||||
health: tankDefinition.root.hull.maxHealth,
|
||||
speed: {
|
||||
forwards: tankDefinition.root.speedLimits.forward,
|
||||
backwards: tankDefinition.root.speedLimits.backward,
|
||||
},
|
||||
id: tankId,
|
||||
equipment,
|
||||
consumables: tankDefinition.root.consumableSlots,
|
||||
provisions: tankDefinition.root.provisionSlots,
|
||||
@@ -439,11 +449,7 @@ export async function definitions(production: boolean) {
|
||||
},
|
||||
turrets: [],
|
||||
engines: [],
|
||||
dispersion: {
|
||||
move: defaultChassis.shotDispersionFactors.vehicleMovement,
|
||||
traverse: defaultChassis.shotDispersionFactors.vehicleRotation,
|
||||
},
|
||||
traverseSpeed: defaultChassis.rotationSpeed,
|
||||
tracks: [],
|
||||
};
|
||||
|
||||
if (tankDefinitions[tankId].name === tankDefinitions[tankId].nameFull) {
|
||||
@@ -452,12 +458,7 @@ export async function definitions(production: boolean) {
|
||||
|
||||
modelDefinitions[tankId] = {
|
||||
armor: hullArmor,
|
||||
trackThickness:
|
||||
typeof trackArmorRaw === 'number'
|
||||
? trackArmorRaw
|
||||
: trackArmorRaw['#text'],
|
||||
turretOrigin,
|
||||
hullOrigin,
|
||||
turretRotation: tankDefinition.root.hull.turretInitialRotation
|
||||
? {
|
||||
yaw: tankDefinition.root.hull.turretInitialRotation.yaw,
|
||||
@@ -467,8 +468,44 @@ export async function definitions(production: boolean) {
|
||||
: undefined,
|
||||
boundingBox: tankParameters.collision.hull.bbox,
|
||||
turrets: {},
|
||||
tracks: {},
|
||||
};
|
||||
|
||||
Object.keys(tankDefinition.root.chassis).forEach((key) => {
|
||||
const track = tankDefinition.root.chassis[key];
|
||||
const trackId = toUniqueId(nation, chassisList.root.ids[key]);
|
||||
const terrainResistances = track.terrainResistance
|
||||
.split(' ')
|
||||
.map(Number);
|
||||
const trackArmorRaw = track.armor.leftTrack;
|
||||
const hullOrigin = track.hullPosition
|
||||
.split(' ')
|
||||
.map(Number) as Vector3Tuple;
|
||||
|
||||
tankDefinitions[tankId].tracks.push({
|
||||
id: trackId,
|
||||
weight: track.weight,
|
||||
traverseSpeed: track.rotationSpeed,
|
||||
dispersion: {
|
||||
move: track.shotDispersionFactors.vehicleMovement,
|
||||
traverse: track.shotDispersionFactors.vehicleRotation,
|
||||
},
|
||||
resistance: {
|
||||
hard: terrainResistances[0],
|
||||
medium: terrainResistances[1],
|
||||
soft: terrainResistances[2],
|
||||
},
|
||||
});
|
||||
|
||||
modelDefinitions[tankId].tracks[trackId] = {
|
||||
thickness:
|
||||
typeof trackArmorRaw === 'number'
|
||||
? trackArmorRaw
|
||||
: trackArmorRaw['#text'],
|
||||
origin: hullOrigin,
|
||||
};
|
||||
});
|
||||
|
||||
Object.keys(tankDefinition.root.engines).forEach((engineKey) => {
|
||||
const engine = enginesList.root.shared[engineKey];
|
||||
const engineId = toUniqueId(nation, enginesList.root.ids[engineKey]);
|
||||
@@ -476,8 +513,10 @@ export async function definitions(production: boolean) {
|
||||
tankDefinitions[tankId].engines.push({
|
||||
id: engineId,
|
||||
name: strings[engine.userString],
|
||||
fire_chance: engine.fireStartingChance,
|
||||
fireChance: engine.fireStartingChance,
|
||||
tier: engine.level as Tier,
|
||||
weight: engine.weight,
|
||||
power: engine.power,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -526,8 +565,8 @@ export async function definitions(production: boolean) {
|
||||
});
|
||||
|
||||
tankDefinitions[tankId].turrets.push({
|
||||
traverseSpeed: turret.rotationSpeed,
|
||||
id: turretId,
|
||||
traverseSpeed: turret.rotationSpeed,
|
||||
name:
|
||||
strings[turret.userString] ??
|
||||
turretKey
|
||||
@@ -537,6 +576,7 @@ export async function definitions(production: boolean) {
|
||||
guns: [],
|
||||
health: turret.maxHealth,
|
||||
viewRange: turret.circularVisionRadius,
|
||||
weight: turret.weight,
|
||||
});
|
||||
|
||||
modelDefinitions[tankId].turrets[turretId] = {
|
||||
@@ -624,6 +664,7 @@ export async function definitions(production: boolean) {
|
||||
|
||||
tankDefinitions[tankId].turrets[turretIndex].guns.push({
|
||||
id: gunId,
|
||||
weight: gunListEntry.weight,
|
||||
rotationSpeed: gunListEntry.rotationSpeed,
|
||||
name: gunName,
|
||||
tier: gunListEntry.level as Tier,
|
||||
|
||||
@@ -13,7 +13,9 @@ import { Info } from './components/Info';
|
||||
|
||||
export function Characteristics() {
|
||||
const awaitedModelDefinitions = use(modelDefinitions);
|
||||
const { tank, turret, gun, engine } = useDuel((state) => state.protagonist!);
|
||||
const { tank, turret, gun, engine, track } = useDuel(
|
||||
(state) => state.protagonist!,
|
||||
);
|
||||
const shell = gun.shells[0];
|
||||
const tankModelDefinition = awaitedModelDefinitions[tank.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
@@ -24,6 +26,8 @@ export function Characteristics() {
|
||||
turretModelDefinition.boundingBox,
|
||||
),
|
||||
);
|
||||
const weight =
|
||||
tank.weight + engine.weight + track.weight + turret.weight + gun.weight;
|
||||
|
||||
let dpm: number;
|
||||
|
||||
@@ -50,7 +54,7 @@ export function Characteristics() {
|
||||
{tank.health + turret.health}
|
||||
</Info>
|
||||
<Info name="Fire chance" unit="%">
|
||||
{Math.round(engine.fire_chance * 100)}
|
||||
{Math.round(engine.fireChance * 100)}
|
||||
</Info>
|
||||
<Info name="View range" unit="m">
|
||||
{turret.viewRange}
|
||||
@@ -175,12 +179,12 @@ export function Characteristics() {
|
||||
{gun.dispersion.base.toFixed(3)}
|
||||
</Info>
|
||||
<Info indent name="Moving" unit="s">
|
||||
+ {tank.dispersion.move.toFixed(3)}
|
||||
+ {track.dispersion.move.toFixed(3)}
|
||||
</Info>
|
||||
<Info indent name="Hull traversing" unit="s">
|
||||
+ {tank.dispersion.traverse.toFixed(3)}
|
||||
<Info indent name="Hull traversing" unit="°">
|
||||
+ {track.dispersion.traverse.toFixed(3)}
|
||||
</Info>
|
||||
<Info indent name="Turret traversing" unit="s">
|
||||
<Info indent name="Turret traversing" unit="°">
|
||||
+ {gun.dispersion.traverse.toFixed(3)}
|
||||
</Info>
|
||||
<Info indent name="After shooting" unit="m">
|
||||
@@ -243,7 +247,7 @@ export function Characteristics() {
|
||||
TODO
|
||||
</Info>
|
||||
<Info name="Weight" unit="mt">
|
||||
TODO
|
||||
{(weight / 1000).toFixed(1)}
|
||||
</Info>
|
||||
<Info name="Traverse speed" unit="°/s" />
|
||||
<Info indent name="On hard terrain">
|
||||
|
||||
@@ -15,13 +15,16 @@ export interface BoundingBox {
|
||||
}
|
||||
interface ModelDefinition {
|
||||
armor: ModelArmor;
|
||||
trackThickness: number;
|
||||
turretOrigin: Vector3Tuple;
|
||||
hullOrigin: Vector3Tuple;
|
||||
turretRotation?: InitialTurretRotation;
|
||||
turrets: Record<number, TurretModelDefinition>;
|
||||
tracks: Record<number, TrackDefinition>;
|
||||
boundingBox: BoundingBox;
|
||||
}
|
||||
interface TrackDefinition {
|
||||
thickness: number;
|
||||
origin: Vector3Tuple;
|
||||
}
|
||||
export interface InitialTurretRotation {
|
||||
yaw: number;
|
||||
pitch: number;
|
||||
|
||||
@@ -28,6 +28,7 @@ export interface TankDefinition {
|
||||
testing?: boolean;
|
||||
turrets: TurretDefinition[];
|
||||
engines: EngineDefinition[];
|
||||
tracks: TrackDefinition[];
|
||||
price: TankDefinitionPrice;
|
||||
speed: {
|
||||
forwards: number;
|
||||
@@ -38,18 +39,30 @@ export interface TankDefinition {
|
||||
moving: number;
|
||||
onFire: number;
|
||||
};
|
||||
equipment: string;
|
||||
weight: number;
|
||||
}
|
||||
export interface TrackDefinition {
|
||||
id: number;
|
||||
weight: number;
|
||||
traverseSpeed: number;
|
||||
dispersion: {
|
||||
move: number;
|
||||
traverse: number;
|
||||
};
|
||||
equipment: string;
|
||||
resistance: {
|
||||
hard: number;
|
||||
medium: number;
|
||||
soft: number;
|
||||
};
|
||||
}
|
||||
export interface EngineDefinition {
|
||||
id: number;
|
||||
name: string;
|
||||
tier: Tier;
|
||||
fire_chance: number;
|
||||
fireChance: number;
|
||||
power: number;
|
||||
weight: number;
|
||||
}
|
||||
export type TankDefinitionPrice =
|
||||
| { type: 'credits'; value: number }
|
||||
@@ -62,6 +75,7 @@ export interface TurretDefinition {
|
||||
name: string;
|
||||
tier: Tier;
|
||||
guns: GunDefinition[];
|
||||
weight: number;
|
||||
}
|
||||
export type GunDefinition =
|
||||
| GunDefinitionRegular
|
||||
@@ -69,6 +83,7 @@ export type GunDefinition =
|
||||
| GunDefinitionAutoReloader;
|
||||
interface GunDefinitionBase {
|
||||
rotationSpeed: number;
|
||||
weight: number;
|
||||
id: number;
|
||||
name: string;
|
||||
tier: Tier;
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
ShellDefinition,
|
||||
TankDefinition,
|
||||
Tier,
|
||||
TrackDefinition,
|
||||
TurretDefinition,
|
||||
} from '../core/blitzkrieg/tankDefinitions';
|
||||
|
||||
@@ -24,6 +25,7 @@ export interface DuelMember {
|
||||
turret: TurretDefinition;
|
||||
gun: GunDefinition;
|
||||
shell: ShellDefinition;
|
||||
track: TrackDefinition;
|
||||
}
|
||||
interface TankopediaPersistent {
|
||||
model: {
|
||||
|
||||
Reference in new issue
Block a user