[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.Prototypes;
using Content.Shared.Input;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input.Binding;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
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 DateTime _lastEmotionTimeUse = DateTime.Now;
private float _emoteCooldown = 1.5f;
private const float EmoteCooldown = 1.5f;
public void OnStateEntered(GameplayState state)
{
DebugTools.Assert(_window == null);
_window = UIManager.CreateWindow<EmotionsWindow>();
_window.OnOpen += OnWindowOpened;
_window.OnClose += OnWindowClosed;
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));
foreach (var emote in emotions)
@@ -73,7 +70,7 @@ public sealed class EmotionsUIController : UIController, IOnStateChanged<Gamepla
{
var timeSpan = DateTime.Now - _lastEmotionTimeUse;
var seconds = timeSpan.TotalSeconds;
if (seconds < _emoteCooldown)
if (seconds < EmoteCooldown)
{
return;
}

View File

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

View File

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