diff --git a/Content.Shared/Body/Part/BodyPartComponent.cs b/Content.Shared/Body/Part/BodyPartComponent.cs index b5d2fcecee..1fc5f3bbf1 100644 --- a/Content.Shared/Body/Part/BodyPartComponent.cs +++ b/Content.Shared/Body/Part/BodyPartComponent.cs @@ -117,11 +117,11 @@ public sealed partial class BodyPartComponent : Component, ISurgeryToolComponent public string Species { get; set; } = ""; /// - /// Shitmed Change: The total damage that has to be dealt to a body part - /// to make possible severing it. + /// Shitmed Change: Any of these damage specifiers being present on the part + /// will result in it severing /// [DataField, AutoNetworkedField] - public float SeverIntegrity = 90; + public List SeverThresholds = []; /// /// Shitmed Change: The ID of the base layer for this body part. diff --git a/Content.Shared/_Shitmed/Body/Systems/SharedBodySystem.Targeting.cs b/Content.Shared/_Shitmed/Body/Systems/SharedBodySystem.Targeting.cs index fc7343ac3e..acdfb25dd7 100644 --- a/Content.Shared/_Shitmed/Body/Systems/SharedBodySystem.Targeting.cs +++ b/Content.Shared/_Shitmed/Body/Systems/SharedBodySystem.Targeting.cs @@ -34,7 +34,6 @@ public partial class SharedBodySystem [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; - private readonly ProtoId[] _severingDamageTypes = { "Slash", "Piercing", "Blunt" }; private const double IntegrityJobTime = 0.005; private readonly JobQueue _integrityJobQueue = new(IntegrityJobTime); public sealed class IntegrityJob : Job @@ -212,6 +211,19 @@ public partial class SharedBodySystem return landed; } + private bool CheckDamageThreshold(DamageSpecifier thresholds, DamageSpecifier testing) + { + foreach (var (kind, amount) in thresholds.DamageDict) + { + if (!testing.DamageDict.TryGetValue(kind, out var testAmount)) + return false; + + if (testAmount < amount) + return false; + } + return true; + } + private void OnDamageChanged(Entity partEnt, ref DamageChangedEvent args) { if (!TryComp(partEnt, out var damageable) || _timing.ApplyingState) // DeltaV: Don't try to predict limb severing @@ -227,8 +239,7 @@ public partial class SharedBodySystem && delta != null && !HasComp(partEnt) && !partEnt.Comp.Enabled - && damageable.TotalDamage >= partEnt.Comp.SeverIntegrity - && _severingDamageTypes.Any(damageType => delta.DamageDict.TryGetValue(damageType, out var value) && value > 0)) + && partEnt.Comp.SeverThresholds.Any(threshold => CheckDamageThreshold(threshold, damageable.Damage))) severed = true; CheckBodyPart(partEnt, GetTargetBodyPart(partEnt), severed, damageable); diff --git a/Resources/Prototypes/Body/Parts/base.yml b/Resources/Prototypes/Body/Parts/base.yml index e8d1066e3d..1bf4ad2032 100644 --- a/Resources/Prototypes/Body/Parts/base.yml +++ b/Resources/Prototypes/Body/Parts/base.yml @@ -78,6 +78,7 @@ - type: entity abstract: true + parent: BaseHeadDV # DeltaV - adjusted damages id: BaseHead name: "head" components: @@ -102,6 +103,7 @@ - type: entity abstract: true + parent: BaseArmDV # DeltaV - adjusted damages id: BaseLeftArm name: "left arm" components: @@ -120,6 +122,7 @@ - type: entity abstract: true + parent: BaseArmDV # DeltaV - adjusted damages id: BaseRightArm name: "right arm" components: @@ -138,6 +141,7 @@ - type: entity abstract: true + parent: BaseHandDV # DeltaV - adjusted damages id: BaseLeftHand name: "left hand" components: @@ -152,6 +156,7 @@ - type: entity abstract: true + parent: BaseHandDV # DeltaV - adjusted damages id: BaseRightHand name: "right hand" components: @@ -166,6 +171,7 @@ - type: entity abstract: true + parent: BaseLegDV # DeltaV - adjusted damages id: BaseLeftLeg name: "left leg" components: @@ -185,6 +191,7 @@ - type: entity abstract: true + parent: BaseLegDV # DeltaV - adjusted damages id: BaseRightLeg name: "right leg" components: @@ -204,6 +211,7 @@ - type: entity abstract: true + parent: BaseFootDV # DeltaV - adjusted damages id: BaseLeftFoot name: "left foot" components: @@ -218,6 +226,7 @@ - type: entity abstract: true + parent: BaseFootDV # DeltaV - adjusted damages id: BaseRightFoot name: "right foot" components: diff --git a/Resources/Prototypes/_DV/Body/Parts/base.yml b/Resources/Prototypes/_DV/Body/Parts/base.yml new file mode 100644 index 0000000000..958bf367be --- /dev/null +++ b/Resources/Prototypes/_DV/Body/Parts/base.yml @@ -0,0 +1,99 @@ +- type: entity + abstract: true + id: BaseHeadDV + components: + - type: BodyPart + severThresholds: + - types: + Piercing: 100 + - types: + Slash: 100 + - types: + Blunt: 100 + integrityThresholds: + CriticallyWounded: 90 + HeavilyWounded: 75 + ModeratelyWounded: 60 + SomewhatWounded: 40 + LightlyWounded: 20 + Healthy: 10 + +- type: entity + abstract: true + id: BaseArmDV + components: + - type: BodyPart + severThresholds: + - types: + Piercing: 90 + - types: + Slash: 55 + - types: + Blunt: 90 + integrityThresholds: + CriticallyWounded: 50 + HeavilyWounded: 40 + ModeratelyWounded: 30 + SomewhatWounded: 20 + LightlyWounded: 15 + Healthy: 10 + +- type: entity + abstract: true + id: BaseHandDV + components: + - type: BodyPart + severThresholds: + - types: + Piercing: 90 + - types: + Slash: 40 + - types: + Blunt: 90 + integrityThresholds: + CriticallyWounded: 35 + HeavilyWounded: 30 + ModeratelyWounded: 25 + SomewhatWounded: 20 + LightlyWounded: 15 + Healthy: 10 + +- type: entity + abstract: true + id: BaseLegDV + components: + - type: BodyPart + severThresholds: + - types: + Piercing: 90 + - types: + Slash: 80 + - types: + Blunt: 90 + integrityThresholds: + CriticallyWounded: 70 + HeavilyWounded: 60 + ModeratelyWounded: 50 + SomewhatWounded: 40 + LightlyWounded: 20 + Healthy: 10 + +- type: entity + abstract: true + id: BaseFootDV + components: + - type: BodyPart + severThresholds: + - types: + Piercing: 90 + - types: + Slash: 40 + - types: + Blunt: 90 + integrityThresholds: + CriticallyWounded: 35 + HeavilyWounded: 30 + ModeratelyWounded: 25 + SomewhatWounded: 20 + LightlyWounded: 15 + Healthy: 10 diff --git a/Resources/Prototypes/_Shitmed/Body/Parts/base.yml b/Resources/Prototypes/_Shitmed/Body/Parts/base.yml index 9f872f9dfd..a6e8efe215 100644 --- a/Resources/Prototypes/_Shitmed/Body/Parts/base.yml +++ b/Resources/Prototypes/_Shitmed/Body/Parts/base.yml @@ -17,7 +17,7 @@ - trigger: !type:DamageTypeTrigger damageType: Slash - damage: 60 # DeltaV - was 150 + damage: 150 behaviors: - !type:GibPartBehavior { } - trigger: