biological medicine now restricted to biological targets (#5276)

Co-authored-by: xRiriq <xRiriq.git@gmail.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
xRiriq
2021-11-23 02:15:10 -05:00
committed by GitHub
parent 6e54e740c7
commit c8acba0ba7
2 changed files with 18 additions and 1 deletions

View File

@@ -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!;
/// <remarks>
/// The supported damage types are specified using a <see cref="DamageContainerPrototype"/>s. For a
/// HealingComponent this filters what damage container type this component should work on. If null,
/// all damage container types are supported.
/// </remarks>
[DataField("damageContainer", customTypeSerializer: typeof(PrototypeIdSerializer<DamageContainerPrototype>))]
public string? DamageContainerID;
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (eventArgs.Target == null)
@@ -27,7 +37,11 @@ namespace Content.Server.Medical.Components
return false;
}
if (!eventArgs.Target.HasComponent<DamageableComponent>())
if (!eventArgs.Target.TryGetComponent<DamageableComponent>(out DamageableComponent? targetDamage))
{
return true;
}
else if (DamageContainerID is not null && !DamageContainerID.Equals(targetDamage.DamageContainerID))
{
return true;
}

View File

@@ -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