Added A DebugTestMod to test if the chage was working

Make Penetration work when explosions dealing damage on characters
Removed hard-coded StructureDamage limit
This commit is contained in:
NotAlwaysTrue
2026-03-08 05:03:06 +08:00
parent 783499f152
commit bac426f509
6 changed files with 165 additions and 7 deletions
@@ -4543,12 +4543,12 @@ namespace Barotrauma
}
}
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2? attackImpulse = null, Character attacker = null, float damageMultiplier = 1f)
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2? attackImpulse = null, Character attacker = null, float damageMultiplier = 1f, float penetration = 0f)
{
return AddDamage(worldPosition, afflictions, stun, playSound, attackImpulse ?? Vector2.Zero, out _, attacker, damageMultiplier: damageMultiplier);
return AddDamage(worldPosition, afflictions, stun, playSound, attackImpulse ?? Vector2.Zero, out _, attacker, damageMultiplier: damageMultiplier,penetration: penetration);
}
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2 attackImpulse, out Limb hitLimb, Character attacker = null, float damageMultiplier = 1)
public AttackResult AddDamage(Vector2 worldPosition, IEnumerable<Affliction> afflictions, float stun, bool playSound, Vector2 attackImpulse, out Limb hitLimb, Character attacker = null, float damageMultiplier = 1f, float penetration = 0f)
{
hitLimb = null;
@@ -4565,7 +4565,7 @@ namespace Barotrauma
}
}
return DamageLimb(worldPosition, hitLimb, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier);
return DamageLimb(worldPosition, hitLimb, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier,penetration: penetration);
}
public void RecordKill(Character target)
@@ -589,7 +589,7 @@ namespace Barotrauma
//only play the damage sound on the closest limb (playing it on all just sounds like a mess)
bool playSound = PlayDamageSounds && limb == closestLimb;
AttackResult attackResult = c.AddDamage(hitPos, modifiedAfflictions, attack.Stun * distFactor, playSound: playSound, attacker: attacker, damageMultiplier: attack.DamageMultiplier * attackData.DamageMultiplier);
AttackResult attackResult = c.AddDamage(hitPos, modifiedAfflictions, attack.Stun * distFactor, playSound: playSound, attacker: attacker, damageMultiplier: attack.DamageMultiplier * attackData.DamageMultiplier,penetration: attack.Penetration * distFactor);
damages.Add(limb, attackResult.Damage);
}
}
@@ -657,7 +657,6 @@ namespace Barotrauma
bool createWallDamageProjectiles = false,
bool distanceFalloff = true)
{
float dist = 600.0f;
damagedStructures.Clear();
foreach (Structure structure in Structure.WallList)
{
@@ -665,7 +664,7 @@ namespace Barotrauma
if (structure.HasBody &&
!structure.IsPlatform &&
Vector2.Distance(structure.WorldPosition, worldPosition) < dist * 3.0f)
Vector2.Distance(structure.WorldPosition, worldPosition) < worldRange)
{
for (int i = 0; i < structure.SectionCount; i++)
{