diff --git a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs index 0c91d213940ede..13ab8c21869de4 100644 --- a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs +++ b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs @@ -34,6 +34,9 @@ using Content.Shared.Interaction.Components; using Robust.Shared.Player; using Content.Shared.StatusEffect; +using Content.Shared.Flash.Components; +using Content.Shared.Flash; +using Robust.Shared.Audio.Systems; namespace Content.Server.Revenant.EntitySystems; @@ -51,6 +54,7 @@ public sealed partial class RevenantSystem [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly RevenantAnimatedSystem _revenantAnimated = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!; + [Dependency] private readonly SharedAudioSystem _audioSystem = default!; [ValidatePrototypeId] private const string RevenantEssenceRegen = "EssenceRegen"; @@ -238,7 +242,7 @@ private void OnHauntAction(EntityUid uid, RevenantComponent comp, RevenantHauntA args.Handled = true; // This is probably not the right way to do this... - var witnesses = new HashSet(Filter.PvsExcept(uid).RemoveWhere(player => + var witnessAndRevenantFilter = Filter.Pvs(uid).RemoveWhere(player => { if (player.AttachedEntity == null) return true; @@ -251,7 +255,22 @@ private void OnHauntAction(EntityUid uid, RevenantComponent comp, RevenantHauntA var haunted = _interact.InRangeUnobstructed((uid, Transform(uid)), (ent, Transform(ent)), range: 0, collisionMask: CollisionGroup.Impassable); Log.Debug($"{ent} haunted: {haunted}"); return !haunted; - }).Recipients.Select(ply => GetNetEntity(ply.AttachedEntity!.Value))); + }); + + var witnesses = new HashSet(witnessAndRevenantFilter.RemovePlayerByAttachedEntity(uid).Recipients.Select(ply => GetNetEntity(ply.AttachedEntity!.Value))); + + // Give the witnesses a spook! + _audioSystem.PlayGlobal(comp.HauntSound, witnessAndRevenantFilter, true); + + foreach (var witness in witnesses) + { + _statusEffects.TryAddStatusEffect(GetEntity(witness), + SharedFlashSystem.FlashedKey, + comp.HauntFlashDuration, + false + ); + } + // TODO: Maybe an eyeball icon above witnesses on the revenant's client diff --git a/Content.Shared/Revenant/Components/RevenantComponent.cs b/Content.Shared/Revenant/Components/RevenantComponent.cs index 346587bc71a7a9..d2308a4cdbceaf 100644 --- a/Content.Shared/Revenant/Components/RevenantComponent.cs +++ b/Content.Shared/Revenant/Components/RevenantComponent.cs @@ -3,6 +3,7 @@ using Content.Shared.FixedPoint; using Content.Shared.Store; using Content.Shared.Whitelist; +using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; @@ -96,18 +97,24 @@ public sealed partial class RevenantComponent : Component // essence regeneration for each crewmate that witnesses it #region Haunt Ability - [DataField("hauntDebuffs")] + [DataField("hauntDebuffs"), ViewVariables(VVAccess.ReadWrite)] public Vector2 HauntDebuffs = new(2, 6); - [DataField("hauntStolenEssencePerWitness")] + [DataField("hauntStolenEssencePerWitness"), ViewVariables(VVAccess.ReadWrite)] public FixedPoint2 HauntStolenEssencePerWitness = 2.5; - [DataField("hauntEssenceRegenPerWitness")] + [DataField("hauntEssenceRegenPerWitness"), ViewVariables(VVAccess.ReadWrite)] public FixedPoint2 HauntEssenceRegenPerWitness = 0.5; - [DataField("hauntEssenceRegenDuration")] + [DataField("hauntEssenceRegenDuration"), ViewVariables(VVAccess.ReadWrite)] public TimeSpan HauntEssenceRegenDuration = TimeSpan.FromSeconds(10); + [DataField("hauntSound"), ViewVariables(VVAccess.ReadWrite)] + public SoundSpecifier? HauntSound = new SoundCollectionSpecifier("RevenantHaunt"); + + [DataField("hauntFlashDuration"), ViewVariables(VVAccess.ReadWrite)] + public TimeSpan HauntFlashDuration = TimeSpan.FromSeconds(2); + #endregion //In the nearby radius, causes various objects to be thrown, messed with, and containers opened diff --git a/Resources/Audio/Effects/Revenant/attributions.yml b/Resources/Audio/Effects/Revenant/attributions.yml new file mode 100644 index 00000000000000..5fc32304e42ecd --- /dev/null +++ b/Resources/Audio/Effects/Revenant/attributions.yml @@ -0,0 +1,24 @@ +- files: ["haunt0.ogg"] + license: "CC-BY-SA-3.0" + copyright: "Sound originally derived from SCP: Containment breach." + source: "https://github.com/Regalis11/scpcb/blob/edb8fe0840b78f14d1aef3a0bf6174630e7be296/SFX/Horror/Horror0.ogg" + +- files: ["haunt1.ogg"] + license: "CC-BY-SA-3.0" + copyright: "Sound originally derived from SCP: Containment breach." + source: "https://github.com/Regalis11/scpcb/blob/edb8fe0840b78f14d1aef3a0bf6174630e7be296/SFX/Horror/Horror4.ogg" + +- files: ["haunt2.ogg"] + license: "CC-BY-SA-3.0" + copyright: "Sound originally derived from SCP: Containment breach." + source: "https://github.com/Regalis11/scpcb/blob/edb8fe0840b78f14d1aef3a0bf6174630e7be296/SFX/Horror/Horror6.ogg" + +- files: ["haunt3.ogg"] + license: "CC-BY-SA-3.0" + copyright: "Sound originally derived from SCP: Containment breach." + source: "https://github.com/Regalis11/scpcb/blob/edb8fe0840b78f14d1aef3a0bf6174630e7be296/SFX/Horror/Horror11.ogg" + +- files: ["haunt4.ogg"] + license: "CC-BY-SA-3.0" + copyright: "Sound originally derived from SCP: Containment breach. Edited down to a shorter length by TGRCDev." + source: "https://github.com/Regalis11/scpcb/blob/edb8fe0840b78f14d1aef3a0bf6174630e7be296/SFX/Horror/Horror12.ogg" diff --git a/Resources/Audio/Effects/Revenant/haunt0.ogg b/Resources/Audio/Effects/Revenant/haunt0.ogg new file mode 100644 index 00000000000000..13d49ad0860543 Binary files /dev/null and b/Resources/Audio/Effects/Revenant/haunt0.ogg differ diff --git a/Resources/Audio/Effects/Revenant/haunt1.ogg b/Resources/Audio/Effects/Revenant/haunt1.ogg new file mode 100644 index 00000000000000..fe22b62659418c Binary files /dev/null and b/Resources/Audio/Effects/Revenant/haunt1.ogg differ diff --git a/Resources/Audio/Effects/Revenant/haunt2.ogg b/Resources/Audio/Effects/Revenant/haunt2.ogg new file mode 100644 index 00000000000000..4fbd42d68769ed Binary files /dev/null and b/Resources/Audio/Effects/Revenant/haunt2.ogg differ diff --git a/Resources/Audio/Effects/Revenant/haunt3.ogg b/Resources/Audio/Effects/Revenant/haunt3.ogg new file mode 100644 index 00000000000000..2d182516abe38c Binary files /dev/null and b/Resources/Audio/Effects/Revenant/haunt3.ogg differ diff --git a/Resources/Audio/Effects/Revenant/haunt4.ogg b/Resources/Audio/Effects/Revenant/haunt4.ogg new file mode 100644 index 00000000000000..94859eb2a07efe Binary files /dev/null and b/Resources/Audio/Effects/Revenant/haunt4.ogg differ diff --git a/Resources/Prototypes/SoundCollections/revenant.yml b/Resources/Prototypes/SoundCollections/revenant.yml new file mode 100644 index 00000000000000..53d0f9c99d4139 --- /dev/null +++ b/Resources/Prototypes/SoundCollections/revenant.yml @@ -0,0 +1,8 @@ +- type: soundCollection + id: RevenantHaunt + files: + - /Audio/Effects/Revenant/haunt0.ogg + - /Audio/Effects/Revenant/haunt1.ogg + - /Audio/Effects/Revenant/haunt2.ogg + - /Audio/Effects/Revenant/haunt3.ogg + - /Audio/Effects/Revenant/haunt4.ogg \ No newline at end of file