Skip to content

Commit

Permalink
feat: Import ammunition falloff data
Browse files Browse the repository at this point in the history
  • Loading branch information
octfx committed Mar 10, 2024
1 parent 5ef26b3 commit 97984d5
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Loader/ItemBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,26 @@ StandardisedAmmunition BuildAmmunitionInfo(EntityClassDefinition item)
Size = ammo.size,
ImpactDamage = ConvertDamage(impactDamage),
DetonationDamage = ConvertDamage(detonationDamage),
Capacity = item.Components.SAmmoContainerComponentParams?.maxAmmoCount ?? item.Components.SAmmoContainerComponentParams?.maxRestockCount
Capacity = item.Components.SAmmoContainerComponentParams?.maxAmmoCount ?? item.Components.SAmmoContainerComponentParams?.maxRestockCount,
BulletImpulseFalloff = new StandardisedBulletImpulseFalloff{
MinDistance = projectiles?.impulseFalloffParams?.BulletImpulseFalloffParams?.minDistance,
DropFalloff = projectiles?.impulseFalloffParams?.BulletImpulseFalloffParams?.dropFalloff,
MaxFalloff = projectiles?.impulseFalloffParams?.BulletImpulseFalloffParams?.maxFalloff,
},
BulletPierceability = new StandardisedBulletPierceability{
DamageFalloffLevel1 = projectiles?.pierceabilityParams?.damageFalloffLevel1,
DamageFalloffLevel2 = projectiles?.pierceabilityParams?.damageFalloffLevel2,
DamageFalloffLevel3 = projectiles?.pierceabilityParams?.damageFalloffLevel3,
MaxPenetrationThickness = projectiles?.pierceabilityParams?.maxPenetrationThickness,
},
BulletElectron = new StandardisedBulletElectron{
JumpRange = projectiles?.electronParams?.BulletElectronParams?.jumpRange,
MaximumJumps = projectiles?.electronParams?.BulletElectronParams?.maximumJumps,
ResidualChargeMultiplier = projectiles?.electronParams?.BulletElectronParams?.residualChargeMultiplier,
},
DamageDropMinDistance = ConvertDamage(Damage.FromDamageInfo(projectiles?.damageDropParams?.BulletDamageDropParams?.damageDropMinDistance?.DamageInfo ?? new DamageInfo())),
DamageDropPerMeter = ConvertDamage(Damage.FromDamageInfo(projectiles?.damageDropParams?.BulletDamageDropParams?.damageDropPerMeter?.DamageInfo ?? new DamageInfo())),
DamageDropMinDamage = ConvertDamage(Damage.FromDamageInfo(projectiles?.damageDropParams?.BulletDamageDropParams?.damageDropMinDamage?.DamageInfo ?? new DamageInfo())),
};
}

Expand Down
7 changes: 7 additions & 0 deletions Loader/Json/StandardisedAmmunition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@ public class StandardisedAmmunition
public double? Capacity { get; set; }
public StandardisedDamage ImpactDamage { get; set; }
public StandardisedDamage DetonationDamage { get; set; }
public StandardisedBulletImpulseFalloff BulletImpulseFalloff { get; set; }
public StandardisedBulletPierceability BulletPierceability { get; set; }
public StandardisedBulletElectron BulletElectron { get; set; }

public StandardisedDamage DamageDropMinDistance { get; set; }
public StandardisedDamage DamageDropPerMeter { get; set; }
public StandardisedDamage DamageDropMinDamage { get; set; }
}
}
9 changes: 9 additions & 0 deletions Loader/Json/StandardisedBulletElectron.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Loader
{
public class StandardisedBulletElectron
{
public double? ResidualChargeMultiplier { get; set; }
public double? MaximumJumps { get; set; }
public double? JumpRange { get; set; }
}
}
9 changes: 9 additions & 0 deletions Loader/Json/StandardisedBulletImpulseFalloff.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Loader
{
public class StandardisedBulletImpulseFalloff
{
public double? MinDistance { get; set; }
public double? DropFalloff { get; set; }
public double? MaxFalloff { get; set; }
}
}
10 changes: 10 additions & 0 deletions Loader/Json/StandardisedBulletPierceability.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Loader
{
public class StandardisedBulletPierceability
{
public double? DamageFalloffLevel1 { get; set; }
public double? DamageFalloffLevel2 { get; set; }
public double? DamageFalloffLevel3 { get; set; }
public double? MaxPenetrationThickness { get; set; }
}
}
86 changes: 86 additions & 0 deletions Loader/scdb.Xml/Entities/BulletProjectileParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,62 @@ namespace scdb.Xml.Entities
{
public class BulletProjectileParams
{
[XmlAttribute] public double impactRadius;
[XmlAttribute] public double minImpactRadius;
[XmlAttribute] public double ignitionChanceOverride;
[XmlAttribute] public double keepAliveOnZeroDamage;
[XmlAttribute] public string hitType;

public DamageInfo[] damage;
public DamageDropParams damageDropParams;
public DetonationParams detonationParams;
public ImpulseFalloffParams impulseFalloffParams;
public PierceabilityParams pierceabilityParams;
public ElectronParams electronParams;
}

public class DetonationParams
{
public ProjectileDetonationParams ProjectileDetonationParams;
}

public class ImpulseFalloffParams
{
public BulletImpulseFalloffParams BulletImpulseFalloffParams;
}

public class ElectronParams
{
public BulletElectronParams BulletElectronParams;
}

public class DamageDropParams
{
public BulletDamageDropParams BulletDamageDropParams;
}

public class BulletDamageDropParams
{
public DamageDropMinDistance damageDropMinDistance;
public DamageDropPerMeter damageDropPerMeter;
public DamageDropMinDamage damageDropMinDamage;
}

public class DamageDropMinDistance
{
public DamageInfo DamageInfo;
}

public class DamageDropPerMeter
{
public DamageInfo DamageInfo;
}

public class DamageDropMinDamage
{
public DamageInfo DamageInfo;
}

public class ProjectileDetonationParams
{
[XmlAttribute]
Expand All @@ -38,4 +85,43 @@ public class ProjectileDetonationParams

public ExplosionParams explosionParams;
}

public class BulletImpulseFalloffParams
{
[XmlAttribute]
public double minDistance;

[XmlAttribute]
public double dropFalloff;

[XmlAttribute]
public double maxFalloff;
}

public class PierceabilityParams
{
[XmlAttribute]
public double damageFalloffLevel1;

[XmlAttribute]
public double damageFalloffLevel2;

[XmlAttribute]
public double damageFalloffLevel3;

[XmlAttribute]
public double maxPenetrationThickness;
}

public class BulletElectronParams
{
[XmlAttribute]
public double residualChargeMultiplier;

[XmlAttribute]
public double maximumJumps;

[XmlAttribute]
public double jumpRange;
}
}

0 comments on commit 97984d5

Please sign in to comment.