-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component for clothes to suppress emotes and scream action in general, and the muzzle to suppress vocal emotes in particular #32588
base: master
Are you sure you want to change the base?
Changes from all commits
7fb3ef4
a5d3a2a
91d01a4
38e0d78
e71926f
dbacf23
0a814e2
2c00a20
63192a9
528c3ec
34565c4
d3879a3
062b613
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Content.Shared.Chat.Prototypes; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Speech.Components; | ||
|
||
/// <summary> | ||
/// Suppresses emotes with the given categories or ID. | ||
/// Additionally, if the Scream Emote would be blocked, also blocks the Scream Action. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class EmoteBlockerComponent : Component | ||
{ | ||
/// <summary> | ||
/// Which categories of emotes are blocked by this component. | ||
/// </summary> | ||
[ViewVariables(VVAccess.ReadWrite)] | ||
[DataField] | ||
public HashSet<EmoteCategory> BlocksCategories = []; | ||
|
||
/// <summary> | ||
/// IDs of which specific emotes are blocked by this component. | ||
/// </summary> | ||
[ViewVariables(VVAccess.ReadWrite)] | ||
[DataField] | ||
public HashSet<ProtoId<EmotePrototype>> BlocksEmotes = []; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Content.Server.Speech.Components; | ||
using Content.Shared.Emoting; | ||
using Content.Shared.Inventory; | ||
|
||
namespace Content.Server.Speech; | ||
|
||
public sealed class EmoteBlockerSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<EmoteBlockerComponent, BeforeEmoteEvent>(OnEmoteEvent); | ||
SubscribeLocalEvent<EmoteBlockerComponent, InventoryRelayedEvent<BeforeEmoteEvent>>(OnRelayedEmoteEvent); | ||
} | ||
|
||
private void OnRelayedEmoteEvent(EntityUid uid, EmoteBlockerComponent component, InventoryRelayedEvent<BeforeEmoteEvent> args) | ||
{ | ||
OnEmoteEvent(uid, component, ref args.Args); | ||
} | ||
|
||
private void OnEmoteEvent(EntityUid uid, EmoteBlockerComponent component, ref BeforeEmoteEvent args) | ||
{ | ||
if (component.BlocksEmotes.Contains(args.Emote)) | ||
{ | ||
args.Cancel(); | ||
args.Blocker = uid; | ||
return; | ||
} | ||
|
||
foreach (var blockedCat in component.BlocksCategories) | ||
{ | ||
if (blockedCat == args.Emote.Category) | ||
{ | ||
args.Cancel(); | ||
args.Blocker = uid; | ||
return; | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Content.Shared.Chat.Prototypes; | ||
using Content.Shared.Inventory; | ||
|
||
namespace Content.Shared.Emoting; | ||
|
||
public sealed class EmoteAttemptEvent : CancellableEntityEventArgs | ||
{ | ||
public EmoteAttemptEvent(EntityUid uid) | ||
{ | ||
Uid = uid; | ||
} | ||
|
||
public EntityUid Uid { get; } | ||
} | ||
|
||
/// <summary> | ||
/// An event raised just before an emote is performed, providing systems with an opportunity to cancel the emote's performance. | ||
/// </summary> | ||
[ByRefEvent] | ||
public sealed class BeforeEmoteEvent : CancellableEntityEventArgs, IInventoryRelayEvent | ||
{ | ||
public readonly EntityUid Source; | ||
public readonly EmotePrototype Emote; | ||
|
||
/// <summary> | ||
/// The equipment that is blocking emoting. Should only be non-null if the event was canceled. | ||
/// </summary> | ||
public EntityUid? Blocker = null; | ||
|
||
public BeforeEmoteEvent(EntityUid source, EmotePrototype emote) | ||
{ | ||
Source = source; | ||
Emote = emote; | ||
} | ||
|
||
public SlotFlags TargetSlots => SlotFlags.All; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ chat-emote-name-laugh = Laugh | |
chat-emote-name-honk = Honk | ||
chat-emote-name-sigh = Sigh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fully agree but I think we are supposed to do cleanup like this in a separate PR (Unless its necessary for your PR to work) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with making another PR, but in this case, it's kiiiiinda "for it to work" in that it makes the grammar correct in this popup: Without it, the localized string There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah then it makes sense for it to be here I think 👍 |
||
chat-emote-name-whistle = Whistle | ||
chat-emote-name-crying = Crying | ||
chat-emote-name-crying = Cry | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed this while testing -- nearly all of the other emotes are in the infinitive tense rather than the gerund like |
||
chat-emote-name-squish = Squish | ||
chat-emote-name-chitter = Chitter | ||
chat-emote-name-squeak = Squeak | ||
|
@@ -25,8 +25,8 @@ chat-emote-name-ping = Ping | |
chat-emote-name-sneeze = Sneeze | ||
chat-emote-name-cough = Cough | ||
chat-emote-name-catmeow = Cat Meow | ||
chat-emote-name-cathisses = Cat Hisses | ||
chat-emote-name-monkeyscreeches = Monkey Screeches | ||
chat-emote-name-cathisses = Cat Hiss | ||
chat-emote-name-monkeyscreeches = Monkey Screech | ||
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as |
||
chat-emote-name-robotbeep = Robot | ||
chat-emote-name-yawn = Yawn | ||
chat-emote-name-snore = Snore | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
chat-system-emote-cancelled-generic = You can't {$emote} right now! | ||
chat-system-emote-cancelled-blocked = You can't {$emote} because of {THE($blocker)}! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,6 +321,9 @@ | |
- type: AddAccentClothing | ||
accent: ReplacementAccent | ||
replacement: mumble | ||
- type: EmoteBlocker | ||
blocksCategories: | ||
- Vocal | ||
Comment on lines
+324
to
+326
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Muzzles block all vocal emotes. |
||
- type: Construction | ||
graph: Muzzle | ||
node: muzzle | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to
EmoteEvents.cs