From 3d7e7e8320f25996f8f0bfc81e949a934b4aa989 Mon Sep 17 00:00:00 2001
From: lzk <124214523+lzk228@users.noreply.github.com>
Date: Mon, 17 Feb 2025 22:59:33 +0100
Subject: [PATCH] Make AllowedEmotes bypass whitelists and fix syndiborg
ability to laugh (#31510)
---
.../Chat/Systems/ChatSystem.Emote.cs | 21 +++++++++++++++----
.../Mobs/Cyborgs/base_borg_chassis.yml | 2 ++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/Content.Server/Chat/Systems/ChatSystem.Emote.cs b/Content.Server/Chat/Systems/ChatSystem.Emote.cs
index fddf453ff0..707a0e0dc5 100644
--- a/Content.Server/Chat/Systems/ChatSystem.Emote.cs
+++ b/Content.Server/Chat/Systems/ChatSystem.Emote.cs
@@ -196,17 +196,30 @@ public partial class ChatSystem
///
private bool AllowedToUseEmote(EntityUid source, EmotePrototype emote)
{
- if ((_whitelistSystem.IsWhitelistFail(emote.Whitelist, source) || _whitelistSystem.IsBlacklistPass(emote.Blacklist, source)))
+ // If emote is in AllowedEmotes, it will bypass whitelist and blacklist
+ if (TryComp(source, out var speech) &&
+ speech.AllowedEmotes.Contains(emote.ID))
+ {
+ return true;
+ }
+
+ // Check the whitelist and blacklist
+ if (_whitelistSystem.IsWhitelistFail(emote.Whitelist, source) ||
+ _whitelistSystem.IsBlacklistPass(emote.Blacklist, source))
+ {
return false;
+ }
- if (!emote.Available &&
- TryComp(source, out var speech) &&
- !speech.AllowedEmotes.Contains(emote.ID))
+ // Check if the emote is available for all
+ if (!emote.Available)
+ {
return false;
+ }
return true;
}
+
private void InvokeEmoteEvent(EntityUid uid, EmotePrototype proto)
{
var ev = new EmoteEvent(proto);
diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml
index fdc6574c94..85ef048096 100644
--- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml
+++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml
@@ -324,6 +324,8 @@
- type: MovementAlwaysTouching
- type: Speech
speechSounds: SyndieBorg
+ allowedEmotes:
+ - Laugh
- type: Vocal
sounds:
Unsexed: UnisexSiliconSyndicate
--
2.51.2