forked from space-wizards/space-station-14
-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #293 from TGRCdev/revenant-haunt
Added the revenant Haunt action
- Loading branch information
Showing
19 changed files
with
289 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Numerics; | ||
using Content.Client.Alerts; | ||
using Content.Shared.Revenant; | ||
using Content.Shared.Revenant.Components; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Player; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Utility; | ||
using Timer = Robust.Shared.Timing.Timer; | ||
|
||
namespace Content.Client.Revenant; | ||
|
||
public sealed class RevenantRegenModifierSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SpriteSystem _sprite = default!; | ||
|
||
private readonly SpriteSpecifier _witnessIndicator = new SpriteSpecifier.Texture(new ResPath("Interface/Actions/scream.png")); | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<RevenantRegenModifierComponent, UpdateAlertSpriteEvent>(OnUpdateAlert); | ||
SubscribeNetworkEvent<RevenantHauntWitnessEvent>(OnWitnesses); | ||
} | ||
|
||
private void OnWitnesses(RevenantHauntWitnessEvent args) | ||
{ | ||
foreach (var witness in args.Witnesses) | ||
{ | ||
var ent = GetEntity(witness); | ||
if (TryComp<SpriteComponent>(ent, out var sprite)) | ||
{ | ||
var layerID = sprite.AddLayer(_witnessIndicator); | ||
if (sprite.TryGetLayer(layerID, out var layer)) | ||
{ | ||
layer.Offset = new Vector2(0, 0.8f); | ||
layer.Scale = new Vector2(0.65f, 0.65f); | ||
} | ||
Timer.Spawn(TimeSpan.FromSeconds(5), () => sprite.RemoveLayer(layerID)); | ||
} | ||
} | ||
} | ||
|
||
private void OnUpdateAlert(Entity<RevenantRegenModifierComponent> ent, ref UpdateAlertSpriteEvent args) | ||
{ | ||
if (args.Alert.ID != ent.Comp.Alert) | ||
return; | ||
|
||
var sprite = args.SpriteViewEnt.Comp; | ||
var witnesses = Math.Clamp(ent.Comp.Witnesses.Count, 0, 99); | ||
sprite.LayerSetState(RevenantVisualLayers.Digit1, $"{witnesses / 10}"); | ||
sprite.LayerSetState(RevenantVisualLayers.Digit2, $"{witnesses % 10}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Content.Shared/Revenant/Components/RevenantRegenModifierComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Content.Shared.Alert; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Shared.Revenant.Components; | ||
|
||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] | ||
public sealed partial class RevenantRegenModifierComponent : Component | ||
{ | ||
[ViewVariables, AutoNetworkedField] | ||
public HashSet<NetEntity> Witnesses; | ||
|
||
[DataField] | ||
public ProtoId<AlertPrototype> Alert = "EssenceRegen"; | ||
|
||
public RevenantRegenModifierComponent(HashSet<NetEntity> witnesses) | ||
{ | ||
Witnesses = witnesses; | ||
} | ||
|
||
public RevenantRegenModifierComponent() : this(new()) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.