1 Commits

Author SHA1 Message Date
NotAlwaysTrue
bac426f509 Added A DebugTestMod to test if the chage was working
Make Penetration work when explosions dealing damage on characters
Removed hard-coded StructureDamage limit
2026-03-08 05:03:06 +08:00
6 changed files with 165 additions and 7 deletions

View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Items>
<Item name="[DebugOnlyTest]EXPLOSIONTESTSUIT" identifier="EXPLOSIONTESTSUIT" category="Diving,Equipment" tags="diving,deepdiving,human,respawnsuit" scale="0.5" fireproof="true" description="" allowdroppingonswapwith="diving" impactsoundtag="impact_metal_heavy" botpriority="3" cargocontaineridentifier="">
<Deconstruct time="1"/>
<InventoryIcon texture="Content/Items/InventoryIconAtlas2.png" sourcerect="0,832,128,128" origin="0.5,0.5" />
<Sprite name="Respawn Diving Suit Item" texture="Content/Items/Diving/RespawnSuit_Items.png" sourcerect="0,0,157,121" depth="0.55" origin="0.5,0.5" />
<ContainedSprite name="Respawn Diving Suit In Vertical Locker" allowedcontainertags="divingsuitcontainervertical" texture="Content/Items/Diving/RespawnSuit_Items.png" sourcerect="181,0,70,192" depth="0.55" origin="0.5,0.5" />
<ContainedSprite name="Respawn Diving Suit Behind Window" allowedcontainertags="divingsuitcontainerwindow" texture="Content/Items/Containers/containers.png" sourcerect="118,379,77,214" depth="0.55" origin="-0.12,-0.13" />
<ContainedSprite name="Respawn Diving Suit In Horizontal Locker" allowedcontainertags="divingsuitcontainerhorizontal" texture="Content/Items/Diving/RespawnSuit_Items.png" sourcerect="0,193,230,63" depth="0.55" origin="0.6,0.5" />
<Body radius="45" width="34" density="20" />
<Wearable slots="OuterClothes" msg="ItemMsgEquipSelect" displaycontainedstatus="true" canbeselected="false" canbepicked="true" pickkey="Select">
<sprite texture="Content/Items/Jobgear/headgears.png" limb="Head" inheritlimbdepth="true" inheritscale="true" ignorelimbscale="true" scale="0.65" hidelimb="false" alphaclipotherwearables="true" sourcerect="100,409,103,103" origin="0.5,0.5"/>
<sprite texture="RespawnSuit.png" limb="Torso" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightHand" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftHand" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightArm" depthlimb="RightForearm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftArm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightForearm" depthlimb="RightArm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftForearm" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="Waist" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightThigh" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftThigh" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightLeg" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftLeg" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="LeftFoot" sound="footstep_armor_heavy" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<sprite texture="RespawnSuit.png" limb="RightFoot" sound="footstep_armor_heavy" hidelimb="true" inherittexturescale="true" hideotherwearables="true" inheritorigin="true" inheritsourcerect="true" />
<damagemodifier armorsector="0.0,360.0" afflictionidentifiers="explosiondamage" damagemultiplier="0" damagesound="LimbArmor" deflectprojectiles="true" />
</Wearable>
<Holdable slots="RightHand+LeftHand" controlpose="true" holdpos="0,-50" handle1="-10,-20" handle2="10,-20" holdangle="45" msg="ItemMsgPickUpUse" canbeselected="false" canbepicked="true" pickkey="Use" />
<aitarget maxsightrange="1500" />
</Item>
<Item name="[DebugOnlyTest]C4WithoutPen" identifier="testC40pen" category="Weapon" Tags="smallitem,explosive,demolitionsexpert" maxstacksize="32" maxstacksizecharacterinventory="8" Scale="0.5" cargocontaineridentifier="explosivecrate" impactsoundtag="impact_soft">
<Upgrade gameversion="0.9.3.0" scale="0.5"/>
<PreferredContainer primary="secarmcab" minamount="1" maxamount="2" spawnprobability="0.5" notcampaign="true" notpvp="true"/>
<PreferredContainer secondary="wreckarmcab,abandonedarmcab,piratearmcab" amount="1" spawnprobability="0.05"/>
<PreferredContainer secondary="armcab"/>
<Price baseprice="160">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.4"/>
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="2" sold="false"/>
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25"/>
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="3" />
<Price storeidentifier="merchantmine" sold="false" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="3" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="20">
<RequiredSkill identifier="weapons" level="70" />
<RequiredItem identifier="uex" />
<RequiredItem identifier="plastic" />
</Fabricate>
<InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="768,64,64,64" origin="0.5,0.5" />
<Sprite texture="Content/Items/Weapons/weapons_new.png" depth="0.55" sourcerect="51,478,48,33" origin="0.5,0.5" />
<Body width="45" height="30" density="20" />
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" canbecombined="true" removeoncombined="true" throwforce="3.5" aimpos="35,-10" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnUse" target="This" Condition="-100.0" disabledeltatime="true"/>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="8000" />
<Explosion range="750.0" ballastfloradamage="150" structuredamage="0" itemdamage="1000" force="20" severlimbsprobability="2" debris="true" decal="explosion" decalsize="0.75">
<Affliction identifier="explosiondamage" strength="250" />
</Explosion>
<Remove />
</StatusEffect>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionDebris5.ogg" range="6000" />
</StatusEffect>
</Throwable>
<Quality>
<QualityStat stattype="ExplosionRadius" value="0.1"/>
<QualityStat stattype="ExplosionDamage" value="0.1"/>
</Quality>
</Item>
<Item name="[DebugOnlyTest]C4WithPen" identifier="testC41pen" category="Weapon" Tags="smallitem,explosive,demolitionsexpert" maxstacksize="32" maxstacksizecharacterinventory="8" Scale="0.5" cargocontaineridentifier="explosivecrate" impactsoundtag="impact_soft">
<Upgrade gameversion="0.9.3.0" scale="0.5"/>
<PreferredContainer primary="secarmcab" minamount="1" maxamount="2" spawnprobability="0.5" notcampaign="true" notpvp="true"/>
<PreferredContainer secondary="wreckarmcab,abandonedarmcab,piratearmcab" amount="1" spawnprobability="0.05"/>
<PreferredContainer secondary="armcab"/>
<Price baseprice="160">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.4"/>
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="2" sold="false"/>
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25"/>
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="3" />
<Price storeidentifier="merchantmine" sold="false" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="3" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="20">
<RequiredSkill identifier="weapons" level="70" />
<RequiredItem identifier="uex" />
<RequiredItem identifier="plastic" />
</Fabricate>
<InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="768,64,64,64" origin="0.5,0.5" />
<Sprite texture="Content/Items/Weapons/weapons_new.png" depth="0.55" sourcerect="51,478,48,33" origin="0.5,0.5" />
<Body width="45" height="30" density="20" />
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" canbecombined="true" removeoncombined="true" throwforce="3.5" aimpos="35,-10" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnUse" target="This" Condition="-100.0" disabledeltatime="true"/>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="8000" />
<Explosion range="750.0" ballastfloradamage="150" structuredamage="0" itemdamage="1000" force="20" severlimbsprobability="2" debris="true" decal="explosion" decalsize="0.75" penetration="1">
<Affliction identifier="explosiondamage" strength="250" />
</Explosion>
<Remove />
</StatusEffect>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionDebris5.ogg" range="6000" />
</StatusEffect>
</Throwable>
<Quality>
<QualityStat stattype="ExplosionRadius" value="0.1"/>
<QualityStat stattype="ExplosionDamage" value="0.1"/>
</Quality>
</Item>
<Item name="[DebugOnlyTest]C4With2000range" identifier="testC42000" category="Weapon" Tags="smallitem,explosive,demolitionsexpert" maxstacksize="32" maxstacksizecharacterinventory="8" Scale="0.5" cargocontaineridentifier="explosivecrate" impactsoundtag="impact_soft">
<Upgrade gameversion="0.9.3.0" scale="0.5"/>
<PreferredContainer primary="secarmcab" minamount="1" maxamount="2" spawnprobability="0.5" notcampaign="true" notpvp="true"/>
<PreferredContainer secondary="wreckarmcab,abandonedarmcab,piratearmcab" amount="1" spawnprobability="0.05"/>
<PreferredContainer secondary="armcab"/>
<Price baseprice="160">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.4"/>
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="2" sold="false"/>
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25"/>
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="3" />
<Price storeidentifier="merchantmine" sold="false" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="3" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="20">
<RequiredSkill identifier="weapons" level="70" />
<RequiredItem identifier="uex" />
<RequiredItem identifier="plastic" />
</Fabricate>
<InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="768,64,64,64" origin="0.5,0.5" />
<Sprite texture="Content/Items/Weapons/weapons_new.png" depth="0.55" sourcerect="51,478,48,33" origin="0.5,0.5" />
<Body width="45" height="30" density="20" />
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" canbecombined="true" removeoncombined="true" throwforce="3.5" aimpos="35,-10" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnUse" target="This" Condition="-100.0" disabledeltatime="true"/>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="8000" />
<sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="8000" />
<Explosion range="5000.0" ballastfloradamage="150" structuredamage="1000" itemdamage="1000" force="20" IgnoreCover="true" DistanceFalloff="false" severlimbsprobability="2" debris="true" decal="explosion" decalsize="0.75">
</Explosion>
<Remove />
</StatusEffect>
<StatusEffect type="OnBroken" target="This">
<sound file="Content/Items/Weapons/ExplosionDebris5.ogg" range="6000" />
</StatusEffect>
</Throwable>
<Quality>
<QualityStat stattype="ExplosionRadius" value="0.1"/>
<QualityStat stattype="ExplosionDamage" value="0.1"/>
</Quality>
</Item>
</Items>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="Explosion Test" modversion="1.0.1" corepackage="False" gameversion="1.11.5.0">
<Item file="%ModDir%/Items.xml" />
<Submarine file="%ModDir%/TestCamel.sub" />
</contentpackage>

View File

@@ -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; 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) public void RecordKill(Character target)

View File

@@ -589,7 +589,7 @@ namespace Barotrauma
//only play the damage sound on the closest limb (playing it on all just sounds like a mess) //only play the damage sound on the closest limb (playing it on all just sounds like a mess)
bool playSound = PlayDamageSounds && limb == closestLimb; 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); damages.Add(limb, attackResult.Damage);
} }
} }
@@ -657,7 +657,6 @@ namespace Barotrauma
bool createWallDamageProjectiles = false, bool createWallDamageProjectiles = false,
bool distanceFalloff = true) bool distanceFalloff = true)
{ {
float dist = 600.0f;
damagedStructures.Clear(); damagedStructures.Clear();
foreach (Structure structure in Structure.WallList) foreach (Structure structure in Structure.WallList)
{ {
@@ -665,7 +664,7 @@ namespace Barotrauma
if (structure.HasBody && if (structure.HasBody &&
!structure.IsPlatform && !structure.IsPlatform &&
Vector2.Distance(structure.WorldPosition, worldPosition) < dist * 3.0f) Vector2.Distance(structure.WorldPosition, worldPosition) < worldRange)
{ {
for (int i = 0; i < structure.SectionCount; i++) for (int i = 0; i < structure.SectionCount; i++)
{ {