Skip to content

Commit

Permalink
Update HushedSystem.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vonsant authored Jan 1, 2025
1 parent f078dca commit 0cb636d
Showing 1 changed file with 28 additions and 30 deletions.
58 changes: 28 additions & 30 deletions Content.Server/_CorvaxNext/Speech/EntitySystems/HushedSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,42 @@
using Content.Shared.Actions;
using Robust.Shared.Player;

namespace Content.Server._CorvaxNext.Speech.EntitySystems
namespace Content.Server._CorvaxNext.Speech.EntitySystems;

public sealed class HushedSystem : EntitySystem
{
public sealed class HushedSystem : EntitySystem
{
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;

public override void Initialize()
{
SubscribeLocalEvent<HushedComponent, ScreamActionEvent>(OnScreamAction, [typeof(VocalSystem)]);
SubscribeLocalEvent<HushedComponent, EmoteEvent>(OnEmote, before: [typeof(VocalSystem)]);
}
public override void Initialize()
{
SubscribeLocalEvent<HushedComponent, ScreamActionEvent>(OnScreamAction, new[] { typeof(VocalSystem) });
SubscribeLocalEvent<HushedComponent, EmoteEvent>(OnEmote, before: new[] { typeof(VocalSystem) });
}

private void OnScreamAction(EntityUid uid, HushedComponent component, ScreamActionEvent args)
{
if (args.Handled)
return;
private void OnScreamAction(EntityUid uid, HushedComponent component, ScreamActionEvent args)
{
if (args.Handled)
return;

if (HasComp<MutedComponent>(uid))
return;
if (HasComp<MutedComponent>(uid))
return;

_popupSystem.PopupEntity(Loc.GetString("speech-hushed-scream-blocked"), uid, uid);
args.Handled = true;
}
_popupSystem.PopupEntity(Loc.GetString("speech-hushed-scream-blocked"), uid, uid);
args.Handled = true;
}

private void OnEmote(EntityUid uid, HushedComponent component, ref EmoteEvent args)
{
if (args.Handled)
return;
private void OnEmote(EntityUid uid, HushedComponent component, ref EmoteEvent args)
{
if (args.Handled)
return;

if (HasComp<MutedComponent>(uid))
return;
if (HasComp<MutedComponent>(uid))
return;

if (args.Emote.Category.HasFlag(EmoteCategory.Vocal))
{
_popupSystem.PopupEntity(Loc.GetString("speech-hushed-vocal-emote-blocked"), uid, uid);
if (!args.Emote.Category.HasFlag(EmoteCategory.Vocal))
return;

args.Handled = true;
}
}
_popupSystem.PopupEntity(Loc.GetString("speech-hushed-vocal-emote-blocked"), uid, uid);
args.Handled = true;
}
}

0 comments on commit 0cb636d

Please sign in to comment.