diff --git a/Content.Client/GameObjects/Components/Mobs/ClientStatusEffectsComponent.cs b/Content.Client/GameObjects/Components/Mobs/ClientStatusEffectsComponent.cs index fc2984f3ae..248767c326 100644 --- a/Content.Client/GameObjects/Components/Mobs/ClientStatusEffectsComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/ClientStatusEffectsComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Content.Client.UserInterface; @@ -100,7 +100,10 @@ namespace Content.Client.GameObjects.Components.Mobs foreach (var (key, effect) in _status.OrderBy(x => (int) x.Key)) { var texture = _resourceCache.GetTexture(effect.Icon); - var status = new StatusControl(key, texture); + var status = new StatusControl(key, texture) + { + ToolTip = key.ToString() + }; if (effect.Cooldown.HasValue) { diff --git a/Content.Client/UserInterface/StatusEffectsUI.cs b/Content.Client/UserInterface/StatusEffectsUI.cs index e6f0fc044f..baaade0028 100644 --- a/Content.Client/UserInterface/StatusEffectsUI.cs +++ b/Content.Client/UserInterface/StatusEffectsUI.cs @@ -8,13 +8,12 @@ namespace Content.Client.UserInterface /// public sealed class StatusEffectsUI : Control { - public VBoxContainer VBox => _vBox; - private readonly VBoxContainer _vBox; + public VBoxContainer VBox { get; } public StatusEffectsUI() { - _vBox = new VBoxContainer(); - AddChild(_vBox); + VBox = new VBoxContainer(); + AddChild(VBox); LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.Begin); LayoutContainer.SetAnchorAndMarginPreset(this, LayoutContainer.LayoutPreset.TopRight, margin: 10); diff --git a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs index 3325fc2caa..f6e979557a 100644 --- a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs +++ b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs @@ -193,8 +193,14 @@ namespace Content.Server.GameObjects.Components.ActionBlocking { if (Owner.TryGetComponent(out ServerStatusEffectsComponent status)) { - status.ChangeStatusEffectIcon(StatusEffect.Cuffed, - CanStillInteract ? "/Textures/Interface/StatusEffects/Handcuffed/Uncuffed.png" : "/Textures/Interface/StatusEffects/Handcuffed/Handcuffed.png"); + if (CanStillInteract) + { + status.RemoveStatusEffect(StatusEffect.Cuffed); + } + else + { + status.ChangeStatusEffectIcon(StatusEffect.Cuffed, "/Textures/Interface/StatusEffects/Handcuffed/Handcuffed.png"); + } } } diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs index b23b629d24..e32be62caa 100644 --- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs @@ -113,10 +113,14 @@ namespace Content.Server.GameObjects.Components.Buckle { if (Owner.TryGetComponent(out ServerStatusEffectsComponent? status)) { - status.ChangeStatusEffectIcon(StatusEffect.Buckled, - Buckled - ? BuckledTo!.BuckledIcon - : "/Textures/Interface/StatusEffects/Buckle/unbuckled.png"); + if (Buckled) + { + status.ChangeStatusEffectIcon(StatusEffect.Buckled, BuckledTo!.BuckledIcon); + } + else + { + status.RemoveStatusEffect(StatusEffect.Buckled); + } } } diff --git a/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs b/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs index 25ea510016..a0fb2d8166 100644 --- a/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs @@ -1,9 +1,10 @@ -using System; +using System; using System.Collections.Generic; using Content.Server.GameObjects.Components.Buckle; using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Movement; using Content.Shared.GameObjects.Components.Mobs; +using Content.Shared.Interfaces; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.Network; using Robust.Shared.Players; @@ -113,6 +114,9 @@ namespace Content.Server.GameObjects.Components.Mobs hands.StopPull(); break; + default: + player.PopupMessage(player, msg.Effect.ToString()); + break; } break; diff --git a/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs b/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs index 0633289de8..00d1a8c27b 100644 --- a/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs @@ -68,15 +68,12 @@ namespace Content.Server.GameObjects.Components.Nutrition serializer.DataField(ref _baseDecayRate, "base_decay_rate", 0.1f); } - // for shared string dict, since we don't define these anywhere in content - [UsedImplicitly] - public static readonly string[] _hungerThresholdImages = + + public static readonly Dictionary HungerThresholdImages = new Dictionary { - "/Textures/Interface/StatusEffects/Hunger/Overfed.png", - "/Textures/Interface/StatusEffects/Hunger/Okay.png", - "/Textures/Interface/StatusEffects/Hunger/Peckish.png", - "/Textures/Interface/StatusEffects/Hunger/Starving.png", - "/Textures/Interface/StatusEffects/Hunger/Dead.png", + { HungerThreshold.Overfed, "/Textures/Interface/StatusEffects/Hunger/Overfed.png" }, + { HungerThreshold.Peckish, "/Textures/Interface/StatusEffects/Hunger/Peckish.png" }, + { HungerThreshold.Starving, "/Textures/Interface/StatusEffects/Hunger/Starving.png" }, }; public void HungerThresholdEffect(bool force = false) @@ -92,7 +89,16 @@ namespace Content.Server.GameObjects.Components.Nutrition // Update UI Owner.TryGetComponent(out ServerStatusEffectsComponent statusEffectsComponent); - statusEffectsComponent?.ChangeStatusEffectIcon(StatusEffect.Hunger, _hungerThresholdImages[ (int)_currentHungerThreshold ]); + + if (HungerThresholdImages.TryGetValue(_currentHungerThreshold, out var statusTexture)) + { + statusEffectsComponent?.ChangeStatusEffectIcon(StatusEffect.Hunger, statusTexture); + } + else + { + statusEffectsComponent?.RemoveStatusEffect(StatusEffect.Hunger); + } + switch (_currentHungerThreshold) { case HungerThreshold.Overfed: diff --git a/Content.Server/GameObjects/Components/Nutrition/ThirstComponent.cs b/Content.Server/GameObjects/Components/Nutrition/ThirstComponent.cs index 379432e4f1..e8cee505fc 100644 --- a/Content.Server/GameObjects/Components/Nutrition/ThirstComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/ThirstComponent.cs @@ -52,8 +52,7 @@ namespace Content.Server.GameObjects.Components.Nutrition private float _currentThirst; [ViewVariables(VVAccess.ReadOnly)] - public Dictionary ThirstThresholds => _thirstThresholds; - private readonly Dictionary _thirstThresholds = new Dictionary + public Dictionary ThirstThresholds { get; } = new Dictionary { {ThirstThreshold.OverHydrated, 600.0f}, {ThirstThreshold.Okay, 450.0f}, @@ -62,15 +61,11 @@ namespace Content.Server.GameObjects.Components.Nutrition {ThirstThreshold.Dead, 0.0f}, }; - // for shared string dict, since we don't define these anywhere in content - [UsedImplicitly] - public static readonly string[] _thirstThresholdImages = + public static readonly Dictionary ThirstThresholdImages = new Dictionary { - "/Textures/Interface/StatusEffects/Thirst/OverHydrated.png", - "/Textures/Interface/StatusEffects/Thirst/Okay.png", - "/Textures/Interface/StatusEffects/Thirst/Thirsty.png", - "/Textures/Interface/StatusEffects/Thirst/Parched.png", - "/Textures/Interface/StatusEffects/Thirst/Dead.png", + {ThirstThreshold.OverHydrated, "/Textures/Interface/StatusEffects/Thirst/OverHydrated.png"}, + {ThirstThreshold.Thirsty, "/Textures/Interface/StatusEffects/Thirst/Thirsty.png"}, + {ThirstThreshold.Parched, "/Textures/Interface/StatusEffects/Thirst/Parched.png"}, }; public override void ExposeData(ObjectSerializer serializer) @@ -92,8 +87,15 @@ namespace Content.Server.GameObjects.Components.Nutrition // Update UI Owner.TryGetComponent(out ServerStatusEffectsComponent statusEffectsComponent); - statusEffectsComponent?.ChangeStatusEffectIcon(StatusEffect.Thirst, "/Textures/Interface/StatusEffects/Thirst/" + - _currentThirstThreshold + ".png"); + + if (ThirstThresholdImages.TryGetValue(_currentThirstThreshold, out var statusTexture)) + { + statusEffectsComponent?.ChangeStatusEffectIcon(StatusEffect.Thirst, statusTexture); + } + else + { + statusEffectsComponent?.RemoveStatusEffect(StatusEffect.Thirst); + } switch (_currentThirstThreshold) { @@ -135,8 +137,8 @@ namespace Content.Server.GameObjects.Components.Nutrition { base.Startup(); _currentThirst = IoCManager.Resolve().Next( - (int)_thirstThresholds[ThirstThreshold.Thirsty] + 10, - (int)_thirstThresholds[ThirstThreshold.Okay] - 1); + (int)ThirstThresholds[ThirstThreshold.Thirsty] + 10, + (int)ThirstThresholds[ThirstThreshold.Okay] - 1); _currentThirstThreshold = GetThirstThreshold(_currentThirst); _lastThirstThreshold = ThirstThreshold.Okay; // TODO: Potentially change this -> Used Okay because no effects. // TODO: Check all thresholds make sense and throw if they don't. @@ -148,7 +150,7 @@ namespace Content.Server.GameObjects.Components.Nutrition { ThirstThreshold result = ThirstThreshold.Dead; var value = ThirstThresholds[ThirstThreshold.OverHydrated]; - foreach (var threshold in _thirstThresholds) + foreach (var threshold in ThirstThresholds) { if (threshold.Value <= value && threshold.Value >= drink) { diff --git a/Resources/Textures/Interface/StatusEffects/Buckle/unbuckled.png b/Resources/Textures/Interface/StatusEffects/Buckle/unbuckled.png deleted file mode 100644 index 6879bd394f..0000000000 Binary files a/Resources/Textures/Interface/StatusEffects/Buckle/unbuckled.png and /dev/null differ diff --git a/Resources/Textures/Interface/StatusEffects/Handcuffed/Uncuffed.png b/Resources/Textures/Interface/StatusEffects/Handcuffed/Uncuffed.png deleted file mode 100644 index 6879bd394f..0000000000 Binary files a/Resources/Textures/Interface/StatusEffects/Handcuffed/Uncuffed.png and /dev/null differ diff --git a/Resources/Textures/Interface/StatusEffects/Hunger/Dead.png b/Resources/Textures/Interface/StatusEffects/Hunger/Dead.png deleted file mode 100644 index 6879bd394f..0000000000 Binary files a/Resources/Textures/Interface/StatusEffects/Hunger/Dead.png and /dev/null differ diff --git a/Resources/Textures/Interface/StatusEffects/Hunger/Okay.png b/Resources/Textures/Interface/StatusEffects/Hunger/Okay.png deleted file mode 100644 index 6879bd394f..0000000000 Binary files a/Resources/Textures/Interface/StatusEffects/Hunger/Okay.png and /dev/null differ diff --git a/Resources/Textures/Interface/StatusEffects/Thirst/Dead.png b/Resources/Textures/Interface/StatusEffects/Thirst/Dead.png deleted file mode 100644 index 6879bd394f..0000000000 Binary files a/Resources/Textures/Interface/StatusEffects/Thirst/Dead.png and /dev/null differ diff --git a/Resources/Textures/Interface/StatusEffects/Thirst/Okay.png b/Resources/Textures/Interface/StatusEffects/Thirst/Okay.png deleted file mode 100644 index 6879bd394f..0000000000 Binary files a/Resources/Textures/Interface/StatusEffects/Thirst/Okay.png and /dev/null differ