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