Skip to content
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

Remove Ending Punctuation From Emote Detection #561

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Content.Server/Chat/Systems/ChatSystem.Emote.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Frozen;
using System.Linq;
using Content.Shared.Chat.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
Expand All @@ -9,6 +10,7 @@ namespace Content.Server.Chat.Systems;
public partial class ChatSystem
{
private FrozenDictionary<string, EmotePrototype> _wordEmoteDict = FrozenDictionary<string, EmotePrototype>.Empty;
private IReadOnlyList<string> Punctuation { get; } = new List<string> { ",", ".", "!", "?", "-", "~", "'", "\"", };
DEATHB4DEFEAT marked this conversation as resolved.
Show resolved Hide resolved

protected override void OnPrototypeReload(PrototypesReloadedEventArgs obj)
{
Expand Down Expand Up @@ -150,6 +152,10 @@ public bool TryPlayEmoteSound(EntityUid uid, EmoteSoundsPrototype? proto, string
private void TryEmoteChatInput(EntityUid uid, string textInput)
{
var actionLower = textInput.ToLower();
// Replace ending punctuation with nothing
if (Punctuation.Any(punctuation => actionLower.EndsWith(punctuation)))
actionLower = actionLower.Remove(actionLower.Length - 1);

if (!_wordEmoteDict.TryGetValue(actionLower, out var emote))
return;
DEATHB4DEFEAT marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
154 changes: 10 additions & 144 deletions Resources/Prototypes/DeltaV/Voice/speech_emotes.yml
Original file line number Diff line number Diff line change
@@ -1,198 +1,64 @@
- type: emote
id: HarpyRing
category: Vocal
chatMessages: [rings.]
chatMessages: [ rings ]
chatTriggers:
- ring
- ring.
- ring!
- ring?
- rings
- rings.
- rings!
- rings?
- ringing
- ringing.
- ringing!
- ringing?
- ringed
- ringed.
- ringed!
- ringed?
- rang
- rang.
- rang!
- rang?
VMSolidus marked this conversation as resolved.
Show resolved Hide resolved

- type: emote
id: HarpyPew
category: Vocal
chatMessages: [pews.]
chatMessages: [ pews ]
chatTriggers:
- pew
- pew.
- pew!
- pew?
- pews
- pews.
- pews!
- pews?
- pewpew
- pewpew.
- pewpew!
- pewpew?
- pewpews

- type: emote
id: HarpyBang
category: Vocal
chatMessages: [bangs.]
chatMessages: [ bangs ]
chatTriggers:
- bang
- bang.
- bang!
- bang?
- bangs
- bangs.
- bangs!
- bangs?
- banging
- banging.
- banging!
- banging?
- banged
- banged.
- banged!
- banged?

- type: emote
id: HarpyRev
category: Vocal
chatMessages: [revs.]
chatMessages: [ revs ]
chatTriggers:
- rev
- rev.
- rev!
- rev?
- revs
- revs.
- revs!
- revs?
- revving
- revving.
- revving!
- revving?
- revved
- revved.
- revved!
- revved?

- type: emote
id: HarpyCaw
category: Vocal
chatMessages: [caws.]
chatMessages: [ caws ]
chatTriggers:
- caw
- caw.
- caw!
- caw?
- caws
- caws.
- caws!
- caws?
- cawing
- cawing.
- cawing!
- cawing?
- cawed
- cawed.
- cawed!
- cawed?

#Vulpkanin
- type: emote
id: Bark
category: Vocal
chatMessages: [barks.]
chatMessages: [ barks ]
chatTriggers:
- bark
- bark.
- bark!
- bark?
- barks
- barks.
- barks!
- barks?
- barked
- barked.
- barked!
- barked?
- barking
- barking.
- barking!
- barking?

- type: emote
id: Snarl
category: Vocal
chatMessages: [snarls.]
chatMessages: [ snarls ]
chatTriggers:
- snarl
- snarl.
- snarl!
- snarl?
- snarls
- snarls.
- snarls!
- snarls?
- snarled
- snarled.
- snarled!
- snarled?
- snarling
- snarling.
- snarling!
- snarling?

- type: emote
id: Whine
category: Vocal
chatMessages: [whines.]
chatMessages: [ whines ]
chatTriggers:
- whine
- whine.
- whine!
- whine?
- whines
- whines.
- whines!
- whines?
- whined
- whined.
- whined!
- whined?
- whining
- whining.
- whining!
- whining?

- type: emote
id: Howl
category: Vocal
chatMessages: [howls.]
chatMessages: [ howls ]
chatTriggers:
- howl
- howl.
- howl!
- howl?
- howls
- howls.
- howls!
- howls?
- howling
- howling.
- howling!
- howling?
- howled
- howled.
- howling!
- howling?
61 changes: 13 additions & 48 deletions Resources/Prototypes/Nyanotrasen/Voice/speech_emotes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,37 @@
- type: emote
id: Hiss
category: Vocal
chatMessages: [hisses.]
chatMessages: [ hisses ]
chatTriggers:
- hiss.
- hisses.
- hisses!
- hissing.
- hissed.
- hisses

- type: emote
id: Meow
category: Vocal
chatMessages: [meows.]
chatMessages: [ meows ]
chatTriggers:
- meow.
- meow!
- meows.
- meows~
- meows!
- meowing.
- meowed.
- miau.
- miaus.
- miaus!
- nya.
- nyas.
- nyas!
- mraow.
- mraow!
- mraow~
- mraows.
- mraows!
- mraows~
- meows
- miaus
- nyas
- mraows

- type: emote
id: Mew
category: Vocal
chatMessages: [mews.]
chatMessages: [ mews ]
chatTriggers:
- mew.
- mew!
- mew~
- mews.
- mews!
- mews~
- mewing.
- mewed.
- mews

- type: emote
id: Growl
category: Vocal
chatMessages: [growls.]
chatMessages: [ growls ]
chatTriggers:
- growl.
- growls.
- growls!
- growling.
- growled.
- growls

- type: emote
id: Purr
category: Vocal
chatMessages: [purrs.]
chatMessages: [ purrs ]
chatTriggers:
- purr.
- purrs.
- purrs~
- purrs!
- purring.
- purred.
- purrs
20 changes: 9 additions & 11 deletions Resources/Prototypes/Voice/disease_emotes.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
- type: emote
id: Sneeze
category: Vocal
chatMessages: [sneezes]
chatMessages: [ sneezes ]

- type: emote
id: Cough
category: Vocal
chatMessages: [coughs]
chatMessages: [ coughs ]
chatTriggers:
- cough
- coughs

- type: emote
id: CatMeow
category: Vocal
chatMessages: [meows]
chatMessages: [ meows ]

- type: emote
id: CatHisses
category: Vocal
chatMessages: [hisses]
chatMessages: [ hisses ]

- type: emote
id: MonkeyScreeches
category: Vocal
chatMessages: [screeches]
chatMessages: [ screeches ]

- type: emote
id: RobotBeep
category: Vocal
chatMessages: [beeps]
chatMessages: [ beeps ]

- type: emote
id: Yawn
category: Vocal
chatMessages: [yawns]
chatMessages: [ yawns ]
chatTriggers:
- yawn
- yawns

- type: emote
id: Snore
category: Vocal
chatMessages: [snores]
chatMessages: [ snores ]
Loading
Loading