mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: external module thickness
This commit is contained in:
1 parent
c76fc97922
commit
ae267adf27
2 files changed
+43
-1
No files matched your search
@@ -54,6 +54,26 @@ interface VehicleDefinitions {
|
|||||||
turretPositions: { turret: string };
|
turretPositions: { turret: string };
|
||||||
turretInitialRotation?: { yaw: 0; pitch: 6.5; roll: 0 };
|
turretInitialRotation?: { yaw: 0; pitch: 6.5; roll: 0 };
|
||||||
};
|
};
|
||||||
|
chassis: {
|
||||||
|
[key: string]: {
|
||||||
|
armor: {
|
||||||
|
leftTrack:
|
||||||
|
| number
|
||||||
|
| {
|
||||||
|
chanceToHitByProjectile: number;
|
||||||
|
chanceToHitByExplosion: number;
|
||||||
|
'#text': number;
|
||||||
|
};
|
||||||
|
rightTrack:
|
||||||
|
| number
|
||||||
|
| {
|
||||||
|
chanceToHitByProjectile: number;
|
||||||
|
chanceToHitByExplosion: number;
|
||||||
|
'#text': number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
turrets0: {
|
turrets0: {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
armor: VehicleDefinitionArmor;
|
armor: VehicleDefinitionArmor;
|
||||||
@@ -64,7 +84,15 @@ interface VehicleDefinitions {
|
|||||||
models: { undamaged: string };
|
models: { undamaged: string };
|
||||||
guns: {
|
guns: {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
armor: VehicleDefinitionArmor;
|
armor: VehicleDefinitionArmor & {
|
||||||
|
gun?:
|
||||||
|
| number
|
||||||
|
| {
|
||||||
|
chanceToHitByProjectile: number;
|
||||||
|
chanceToHitByExplosion: number;
|
||||||
|
'#text': number;
|
||||||
|
};
|
||||||
|
};
|
||||||
reloadTime: number;
|
reloadTime: number;
|
||||||
maxAmmo: number;
|
maxAmmo: number;
|
||||||
extraPitchLimits?: {
|
extraPitchLimits?: {
|
||||||
@@ -185,6 +213,8 @@ export async function buildDefinitions() {
|
|||||||
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 = Object.values(tankDefinition.root.chassis).at(-1)!
|
||||||
|
.armor.leftTrack;
|
||||||
|
|
||||||
Object.keys(tankDefinition.root.hull.armor)
|
Object.keys(tankDefinition.root.hull.armor)
|
||||||
.filter((name) => name.startsWith('armor_'))
|
.filter((name) => name.startsWith('armor_'))
|
||||||
@@ -235,6 +265,10 @@ export async function buildDefinitions() {
|
|||||||
|
|
||||||
modelDefinitions[tankId] = {
|
modelDefinitions[tankId] = {
|
||||||
armor: hullArmor,
|
armor: hullArmor,
|
||||||
|
trackThickness:
|
||||||
|
typeof trackArmorRaw === 'number'
|
||||||
|
? trackArmorRaw
|
||||||
|
: trackArmorRaw['#text'],
|
||||||
turretOrigin,
|
turretOrigin,
|
||||||
turretRotation: tankDefinition.root.hull.turretInitialRotation
|
turretRotation: tankDefinition.root.hull.turretInitialRotation
|
||||||
? {
|
? {
|
||||||
@@ -391,6 +425,12 @@ export async function buildDefinitions() {
|
|||||||
modelDefinitions[tankId].turrets[turretId].guns[gunId] = {
|
modelDefinitions[tankId].turrets[turretId].guns[gunId] = {
|
||||||
armor: gunArmor,
|
armor: gunArmor,
|
||||||
model: gunModel,
|
model: gunModel,
|
||||||
|
barrelThickness:
|
||||||
|
turretGunEntry.armor.gun === undefined
|
||||||
|
? 0
|
||||||
|
: typeof turretGunEntry.armor.gun === 'number'
|
||||||
|
? turretGunEntry.armor.gun
|
||||||
|
: turretGunEntry.armor.gun['#text'],
|
||||||
pitch: {
|
pitch: {
|
||||||
min: gunPitch[0],
|
min: gunPitch[0],
|
||||||
max: gunPitch[1],
|
max: gunPitch[1],
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export interface ModelArmor {
|
|||||||
|
|
||||||
interface ModelDefinition {
|
interface ModelDefinition {
|
||||||
armor: ModelArmor;
|
armor: ModelArmor;
|
||||||
|
trackThickness: number;
|
||||||
turretOrigin: Vector3Tuple;
|
turretOrigin: Vector3Tuple;
|
||||||
turretRotation?: InitialTurretRotation;
|
turretRotation?: InitialTurretRotation;
|
||||||
turrets: Record<number, TurretModelDefinition>;
|
turrets: Record<number, TurretModelDefinition>;
|
||||||
@@ -32,6 +33,7 @@ export interface YawLimits {
|
|||||||
}
|
}
|
||||||
interface GunModelDefinition {
|
interface GunModelDefinition {
|
||||||
armor: ModelArmor;
|
armor: ModelArmor;
|
||||||
|
barrelThickness: number;
|
||||||
model: number;
|
model: number;
|
||||||
pitch: PitchLimits;
|
pitch: PitchLimits;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user