[fix] emotion panel now takes White category

This commit is contained in:
rhailrake
2023-05-05 15:14:17 +06:00
committed by Aviu00
parent 59b5f24842
commit 3a093ced92
3 changed files with 16 additions and 18 deletions

View File

@@ -6,13 +6,11 @@ using Content.Client.UserInterface.Systems.Emotions.Windows;
using Content.Shared.Chat; using Content.Shared.Chat;
using Content.Shared.Chat.Prototypes; using Content.Shared.Chat.Prototypes;
using Content.Shared.Input; using Content.Shared.Input;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers; using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input.Binding; using Robust.Shared.Input.Binding;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Client.UserInterface.Systems.Emotions; namespace Content.Client.UserInterface.Systems.Emotions;
@@ -27,18 +25,17 @@ public sealed class EmotionsUIController : UIController, IOnStateChanged<Gamepla
private MenuButton? EmotionsButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.EmotionsButton; private MenuButton? EmotionsButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.EmotionsButton;
private DateTime _lastEmotionTimeUse = DateTime.Now; private DateTime _lastEmotionTimeUse = DateTime.Now;
private float _emoteCooldown = 1.5f; private const float EmoteCooldown = 1.5f;
public void OnStateEntered(GameplayState state) public void OnStateEntered(GameplayState state)
{ {
DebugTools.Assert(_window == null);
_window = UIManager.CreateWindow<EmotionsWindow>(); _window = UIManager.CreateWindow<EmotionsWindow>();
_window.OnOpen += OnWindowOpened; _window.OnOpen += OnWindowOpened;
_window.OnClose += OnWindowClosed; _window.OnClose += OnWindowClosed;
var emotions = _prototypeManager.EnumeratePrototypes<EmotePrototype>().ToList(); var emotions = _prototypeManager.EnumeratePrototypes<EmotePrototype>().ToList();
emotions = emotions.Where(emote => emote.Category == EmoteCategory.White).ToList();
emotions.Sort((a,b) => string.Compare(a.ButtonText, b.ButtonText.ToString(), StringComparison.Ordinal)); emotions.Sort((a,b) => string.Compare(a.ButtonText, b.ButtonText.ToString(), StringComparison.Ordinal));
foreach (var emote in emotions) foreach (var emote in emotions)
@@ -73,7 +70,7 @@ public sealed class EmotionsUIController : UIController, IOnStateChanged<Gamepla
{ {
var timeSpan = DateTime.Now - _lastEmotionTimeUse; var timeSpan = DateTime.Now - _lastEmotionTimeUse;
var seconds = timeSpan.TotalSeconds; var seconds = timeSpan.TotalSeconds;
if (seconds < _emoteCooldown) if (seconds < EmoteCooldown)
{ {
return; return;
} }

View File

@@ -54,5 +54,6 @@ public enum EmoteCategory : byte
Invalid = 0, Invalid = 0,
Vocal = 1 << 0, Vocal = 1 << 0,
Gesture = 1 << 1, Gesture = 1 << 1,
General = byte.MaxValue General = byte.MaxValue,
White = byte.MaxValue
} }

View File

@@ -1,6 +1,6 @@
- type: emote - type: emote
id: Scream id: Scream
category: Vocal category: White
buttonText: Кричать buttonText: Кричать
chatMessages: [кричит, орет, вопит, рявкает] chatMessages: [кричит, орет, вопит, рявкает]
chatTriggers: chatTriggers:
@@ -22,7 +22,7 @@
- type: emote - type: emote
id: Laugh id: Laugh
category: Vocal category: White
buttonText: Смеяться buttonText: Смеяться
chatMessages: [смеется, ржет, усмехается, хохочет, гогочет] chatMessages: [смеется, ржет, усмехается, хохочет, гогочет]
chatTriggers: chatTriggers:
@@ -43,7 +43,7 @@
- type: emote - type: emote
id: Clap id: Clap
category: Gesture category: White
buttonText: Хлопать buttonText: Хлопать
chatMessages: [хлопает] chatMessages: [хлопает]
chatTriggers: chatTriggers:
@@ -54,7 +54,7 @@
- type: emote - type: emote
id: Snap id: Snap
category: Gesture category: White
buttonText: Щелкать пальцами buttonText: Щелкать пальцами
chatMessages: [щелкает пальцами] chatMessages: [щелкает пальцами]
chatTriggers: chatTriggers:
@@ -67,42 +67,42 @@
- type: emote - type: emote
id: WaveHand id: WaveHand
category: Gesture category: White
buttonText: Махать рукой buttonText: Махать рукой
chatMessages: [машет рукой] chatMessages: [машет рукой]
- type: emote - type: emote
id: Nod id: Nod
category: Gesture category: White
buttonText: Кивать buttonText: Кивать
chatMessages: [кивает] chatMessages: [кивает]
- type: emote - type: emote
id: ShakeHead id: ShakeHead
category: Gesture category: White
buttonText: Покачать головой buttonText: Покачать головой
chatMessages: [качает головой] chatMessages: [качает головой]
- type: emote - type: emote
id: Frown id: Frown
category: Gesture category: White
buttonText: Хмуриться buttonText: Хмуриться
chatMessages: [хмурится] chatMessages: [хмурится]
- type: emote - type: emote
id: Smile id: Smile
category: Gesture category: White
buttonText: Улыбаться buttonText: Улыбаться
chatMessages: [улыбается] chatMessages: [улыбается]
- type: emote - type: emote
id: Sniff id: Sniff
category: Gesture category: White
buttonText: Принюхиваться buttonText: Принюхиваться
chatMessages: [принюхивается] chatMessages: [принюхивается]
- type: emote - type: emote
id: LickLips id: LickLips
category: Gesture category: White
buttonText: Облизываться buttonText: Облизываться
chatMessages: [облизывается] chatMessages: [облизывается]