Trim punctuation marks in the chat emote system (#28612)
Co-authored-by: geraeumig <alfenos@proton.me>
This commit is contained in:
@@ -161,14 +161,32 @@ public partial class ChatSystem
|
|||||||
/// <param name="textInput"></param>
|
/// <param name="textInput"></param>
|
||||||
private void TryEmoteChatInput(EntityUid uid, string textInput)
|
private void TryEmoteChatInput(EntityUid uid, string textInput)
|
||||||
{
|
{
|
||||||
var actionLower = textInput.ToLower();
|
var actionTrimmedLower = TrimPunctuation(textInput.ToLower());
|
||||||
if (!_wordEmoteDict.TryGetValue(actionLower, out var emote))
|
if (!_wordEmoteDict.TryGetValue(actionTrimmedLower, out var emote))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!AllowedToUseEmote(uid, emote))
|
if (!AllowedToUseEmote(uid, emote))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InvokeEmoteEvent(uid, emote);
|
InvokeEmoteEvent(uid, emote);
|
||||||
|
return;
|
||||||
|
|
||||||
|
static string TrimPunctuation(string textInput)
|
||||||
|
{
|
||||||
|
var trimEnd = textInput.Length;
|
||||||
|
while (trimEnd > 0 && char.IsPunctuation(textInput[trimEnd - 1]))
|
||||||
|
{
|
||||||
|
trimEnd--;
|
||||||
|
}
|
||||||
|
|
||||||
|
var trimStart = 0;
|
||||||
|
while (trimStart < trimEnd && char.IsPunctuation(textInput[trimStart]))
|
||||||
|
{
|
||||||
|
trimStart++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return textInput[trimStart..trimEnd];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if we can use this emote based on the emotes whitelist, blacklist, and availibility to the entity.
|
/// Checks if we can use this emote based on the emotes whitelist, blacklist, and availibility to the entity.
|
||||||
|
|||||||
@@ -14,26 +14,18 @@
|
|||||||
chatTriggers:
|
chatTriggers:
|
||||||
- scream
|
- scream
|
||||||
- screams
|
- screams
|
||||||
- screams.
|
|
||||||
- screams!
|
|
||||||
- screaming
|
- screaming
|
||||||
- screamed
|
- screamed
|
||||||
- shriek
|
- shriek
|
||||||
- shrieks
|
- shrieks
|
||||||
- shrieks.
|
|
||||||
- shrieks!
|
|
||||||
- shrieking
|
- shrieking
|
||||||
- shrieked
|
- shrieked
|
||||||
- screech
|
- screech
|
||||||
- screeches
|
- screeches
|
||||||
- screeches.
|
|
||||||
- screeches!
|
|
||||||
- screeching
|
- screeching
|
||||||
- screeched
|
- screeched
|
||||||
- yell
|
- yell
|
||||||
- yells
|
- yells
|
||||||
- yells.
|
|
||||||
- yells!
|
|
||||||
- yelled
|
- yelled
|
||||||
- yelling
|
- yelling
|
||||||
|
|
||||||
@@ -52,31 +44,19 @@
|
|||||||
chatTriggers:
|
chatTriggers:
|
||||||
- laugh
|
- laugh
|
||||||
- laughs
|
- laughs
|
||||||
- laughs.
|
|
||||||
- laughs!
|
|
||||||
- laughing
|
- laughing
|
||||||
- laughed
|
- laughed
|
||||||
- chuckle
|
- chuckle
|
||||||
- chuckles
|
- chuckles
|
||||||
- chuckles.
|
|
||||||
- chuckles!
|
|
||||||
- chuckled
|
- chuckled
|
||||||
- chuckling
|
- chuckling
|
||||||
- giggle
|
- giggle
|
||||||
- giggles
|
- giggles
|
||||||
- giggles.
|
|
||||||
- giggles!
|
|
||||||
- giggling
|
- giggling
|
||||||
- giggled
|
- giggled
|
||||||
- chortle
|
- chortle
|
||||||
- chortle.
|
|
||||||
- chortle!
|
|
||||||
- chortles
|
- chortles
|
||||||
- chortles.
|
|
||||||
- chortles!
|
|
||||||
- chortling
|
- chortling
|
||||||
- chortling.
|
|
||||||
- chortling!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Honk
|
id: Honk
|
||||||
@@ -91,17 +71,9 @@
|
|||||||
chatMessages: ["chat-emote-msg-honk"]
|
chatMessages: ["chat-emote-msg-honk"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- honk
|
- honk
|
||||||
- honk.
|
|
||||||
- honk!
|
|
||||||
- honks
|
- honks
|
||||||
- honks.
|
|
||||||
- honks!
|
|
||||||
- honked
|
- honked
|
||||||
- honked.
|
|
||||||
- honked!
|
|
||||||
- honking
|
- honking
|
||||||
- honking.
|
|
||||||
- honking!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Sigh
|
id: Sigh
|
||||||
@@ -119,9 +91,6 @@
|
|||||||
- sigh
|
- sigh
|
||||||
- sighs
|
- sighs
|
||||||
- sighed
|
- sighed
|
||||||
- sigh.
|
|
||||||
- sighs.
|
|
||||||
- sighed.
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Whistle
|
id: Whistle
|
||||||
@@ -137,14 +106,8 @@
|
|||||||
chatMessages: ["chat-emote-msg-whistle"]
|
chatMessages: ["chat-emote-msg-whistle"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- whistle
|
- whistle
|
||||||
- whistle.
|
|
||||||
- whistle!
|
|
||||||
- whistles
|
- whistles
|
||||||
- whistles.
|
|
||||||
- whistles!
|
|
||||||
- whistleblowing
|
- whistleblowing
|
||||||
- whistleblowing.
|
|
||||||
- whistleblowing!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Crying
|
id: Crying
|
||||||
@@ -160,22 +123,11 @@
|
|||||||
chatMessages: ["chat-emote-msg-crying"]
|
chatMessages: ["chat-emote-msg-crying"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- cry
|
- cry
|
||||||
- cry.
|
|
||||||
- cry!
|
|
||||||
- crying
|
- crying
|
||||||
- crying.
|
|
||||||
- crying!
|
|
||||||
- cries
|
- cries
|
||||||
- cries.
|
|
||||||
- cries!
|
|
||||||
- sob
|
- sob
|
||||||
- sob.
|
|
||||||
- sobs
|
- sobs
|
||||||
- sobs.
|
|
||||||
- sobs!
|
|
||||||
- sobbing
|
- sobbing
|
||||||
- sobbing.
|
|
||||||
- sobbing!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Squish
|
id: Squish
|
||||||
@@ -192,14 +144,8 @@
|
|||||||
chatMessages: ["chat-emote-msg-squish"]
|
chatMessages: ["chat-emote-msg-squish"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- squish
|
- squish
|
||||||
- squish.
|
|
||||||
- squish!
|
|
||||||
- squishing
|
- squishing
|
||||||
- squishing.
|
|
||||||
- squishing!
|
|
||||||
- squishes
|
- squishes
|
||||||
- squishes.
|
|
||||||
- squishes!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Chitter
|
id: Chitter
|
||||||
@@ -216,14 +162,8 @@
|
|||||||
chatMessages: ["chat-emote-msg-chitter"]
|
chatMessages: ["chat-emote-msg-chitter"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- chitter
|
- chitter
|
||||||
- chitter.
|
|
||||||
- chitter!
|
|
||||||
- chitters
|
- chitters
|
||||||
- chitters.
|
|
||||||
- chitters!
|
|
||||||
- chittered
|
- chittered
|
||||||
- chittered.
|
|
||||||
- chittered!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Squeak
|
id: Squeak
|
||||||
@@ -240,14 +180,8 @@
|
|||||||
chatMessages: ["chat-emote-msg-squeak"]
|
chatMessages: ["chat-emote-msg-squeak"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- squeak
|
- squeak
|
||||||
- squeak.
|
|
||||||
- squeak!
|
|
||||||
- squeaks
|
- squeaks
|
||||||
- squeaks.
|
|
||||||
- squeaks!
|
|
||||||
- squeaked
|
- squeaked
|
||||||
- squeaked.
|
|
||||||
- squeaked!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Click
|
id: Click
|
||||||
@@ -264,11 +198,7 @@
|
|||||||
chatMessages: ["chat-emote-msg-click"]
|
chatMessages: ["chat-emote-msg-click"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- click
|
- click
|
||||||
- click.
|
|
||||||
- click!
|
|
||||||
- clicks
|
- clicks
|
||||||
- clicks.
|
|
||||||
- clicks!
|
|
||||||
|
|
||||||
# hand emotes
|
# hand emotes
|
||||||
- type: emote
|
- type: emote
|
||||||
@@ -286,8 +216,6 @@
|
|||||||
chatTriggers:
|
chatTriggers:
|
||||||
- clap
|
- clap
|
||||||
- claps
|
- claps
|
||||||
- claps.
|
|
||||||
- claps!
|
|
||||||
- clapping
|
- clapping
|
||||||
- clapped
|
- clapped
|
||||||
|
|
||||||
@@ -310,11 +238,7 @@
|
|||||||
- snapped
|
- snapped
|
||||||
- snap fingers
|
- snap fingers
|
||||||
- snaps fingers
|
- snaps fingers
|
||||||
- snaps fingers.
|
|
||||||
- snaps fingers!
|
|
||||||
- snaps their fingers
|
- snaps their fingers
|
||||||
- snaps their fingers.
|
|
||||||
- snaps their fingers!
|
|
||||||
- snapping fingers
|
- snapping fingers
|
||||||
- snapped fingers
|
- snapped fingers
|
||||||
|
|
||||||
@@ -332,11 +256,7 @@
|
|||||||
chatMessages: ["chat-emote-msg-salute"]
|
chatMessages: ["chat-emote-msg-salute"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- salute
|
- salute
|
||||||
- salute.
|
|
||||||
- salute!
|
|
||||||
- salutes
|
- salutes
|
||||||
- salutes.
|
|
||||||
- salutes!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Gasp
|
id: Gasp
|
||||||
@@ -347,14 +267,8 @@
|
|||||||
chatMessages: ["chat-emote-msg-gasp"]
|
chatMessages: ["chat-emote-msg-gasp"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- gasp
|
- gasp
|
||||||
- gasp.
|
|
||||||
- gasp!
|
|
||||||
- gasps
|
- gasps
|
||||||
- gasps.
|
|
||||||
- gasps!
|
|
||||||
- gasped
|
- gasped
|
||||||
- gasped.
|
|
||||||
- gasped!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: DefaultDeathgasp
|
id: DefaultDeathgasp
|
||||||
@@ -386,17 +300,9 @@
|
|||||||
chatMessages: ["chat-emote-msg-buzz"]
|
chatMessages: ["chat-emote-msg-buzz"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- buzzing
|
- buzzing
|
||||||
- buzzing!
|
|
||||||
- buzzing.
|
|
||||||
- buzz
|
- buzz
|
||||||
- buzz.
|
|
||||||
- buzz!
|
|
||||||
- buzzed
|
- buzzed
|
||||||
- buzzed.
|
|
||||||
- buzzed!
|
|
||||||
- buzzes
|
- buzzes
|
||||||
- buzzes.
|
|
||||||
- buzzes!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Weh
|
id: Weh
|
||||||
@@ -417,17 +323,9 @@
|
|||||||
chatMessages: ["chat-emote-msg-chirp"]
|
chatMessages: ["chat-emote-msg-chirp"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- chirp
|
- chirp
|
||||||
- chirp!
|
|
||||||
- chirp.
|
|
||||||
- chirps
|
- chirps
|
||||||
- churps.
|
|
||||||
- chirps!
|
|
||||||
- chirped
|
- chirped
|
||||||
- chirped.
|
|
||||||
- chirped!
|
|
||||||
- chirping
|
- chirping
|
||||||
- chirping.
|
|
||||||
- chirping!
|
|
||||||
|
|
||||||
# Machine Emotes
|
# Machine Emotes
|
||||||
- type: emote
|
- type: emote
|
||||||
@@ -443,17 +341,9 @@
|
|||||||
chatMessages: ["chat-emote-msg-beep"]
|
chatMessages: ["chat-emote-msg-beep"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- beep
|
- beep
|
||||||
- beep!
|
|
||||||
- beep.
|
|
||||||
- beeps
|
- beeps
|
||||||
- beeps.
|
|
||||||
- beeps!
|
|
||||||
- beeped
|
- beeped
|
||||||
- beeped.
|
|
||||||
- beeped!
|
|
||||||
- beeping
|
- beeping
|
||||||
- beeping.
|
|
||||||
- beeping!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Chime
|
id: Chime
|
||||||
@@ -468,17 +358,9 @@
|
|||||||
chatMessages: ["chat-emote-msg-chime"]
|
chatMessages: ["chat-emote-msg-chime"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- chime
|
- chime
|
||||||
- chime.
|
|
||||||
- chime!
|
|
||||||
- chimes
|
- chimes
|
||||||
- chimes.
|
|
||||||
- chimes!
|
|
||||||
- chimed
|
- chimed
|
||||||
- chimed.
|
|
||||||
- chimed!
|
|
||||||
- chiming
|
- chiming
|
||||||
- chiming,
|
|
||||||
- chiming!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Buzz-Two
|
id: Buzz-Two
|
||||||
@@ -493,35 +375,15 @@
|
|||||||
chatMessages: ["chat-emote-msg-buzzestwo"]
|
chatMessages: ["chat-emote-msg-buzzestwo"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- buzztwice
|
- buzztwice
|
||||||
- buzztwice.
|
|
||||||
- buzztwice!
|
|
||||||
- buzzstwice
|
- buzzstwice
|
||||||
- buzzstwice.
|
|
||||||
- buzzstwice!
|
|
||||||
- buzzestwice
|
- buzzestwice
|
||||||
- buzzestwice.
|
|
||||||
- buzzestwice!
|
|
||||||
- buzzingtwice
|
- buzzingtwice
|
||||||
- buzzingtwice.
|
|
||||||
- buzzingtwice!
|
|
||||||
- buzzedtwice
|
- buzzedtwice
|
||||||
- buzzedtwice.
|
|
||||||
- buzzedtwice!
|
|
||||||
- buzz twice
|
- buzz twice
|
||||||
- buzz twice.
|
|
||||||
- buzz twice!
|
|
||||||
- buzzs twice
|
- buzzs twice
|
||||||
- buzzs twice.
|
|
||||||
- buzzs twice!
|
|
||||||
- buzzes twice
|
- buzzes twice
|
||||||
- buzzes twice.
|
|
||||||
- buzzes twice!
|
|
||||||
- buzzing twice
|
- buzzing twice
|
||||||
- buzzing twice.
|
|
||||||
- buzzing twice!
|
|
||||||
- buzzed twice
|
- buzzed twice
|
||||||
- buzzed twice.
|
|
||||||
- buzzed twice!
|
|
||||||
|
|
||||||
- type: emote
|
- type: emote
|
||||||
id: Ping
|
id: Ping
|
||||||
@@ -536,14 +398,6 @@
|
|||||||
chatMessages: ["chat-emote-msg-ping"]
|
chatMessages: ["chat-emote-msg-ping"]
|
||||||
chatTriggers:
|
chatTriggers:
|
||||||
- ping
|
- ping
|
||||||
- ping.
|
|
||||||
- ping!
|
|
||||||
- pings
|
- pings
|
||||||
- pings.
|
|
||||||
- pings!
|
|
||||||
- pinged
|
- pinged
|
||||||
- pinged.
|
|
||||||
- pinged!
|
|
||||||
- pinging
|
- pinging
|
||||||
- pinging.
|
|
||||||
- pinging!
|
|
||||||
|
|||||||
Reference in New Issue
Block a user