diff --git a/Content.Server/Medical/Components/HealingComponent.cs b/Content.Server/Medical/Components/HealingComponent.cs index 9b2f2fe6b0..7bb215021a 100644 --- a/Content.Server/Medical/Components/HealingComponent.cs +++ b/Content.Server/Medical/Components/HealingComponent.cs @@ -2,11 +2,13 @@ using System.Threading.Tasks; using Content.Server.Stack; using Content.Shared.ActionBlocker; using Content.Shared.Damage; +using Content.Shared.Damage.Prototypes; using Content.Shared.Interaction; using Content.Shared.Interaction.Helpers; using Content.Shared.Stacks; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.ViewVariables; namespace Content.Server.Medical.Components @@ -20,6 +22,14 @@ namespace Content.Server.Medical.Components [ViewVariables(VVAccess.ReadWrite)] public DamageSpecifier Damage = default!; + /// + /// The supported damage types are specified using a s. For a + /// HealingComponent this filters what damage container type this component should work on. If null, + /// all damage container types are supported. + /// + [DataField("damageContainer", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string? DamageContainerID; + async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (eventArgs.Target == null) @@ -27,7 +37,11 @@ namespace Content.Server.Medical.Components return false; } - if (!eventArgs.Target.HasComponent()) + if (!eventArgs.Target.TryGetComponent(out DamageableComponent? targetDamage)) + { + return true; + } + else if (DamageContainerID is not null && !DamageContainerID.Equals(targetDamage.DamageContainerID)) { return true; } diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml index dddfaf7b57..6c6abc7ca7 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml @@ -14,6 +14,7 @@ sprite: Objects/Specific/Medical/medical.rsi HeldPrefix: ointment - type: Healing + damageContainer: Biological damage: groups: Burn: -10 # 5 for each type in the group @@ -34,6 +35,7 @@ - type: Sprite state: brutepack - type: Healing + damageContainer: Biological damage: groups: Brute: -15 # 5 for each type in the group @@ -52,6 +54,7 @@ - type: Sprite state: gauze - type: Healing + damageContainer: Biological damage: types: Slash: -5