diff --git a/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs b/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs index 908b3126e0..8f6307faa6 100644 --- a/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs +++ b/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs @@ -16,10 +16,10 @@ namespace Content.Server.Explosion.Components; public sealed class ExplosionResistanceComponent : Component { /// - /// The resistance values for this component, This fraction is added to the total resistance. + /// The explosive resistance coefficient, This fraction is multiplied into the total resistance. /// - [DataField("resistance")] - public float GlobalResistance = 0; + [DataField("damageCoefficient")] + public float DamageCoefficient = 1; /// /// Like , but specified specific to each explosion type for more customizability. diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs index a69a36002e..87513df99d 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs @@ -155,7 +155,7 @@ public sealed partial class ExplosionSystem : EntitySystem var ev = new GetExplosionResistanceEvent(explosionType.ID); RaiseLocalEvent(uid, ev, false); - damagePerIntensity += value * Math.Clamp(0, 1 - ev.Resistance, 1); + damagePerIntensity += value * Math.Max(0, ev.DamageCoefficient); } explosionTolerance[index] = (float) ((totalDamageTarget - damageable.TotalDamage) / damagePerIntensity); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs index c097c96957..adc540841c 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs @@ -362,14 +362,16 @@ public sealed partial class ExplosionSystem : EntitySystem var ev = new GetExplosionResistanceEvent(id); RaiseLocalEvent(uid, ev, false); - if (ev.Resistance == 0) + ev.DamageCoefficient = Math.Max(0, ev.DamageCoefficient); + + if (ev.DamageCoefficient == 1) { // no damage-dict multiplication required. _damageableSystem.TryChangeDamage(uid, damage, ignoreResistances: true, damageable: damageable); } - else if (ev.Resistance < 1) + else { - _damageableSystem.TryChangeDamage(uid, damage * (1 - ev.Resistance), ignoreResistances: true, damageable: damageable); + _damageableSystem.TryChangeDamage(uid, damage * ev.DamageCoefficient, ignoreResistances: true, damageable: damageable); } } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 6ed988bc84..f704191521 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -93,9 +93,9 @@ public sealed partial class ExplosionSystem : EntitySystem private void OnGetResistance(EntityUid uid, ExplosionResistanceComponent component, GetExplosionResistanceEvent args) { - args.Resistance += component.GlobalResistance; + args.DamageCoefficient *= component.DamageCoefficient; if (component.Resistances.TryGetValue(args.ExplotionPrototype, out var resistance)) - args.Resistance += resistance; + args.DamageCoefficient *= resistance; } /// diff --git a/Content.Shared/Explosion/ExplosionEvents.cs b/Content.Shared/Explosion/ExplosionEvents.cs index 24ca038894..dc7ed58dcb 100644 --- a/Content.Shared/Explosion/ExplosionEvents.cs +++ b/Content.Shared/Explosion/ExplosionEvents.cs @@ -11,10 +11,9 @@ namespace Content.Shared.Explosion; public sealed class GetExplosionResistanceEvent : EntityEventArgs, IInventoryRelayEvent { /// - /// Can be set to whatever, but currently is being additively increased by components & clothing. So think twice - /// before multiplying or directly setting this. + /// A coefficient applied to overall explosive damage. /// - public float Resistance = 0; + public float DamageCoefficient = 1; public readonly string ExplotionPrototype; diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml index 1dd7e17c70..b1dc4363bc 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml @@ -135,7 +135,7 @@ Piercing: 0.9 Heat: 0.9 - type: ExplosionResistance - resistance: 0.9 + damageCoefficient: 0.9 - type: entity parent: ClothingOuterBase @@ -155,7 +155,7 @@ Piercing: 0.4 Heat: 0.9 - type: ExplosionResistance - resistance: 0.8 + damageCoefficient: 0.8 - type: entity parent: ClothingOuterBase @@ -175,7 +175,7 @@ Piercing: 0.6 Heat: 0.5 - type: ExplosionResistance - resistance: 0.65 + damageCoefficient: 0.65 - type: entity parent: ClothingOuterBase @@ -199,4 +199,4 @@ walkModifier: 0.7 sprintModifier: 0.65 - type: ExplosionResistance - resistance: 0.5 + damageCoefficient: 0.5 diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml index 821ea2d39c..ca79a33250 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml @@ -25,7 +25,7 @@ - type: TemperatureProtection coefficient: 0.001 - type: ExplosionResistance - resistance: 0.2 + damageCoefficient: 0.2 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitAtmos @@ -54,7 +54,7 @@ Heat: 0.3 Radiation: 0.1 - type: ExplosionResistance - resistance: 0.5 + damageCoefficient: 0.5 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitCap @@ -83,7 +83,7 @@ Heat: 0.2 Radiation: 0.2 - type: ExplosionResistance - resistance: 0.7 + damageCoefficient: 0.7 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitDeathsquad @@ -112,7 +112,7 @@ Heat: 0.7 Radiation: 0.35 - type: ExplosionResistance - resistance: 0.2 + damageCoefficient: 0.2 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitEngineering @@ -141,7 +141,7 @@ Heat: 0.4 Radiation: 0.25 - type: ExplosionResistance - resistance: 0.2 + damageCoefficient: 0.2 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitEngineeringWhite @@ -251,7 +251,7 @@ walkModifier: 0.75 sprintModifier: 0.75 - type: ExplosionResistance - resistance: 0.3 + damageCoefficient: 0.3 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitRd - type: StaticPrice @@ -282,7 +282,7 @@ Heat: 0.85 Radiation: 0.5 - type: ExplosionResistance - resistance: 0.3 + damageCoefficient: 0.3 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSalvage @@ -308,7 +308,7 @@ Heat: 0.8 Radiation: 0.25 - type: ExplosionResistance - resistance: 0.4 + damageCoefficient: 0.4 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSecurity @@ -337,7 +337,7 @@ Heat: 0.8 Radiation: 0.25 - type: ExplosionResistance - resistance: 0.6 + damageCoefficient: 0.6 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSecurityRed @@ -366,7 +366,7 @@ Heat: 0.4 Radiation: 0.20 - type: ExplosionResistance - resistance: 0.5 + damageCoefficient: 0.5 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSyndie @@ -395,7 +395,7 @@ Heat: 0.25 Radiation: 0.20 - type: ExplosionResistance - resistance: 0.5 + damageCoefficient: 0.5 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitWizard @@ -424,7 +424,7 @@ Heat: 0.5 Radiation: 0.3 - type: ExplosionResistance - resistance: 0.2 + damageCoefficient: 0.2 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitLing @@ -507,7 +507,7 @@ Heat: 0.35 Radiation: 0.1 - type: ExplosionResistance - resistance: 0.8 + damageCoefficient: 0.8 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitCybersun @@ -536,7 +536,7 @@ Heat: 0.3 Radiation: 0.20 - type: ExplosionResistance - resistance: 0.5 + damageCoefficient: 0.5 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSyndieCommander @@ -567,7 +567,7 @@ Heat: 0.2 Radiation: 0.20 - type: ExplosionResistance - resistance: 0.3 + damageCoefficient: 0.3 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSyndieElite @@ -600,7 +600,7 @@ Shock: 0.1 Radiation: 0.1 - type: ExplosionResistance - resistance: 0.7 + damageCoefficient: 0.7 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetCBURN diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml index 09b1644b8a..c3a06abb50 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml @@ -16,7 +16,7 @@ Piercing: 0.9 Heat: 0.75 - type: ExplosionResistance - resistance: 0.65 # +0.25 from helmet -> 90% + damageCoefficient: 0.65 - type: entity parent: ClothingOuterEVASuitBase diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/vests.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/vests.yml index 8f71bb1606..b22a167015 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/vests.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/vests.yml @@ -16,7 +16,7 @@ Piercing: 0.5 Heat: 0.9 - type: ExplosionResistance - resistance: 0.9 + damageCoefficient: 0.9 - type: entity parent: ClothingOuterStorageBase @@ -36,7 +36,7 @@ Piercing: 0.3 Heat: 0.9 - type: ExplosionResistance - resistance: 0.9 + damageCoefficient: 0.9 - type: entity parent: ClothingOuterBase @@ -56,7 +56,7 @@ Piercing: 0.4 Heat: 0.9 - type: ExplosionResistance - resistance: 0.9 + damageCoefficient: 0.9 - type: entity parent: ClothingOuterBase @@ -76,7 +76,7 @@ Piercing: 0.75 Heat: 0.9 - type: ExplosionResistance - resistance: 0.9 + damageCoefficient: 0.9 - type: entity parent: ClothingOuterBase