Medical items sound support + sounds (#6871)
This commit is contained in:
@@ -4,12 +4,13 @@ using Content.Server.Body.Systems;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Medical.Components;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Medical;
|
||||
|
||||
@@ -56,6 +57,11 @@ public sealed class HealingSystem : EntitySystem
|
||||
_logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(uid):target} for {healed.Total:damage} damage");
|
||||
else
|
||||
_logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed themselves for {healed.Total:damage} damage");
|
||||
|
||||
if (args.Component.HealingEndSound != null)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(uid, entityManager:EntityManager), args.Component.HealingEndSound.GetSound(), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f));
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnHealingCancelled(HealingCancelledEvent ev)
|
||||
@@ -68,7 +74,7 @@ public sealed class HealingSystem : EntitySystem
|
||||
if (args.Handled) return;
|
||||
|
||||
args.Handled = true;
|
||||
Heal(args.User, args.User, component);
|
||||
Heal(uid, args.User, args.User, component);
|
||||
}
|
||||
|
||||
private void OnHealingAfterInteract(EntityUid uid, HealingComponent component, AfterInteractEvent args)
|
||||
@@ -76,10 +82,10 @@ public sealed class HealingSystem : EntitySystem
|
||||
if (args.Handled || !args.CanReach || args.Target == null) return;
|
||||
|
||||
args.Handled = true;
|
||||
Heal(args.User, args.Target.Value, component);
|
||||
Heal(uid, args.User, args.Target.Value, component);
|
||||
}
|
||||
|
||||
private void Heal(EntityUid user, EntityUid target, HealingComponent component)
|
||||
private void Heal(EntityUid uid, EntityUid user, EntityUid target, HealingComponent component)
|
||||
{
|
||||
if (component.CancelToken != null)
|
||||
{
|
||||
@@ -105,6 +111,11 @@ public sealed class HealingSystem : EntitySystem
|
||||
|
||||
component.CancelToken = new CancellationTokenSource();
|
||||
|
||||
if (component.HealingBeginSound != null)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(uid, entityManager:EntityManager), component.HealingBeginSound.GetSound(), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f));
|
||||
}
|
||||
|
||||
_doAfter.DoAfter(new DoAfterEventArgs(user, component.Delay, component.CancelToken.Token, target)
|
||||
{
|
||||
BreakOnUserMove = true,
|
||||
|
||||
Reference in New Issue
Block a user