From 1a13884961297c3679f73597dc4691d48198d827 Mon Sep 17 00:00:00 2001 From: PrPleGoo Date: Sat, 23 Sep 2023 15:14:06 +0200 Subject: [PATCH] Task/food hud (#19312) * security HUD now shows a job icon on entities with a body * thirst goggles * set starting hud gear * fix build * remove from starting gear * remove * replace * fix thirst and hunger icons * update icons * space * space * ] * ] * fix build * fix comments * fix * spacing * field * move more namespaces * use AutoGenerateComponentState * comments * fix build * not all fields * comments * unpaused * fix Dirty warning --------- Co-authored-by: Slava0135 --- .../Overlays/ShowHungerIconsSystem.cs | 58 +++++++++++++ .../Overlays/ShowThirstIconsSystem.cs | 58 +++++++++++++ .../Chemistry/ReagentEffects/SatiateThirst.cs | 4 +- Content.Server/Medical/VomitSystem.cs | 4 - .../Nutrition/Components/ThirstComponent.cs | 54 ------------ .../Inventory/InventorySystem.Relay.cs | 2 + .../Nutrition/Components/HungerComponent.cs | 46 +++-------- .../Nutrition/Components/ThirstComponent.cs | 78 ++++++++++++++++++ .../Nutrition/EntitySystems/HungerSystem.cs | 29 +------ .../Nutrition/EntitySystems/ThirstSystem.cs | 50 ++++++----- .../Overlays/ShowHungerIconsComponent.cs | 9 ++ .../Overlays/ShowSecurityIconsComponent.cs | 15 ++-- .../Overlays/ShowThirstIconsComponent.cs | 9 ++ .../Prototypes/Entities/Clothing/Eyes/hud.yml | 21 +++++ Resources/Prototypes/StatusEffects/hunger.yml | 49 +++++++++++ .../Interface/Misc/food_icons.rsi/parched.png | Bin 292 -> 273 bytes .../Interface/Misc/food_icons.rsi/peckish.png | Bin 283 -> 234 bytes .../Misc/food_icons.rsi/starving.png | Bin 274 -> 237 bytes .../Interface/Misc/food_icons.rsi/thirsty.png | Bin 296 -> 273 bytes 19 files changed, 335 insertions(+), 151 deletions(-) create mode 100644 Content.Client/Overlays/ShowHungerIconsSystem.cs create mode 100644 Content.Client/Overlays/ShowThirstIconsSystem.cs delete mode 100644 Content.Server/Nutrition/Components/ThirstComponent.cs create mode 100644 Content.Shared/Nutrition/Components/ThirstComponent.cs rename {Content.Server => Content.Shared}/Nutrition/EntitySystems/ThirstSystem.cs (84%) create mode 100644 Content.Shared/Overlays/ShowHungerIconsComponent.cs create mode 100644 Content.Shared/Overlays/ShowThirstIconsComponent.cs create mode 100644 Resources/Prototypes/StatusEffects/hunger.yml diff --git a/Content.Client/Overlays/ShowHungerIconsSystem.cs b/Content.Client/Overlays/ShowHungerIconsSystem.cs new file mode 100644 index 0000000000..0182a08678 --- /dev/null +++ b/Content.Client/Overlays/ShowHungerIconsSystem.cs @@ -0,0 +1,58 @@ +using Content.Shared.Nutrition.Components; +using Content.Shared.Overlays; +using Content.Shared.StatusIcon; +using Content.Shared.StatusIcon.Components; +using Robust.Shared.Prototypes; + +namespace Content.Client.Overlays; + +public sealed class ShowHungerIconsSystem : EquipmentHudSystem +{ + [Dependency] private readonly IPrototypeManager _prototypeMan = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnGetStatusIconsEvent); + } + + private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent hungerComponent, ref GetStatusIconsEvent args) + { + if (!IsActive || args.InContainer) + return; + + var healthIcons = DecideHungerIcon(uid, hungerComponent); + + args.StatusIcons.AddRange(healthIcons); + } + + private IReadOnlyList DecideHungerIcon(EntityUid uid, HungerComponent hungerComponent) + { + var result = new List(); + + switch (hungerComponent.CurrentThreshold) + { + case HungerThreshold.Overfed: + if (_prototypeMan.TryIndex("HungerIconOverfed", out var overfed)) + { + result.Add(overfed); + } + break; + case HungerThreshold.Peckish: + if (_prototypeMan.TryIndex("HungerIconPeckish", out var peckish)) + { + result.Add(peckish); + } + break; + case HungerThreshold.Starving: + if (_prototypeMan.TryIndex("HungerIconStarving", out var starving)) + { + result.Add(starving); + } + break; + } + + return result; + } +} diff --git a/Content.Client/Overlays/ShowThirstIconsSystem.cs b/Content.Client/Overlays/ShowThirstIconsSystem.cs new file mode 100644 index 0000000000..89bc5029ba --- /dev/null +++ b/Content.Client/Overlays/ShowThirstIconsSystem.cs @@ -0,0 +1,58 @@ +using Content.Shared.Nutrition.Components; +using Content.Shared.Overlays; +using Content.Shared.StatusIcon; +using Content.Shared.StatusIcon.Components; +using Robust.Shared.Prototypes; + +namespace Content.Client.Overlays; + +public sealed class ShowThirstIconsSystem : EquipmentHudSystem +{ + [Dependency] private readonly IPrototypeManager _prototypeMan = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnGetStatusIconsEvent); + } + + private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent thirstComponent, ref GetStatusIconsEvent args) + { + if (!IsActive || args.InContainer) + return; + + var healthIcons = DecideThirstIcon(uid, thirstComponent); + + args.StatusIcons.AddRange(healthIcons); + } + + private IReadOnlyList DecideThirstIcon(EntityUid uid, ThirstComponent thirstComponent) + { + var result = new List(); + + switch (thirstComponent.CurrentThirstThreshold) + { + case ThirstThreshold.OverHydrated: + if (_prototypeMan.TryIndex("ThirstIconOverhydrated", out var overhydrated)) + { + result.Add(overhydrated); + } + break; + case ThirstThreshold.Thirsty: + if (_prototypeMan.TryIndex("ThirstIconThirsty", out var thirsty)) + { + result.Add(thirsty); + } + break; + case ThirstThreshold.Parched: + if (_prototypeMan.TryIndex("ThirstIconParched", out var parched)) + { + result.Add(parched); + } + break; + } + + return result; + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs b/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs index 551e4923bc..529aa8adf1 100644 --- a/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs +++ b/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs @@ -1,6 +1,6 @@ -using Content.Server.Nutrition.Components; -using Content.Shared.Chemistry.Reagent; using Content.Server.Nutrition.EntitySystems; +using Content.Shared.Chemistry.Reagent; +using Content.Shared.Nutrition.Components; using Robust.Shared.Prototypes; namespace Content.Server.Chemistry.ReagentEffects diff --git a/Content.Server/Medical/VomitSystem.cs b/Content.Server/Medical/VomitSystem.cs index ed62176973..a764cd2b19 100644 --- a/Content.Server/Medical/VomitSystem.cs +++ b/Content.Server/Medical/VomitSystem.cs @@ -1,16 +1,12 @@ using Content.Server.Body.Components; using Content.Server.Body.Systems; using Content.Server.Chemistry.EntitySystems; -using Content.Server.Fluids.Components; using Content.Server.Fluids.EntitySystems; using Content.Server.Forensics; -using Content.Server.Nutrition.Components; using Content.Server.Nutrition.EntitySystems; using Content.Server.Popups; using Content.Server.Stunnable; -using Content.Shared.Audio; using Content.Shared.Chemistry.Components; -using Content.Shared.Fluids.Components; using Content.Shared.IdentityManagement; using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; diff --git a/Content.Server/Nutrition/Components/ThirstComponent.cs b/Content.Server/Nutrition/Components/ThirstComponent.cs deleted file mode 100644 index 1b2d9049b8..0000000000 --- a/Content.Server/Nutrition/Components/ThirstComponent.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Content.Shared.Alert; - -namespace Content.Server.Nutrition.Components -{ - [Flags] - public enum ThirstThreshold : byte - { - // Hydrohomies - Dead = 0, - Parched = 1 << 0, - Thirsty = 1 << 1, - Okay = 1 << 2, - OverHydrated = 1 << 3, - } - - [RegisterComponent] - public sealed partial class ThirstComponent : Component - { - // Base stuff - [ViewVariables(VVAccess.ReadWrite)] - [DataField("baseDecayRate")] - public float BaseDecayRate = 0.1f; - - [ViewVariables(VVAccess.ReadWrite)] - public float ActualDecayRate; - - // Thirst - [ViewVariables(VVAccess.ReadOnly)] - public ThirstThreshold CurrentThirstThreshold; - - public ThirstThreshold LastThirstThreshold; - - [ViewVariables(VVAccess.ReadWrite)] - [DataField("startingThirst")] - public float CurrentThirst = -1f; - - [DataField("thresholds")] - public Dictionary ThirstThresholds { get; private set; } = new() - { - {ThirstThreshold.OverHydrated, 600.0f}, - {ThirstThreshold.Okay, 450.0f}, - {ThirstThreshold.Thirsty, 300.0f}, - {ThirstThreshold.Parched, 150.0f}, - {ThirstThreshold.Dead, 0.0f}, - }; - - public static readonly Dictionary ThirstThresholdAlertTypes = new() - { - {ThirstThreshold.Thirsty, AlertType.Thirsty}, - {ThirstThreshold.Parched, AlertType.Parched}, - {ThirstThreshold.Dead, AlertType.Parched}, - }; - } -} diff --git a/Content.Shared/Inventory/InventorySystem.Relay.cs b/Content.Shared/Inventory/InventorySystem.Relay.cs index 1731d5c64e..83b47542e2 100644 --- a/Content.Shared/Inventory/InventorySystem.Relay.cs +++ b/Content.Shared/Inventory/InventorySystem.Relay.cs @@ -38,6 +38,8 @@ public partial class InventorySystem // ComponentActivatedClientSystems SubscribeLocalEvent>(RelayInventoryEvent); + SubscribeLocalEvent>(RelayInventoryEvent); + SubscribeLocalEvent>(RelayInventoryEvent); SubscribeLocalEvent>(OnGetStrippingVerbs); } diff --git a/Content.Shared/Nutrition/Components/HungerComponent.cs b/Content.Shared/Nutrition/Components/HungerComponent.cs index 25d1e5e0a2..037c069cf4 100644 --- a/Content.Shared/Nutrition/Components/HungerComponent.cs +++ b/Content.Shared/Nutrition/Components/HungerComponent.cs @@ -9,12 +9,14 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic; namespace Content.Shared.Nutrition.Components; [RegisterComponent, NetworkedComponent, Access(typeof(HungerSystem))] +[AutoGenerateComponentState] public sealed partial class HungerComponent : Component { /// /// The current hunger amount of the entity /// [DataField("currentHunger"), ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] public float CurrentHunger; /// @@ -28,6 +30,7 @@ public sealed partial class HungerComponent : Component /// Affected by /// [DataField("actualDecayRate"), ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] public float ActualDecayRate; /// @@ -35,18 +38,21 @@ public sealed partial class HungerComponent : Component /// Stored in order to prevent recalculating /// [DataField("lastThreshold"), ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] public HungerThreshold LastThreshold; /// /// The current hunger threshold the entity is at /// [DataField("currentThreshold"), ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] public HungerThreshold CurrentThreshold; /// /// A dictionary relating HungerThreshold to the amount of needed for each one /// [DataField("thresholds", customTypeSerializer: typeof(DictionarySerializer))] + [AutoNetworkedField(cloneData: true)] public Dictionary Thresholds = new() { { HungerThreshold.Overfed, 200.0f }, @@ -60,6 +66,7 @@ public sealed partial class HungerComponent : Component /// A dictionary relating hunger thresholds to corresponding alerts. /// [DataField("hungerThresholdAlerts", customTypeSerializer: typeof(DictionarySerializer))] + [AutoNetworkedField(cloneData: true)] public Dictionary HungerThresholdAlerts = new() { { HungerThreshold.Peckish, AlertType.Peckish }, @@ -71,6 +78,7 @@ public sealed partial class HungerComponent : Component /// A dictionary relating HungerThreshold to how much they modify . /// [DataField("hungerThresholdDecayModifiers", customTypeSerializer: typeof(DictionarySerializer))] + [AutoNetworkedField(cloneData: true)] public Dictionary HungerThresholdDecayModifiers = new() { { HungerThreshold.Overfed, 1.2f }, @@ -84,6 +92,7 @@ public sealed partial class HungerComponent : Component /// The amount of slowdown applied when an entity is starving /// [DataField("starvingSlowdownModifier"), ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] public float StarvingSlowdownModifier = 0.75f; /// @@ -96,50 +105,17 @@ public sealed partial class HungerComponent : Component /// The time when the hunger will update next. /// [DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] public TimeSpan NextUpdateTime; /// /// The time between each update. /// [ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] public TimeSpan UpdateRate = TimeSpan.FromSeconds(1); } -[Serializable, NetSerializable] -public sealed class HungerComponentState : ComponentState -{ - public float CurrentHunger; - - public float BaseDecayRate; - - public float ActualDecayRate; - - public HungerThreshold LastHungerThreshold; - - public HungerThreshold CurrentThreshold; - - public float StarvingSlowdownModifier; - - public TimeSpan NextUpdateTime; - - public HungerComponentState(float currentHunger, - float baseDecayRate, - float actualDecayRate, - HungerThreshold lastHungerThreshold, - HungerThreshold currentThreshold, - float starvingSlowdownModifier, - TimeSpan nextUpdateTime) - { - CurrentHunger = currentHunger; - BaseDecayRate = baseDecayRate; - ActualDecayRate = actualDecayRate; - LastHungerThreshold = lastHungerThreshold; - CurrentThreshold = currentThreshold; - StarvingSlowdownModifier = starvingSlowdownModifier; - NextUpdateTime = nextUpdateTime; - } -} - [Serializable, NetSerializable] public enum HungerThreshold : byte { diff --git a/Content.Shared/Nutrition/Components/ThirstComponent.cs b/Content.Shared/Nutrition/Components/ThirstComponent.cs new file mode 100644 index 0000000000..da75a8e5de --- /dev/null +++ b/Content.Shared/Nutrition/Components/ThirstComponent.cs @@ -0,0 +1,78 @@ +using Content.Server.Nutrition.EntitySystems; +using Content.Shared.Alert; +using Robust.Shared.GameStates; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; + +namespace Content.Shared.Nutrition.Components; + +[RegisterComponent, NetworkedComponent, Access(typeof(ThirstSystem))] +[AutoGenerateComponentState] +public sealed partial class ThirstComponent : Component +{ + // Base stuff + [ViewVariables(VVAccess.ReadWrite)] + [DataField("baseDecayRate")] + [AutoNetworkedField] + public float BaseDecayRate = 0.1f; + + [ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] + public float ActualDecayRate; + + // Thirst + [ViewVariables(VVAccess.ReadOnly)] + [AutoNetworkedField] + public ThirstThreshold CurrentThirstThreshold; + + [ViewVariables(VVAccess.ReadOnly)] + [AutoNetworkedField] + public ThirstThreshold LastThirstThreshold; + + [ViewVariables(VVAccess.ReadWrite)] + [DataField("startingThirst")] + [AutoNetworkedField] + public float CurrentThirst = -1f; + + /// + /// The time when the hunger will update next. + /// + [DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] + public TimeSpan NextUpdateTime; + + /// + /// The time between each update. + /// + [ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] + public TimeSpan UpdateRate = TimeSpan.FromSeconds(1); + + [DataField("thresholds")] + [AutoNetworkedField(cloneData: true)] + public Dictionary ThirstThresholds = new() + { + {ThirstThreshold.OverHydrated, 600.0f}, + {ThirstThreshold.Okay, 450.0f}, + {ThirstThreshold.Thirsty, 300.0f}, + {ThirstThreshold.Parched, 150.0f}, + {ThirstThreshold.Dead, 0.0f}, + }; + + public static readonly Dictionary ThirstThresholdAlertTypes = new() + { + {ThirstThreshold.Thirsty, AlertType.Thirsty}, + {ThirstThreshold.Parched, AlertType.Parched}, + {ThirstThreshold.Dead, AlertType.Parched}, + }; +} + +[Flags] +public enum ThirstThreshold : byte +{ + // Hydrohomies + Dead = 0, + Parched = 1 << 0, + Thirsty = 1 << 1, + Okay = 1 << 2, + OverHydrated = 1 << 3, +} diff --git a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs index d5f8860081..8baee3e379 100644 --- a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs @@ -1,10 +1,9 @@ -using Content.Shared.Alert; +using Content.Shared.Alert; using Content.Shared.Damage; using Content.Shared.Mobs.Systems; using Content.Shared.Movement.Systems; using Content.Shared.Nutrition.Components; using Content.Shared.Rejuvenate; -using Robust.Shared.GameStates; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -24,8 +23,6 @@ public sealed class HungerSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnGetState); - SubscribeLocalEvent(OnHandleState); SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnShutdown); @@ -33,30 +30,6 @@ public sealed class HungerSystem : EntitySystem SubscribeLocalEvent(OnRejuvenate); } - private void OnGetState(EntityUid uid, HungerComponent component, ref ComponentGetState args) - { - args.State = new HungerComponentState(component.CurrentHunger, - component.BaseDecayRate, - component.ActualDecayRate, - component.LastThreshold, - component.CurrentThreshold, - component.StarvingSlowdownModifier, - component.NextUpdateTime); - } - - private void OnHandleState(EntityUid uid, HungerComponent component, ref ComponentHandleState args) - { - if (args.Current is not HungerComponentState state) - return; - component.CurrentHunger = state.CurrentHunger; - component.BaseDecayRate = state.BaseDecayRate; - component.ActualDecayRate = state.ActualDecayRate; - component.LastThreshold = state.LastHungerThreshold; - component.CurrentThreshold = state.CurrentThreshold; - component.StarvingSlowdownModifier = state.StarvingSlowdownModifier; - component.NextUpdateTime = state.NextUpdateTime; - } - private void OnUnpaused(EntityUid uid, HungerComponent component, ref EntityUnpausedEvent args) { component.NextUpdateTime += args.PausedTime; diff --git a/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs b/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs similarity index 84% rename from Content.Server/Nutrition/EntitySystems/ThirstSystem.cs rename to Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs index 2e9c1134a2..4fa7c417aa 100644 --- a/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs @@ -1,23 +1,24 @@ -using Content.Server.Nutrition.Components; +using Content.Shared.Alert; +using Content.Shared.Movement.Components; +using Content.Shared.Movement.Systems; +using Content.Shared.Nutrition.Components; +using Content.Shared.Rejuvenate; using JetBrains.Annotations; using Robust.Shared.Random; -using Content.Shared.Movement.Components; -using Content.Shared.Alert; -using Content.Shared.Movement.Systems; -using Content.Shared.Rejuvenate; +using Robust.Shared.Timing; namespace Content.Server.Nutrition.EntitySystems; [UsedImplicitly] public sealed class ThirstSystem : EntitySystem { + [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly AlertsSystem _alerts = default!; [Dependency] private readonly MovementSpeedModifierSystem _movement = default!; [Dependency] private readonly SharedJetpackSystem _jetpack = default!; private ISawmill _sawmill = default!; - private float _accumulatedFrameTime; public override void Initialize() { @@ -28,6 +29,7 @@ public sealed class ThirstSystem : EntitySystem SubscribeLocalEvent(OnRefreshMovespeed); SubscribeLocalEvent(OnComponentStartup); SubscribeLocalEvent(OnRejuvenate); + SubscribeLocalEvent(OnUnpaused); } private void OnComponentStartup(EntityUid uid, ThirstComponent component, ComponentStartup args) @@ -154,22 +156,30 @@ public sealed class ThirstSystem : EntitySystem public override void Update(float frameTime) { - _accumulatedFrameTime += frameTime; + base.Update(frameTime); - if (_accumulatedFrameTime > 1) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var thirst)) { - var query = EntityManager.EntityQueryEnumerator(); - while (query.MoveNext(out var uid, out var comp)) - { - UpdateThirst(comp, - comp.ActualDecayRate); - var calculatedThirstThreshold = GetThirstThreshold(comp, comp.CurrentThirst); - if (calculatedThirstThreshold != comp.CurrentThirstThreshold) - { - comp.CurrentThirstThreshold = calculatedThirstThreshold; - UpdateEffects(uid, comp); - } - } - _accumulatedFrameTime -= 1; + if (_timing.CurTime < thirst.NextUpdateTime) + continue; + + thirst.NextUpdateTime += thirst.UpdateRate; + + UpdateThirst(thirst, -thirst.ActualDecayRate); + var calculatedThirstThreshold = GetThirstThreshold(thirst, thirst.CurrentThirst); + + if (calculatedThirstThreshold == thirst.CurrentThirstThreshold) + continue; + + thirst.CurrentThirstThreshold = calculatedThirstThreshold; + UpdateEffects(uid, thirst); + Dirty(uid, thirst); } } + + private void OnUnpaused(EntityUid uid, ThirstComponent component, ref EntityUnpausedEvent args) + { + component.NextUpdateTime += args.PausedTime; + } } diff --git a/Content.Shared/Overlays/ShowHungerIconsComponent.cs b/Content.Shared/Overlays/ShowHungerIconsComponent.cs new file mode 100644 index 0000000000..bf1fb2dc19 --- /dev/null +++ b/Content.Shared/Overlays/ShowHungerIconsComponent.cs @@ -0,0 +1,9 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Overlays; + +/// +/// This component allows you to see the hungriness of mobs. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class ShowHungerIconsComponent : Component { } diff --git a/Content.Shared/Overlays/ShowSecurityIconsComponent.cs b/Content.Shared/Overlays/ShowSecurityIconsComponent.cs index 2127408afb..ec268174d1 100644 --- a/Content.Shared/Overlays/ShowSecurityIconsComponent.cs +++ b/Content.Shared/Overlays/ShowSecurityIconsComponent.cs @@ -1,10 +1,9 @@ using Robust.Shared.GameStates; -namespace Content.Shared.Overlays -{ - /// - /// This component allows you to see job icons above mobs. - /// - [RegisterComponent, NetworkedComponent] - public sealed partial class ShowSecurityIconsComponent : Component { } -} +namespace Content.Shared.Overlays; + +/// +/// This component allows you to see job icons above mobs. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class ShowSecurityIconsComponent : Component { } diff --git a/Content.Shared/Overlays/ShowThirstIconsComponent.cs b/Content.Shared/Overlays/ShowThirstIconsComponent.cs new file mode 100644 index 0000000000..905ab07fe2 --- /dev/null +++ b/Content.Shared/Overlays/ShowThirstIconsComponent.cs @@ -0,0 +1,9 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Overlays; + +/// +/// This component allows you to see the thirstiness of mobs. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class ShowThirstIconsComponent : Component { } diff --git a/Resources/Prototypes/Entities/Clothing/Eyes/hud.yml b/Resources/Prototypes/Entities/Clothing/Eyes/hud.yml index 9b505654c9..80317fbaec 100644 --- a/Resources/Prototypes/Entities/Clothing/Eyes/hud.yml +++ b/Resources/Prototypes/Entities/Clothing/Eyes/hud.yml @@ -42,6 +42,7 @@ sprite: Clothing/Eyes/Hud/beergoggles.rsi - type: Clothing sprite: Clothing/Eyes/Hud/beergoggles.rsi + - type: ShowThirstIcons - type: entity parent: ClothingEyesBase @@ -53,6 +54,19 @@ sprite: Clothing/Eyes/Hud/friedonion.rsi - type: Clothing sprite: Clothing/Eyes/Hud/friedonion.rsi + - type: ShowHungerIcons + - type: Food + - type: SolutionContainerManager + solutions: + food: + maxVol: 3 + reagents: + - ReagentId: Nutriment + Quantity: 3 + - type: FlavorProfile + flavors: + - onion + - greasey - type: entity parent: ClothingEyesBase @@ -64,6 +78,8 @@ sprite: Clothing/Eyes/Hud/onionbeer.rsi - type: Clothing sprite: Clothing/Eyes/Hud/onionbeer.rsi + - type: ShowHungerIcons + - type: ShowThirstIcons - type: entity parent: ClothingEyesBase @@ -75,6 +91,7 @@ sprite: Clothing/Eyes/Hud/medonion.rsi - type: Clothing sprite: Clothing/Eyes/Hud/medonion.rsi + - type: ShowHungerIcons - type: entity parent: ClothingEyesBase @@ -86,6 +103,8 @@ sprite: Clothing/Eyes/Hud/medonionbeer.rsi - type: Clothing sprite: Clothing/Eyes/Hud/medonionbeer.rsi + - type: ShowHungerIcons + - type: ShowThirstIcons - type: entity parent: ClothingEyesBase @@ -122,3 +141,5 @@ - type: Clothing sprite: Clothing/Eyes/Hud/omni.rsi - type: ShowSecurityIcons + - type: ShowHungerIcons + - type: ShowThirstIcons diff --git a/Resources/Prototypes/StatusEffects/hunger.yml b/Resources/Prototypes/StatusEffects/hunger.yml new file mode 100644 index 0000000000..294a7659b1 --- /dev/null +++ b/Resources/Prototypes/StatusEffects/hunger.yml @@ -0,0 +1,49 @@ +#Hunger +- type: statusIcon + id: HungerIconOverfed + priority: 5 + icon: + sprite: Interface/Misc/food_icons.rsi + state: overfed + locationPreference: Right + +- type: statusIcon + id: HungerIconPeckish + priority: 5 + icon: + sprite: Interface/Misc/food_icons.rsi + state: peckish + locationPreference: Right + +- type: statusIcon + id: HungerIconStarving + priority: 5 + icon: + sprite: Interface/Misc/food_icons.rsi + state: starving + locationPreference: Right + +#Thirst +- type: statusIcon + id: ThirstIconOverhydrated + priority: 5 + icon: + sprite: Interface/Misc/food_icons.rsi + state: overhydrated + locationPreference: Left + +- type: statusIcon + id: ThirstIconThirsty + priority: 5 + icon: + sprite: Interface/Misc/food_icons.rsi + state: thirsty + locationPreference: Left + +- type: statusIcon + id: ThirstIconParched + priority: 5 + icon: + sprite: Interface/Misc/food_icons.rsi + state: parched + locationPreference: Left diff --git a/Resources/Textures/Interface/Misc/food_icons.rsi/parched.png b/Resources/Textures/Interface/Misc/food_icons.rsi/parched.png index eb0a16390b7b4ac53375416a05a5138b2d469a4b..461d5f17299dfcc6b71b191d8df232a827c0bf0d 100644 GIT binary patch delta 228 zcmZ3&G?8h7BnLAC1HkG7{`}*|kDot(e*gacix)2(931}7 zWccv-(f@sMTXPs3?d@JXdgN?t=WJ^W)LfjtMF2<%lmz(&|3?K350qmifpVM$9+AZi z419+`m{C;2s{trz;_2cTA`$L;+MJ0&frsh9ji$h3lm7n?yW%RA$56O4v2{jKpww2$ zUk44C`Q98?5o37z7-oInu{r#I^^JK}x z2nFmwm#mYQWB3bH^arT%I}kJdgE$MU;2V$)a_v7L@drrrF*7jun%jY-APR!bZ5dM7 x7#QMN7#LF785rCx9T@&HgQdV4@py9*BLJdjNX?3)#B=}v002ovPDHLkV1n#saGL-C diff --git a/Resources/Textures/Interface/Misc/food_icons.rsi/peckish.png b/Resources/Textures/Interface/Misc/food_icons.rsi/peckish.png index 0f93a4c2e71a1363e33e9c7bc3b9aa21430729ca..760019c7800dae39476c0af454c94efd00a5011d 100644 GIT binary patch delta 169 zcmbQu^ontUXZ=A22EK!gJ0@noWnf@P^>lFz(FjgXVQAX3XU~5HDOsOcCY=)nRVrUz zQe7dSb>Z^mEKZjN-c1McQadDsjX%q?v1z8hk>H5< z_mA~fQ5yG*X2vNC!VEkzla4z$9GE>>g7MZo>5}6yH?n{h@+qZ8c&7RKGH3xg96$^L Rmx3pQC{I^Emvv4FO#nnPJ+A-& delta 218 zcmV<0044wG0hO7b;K)j(~uW z5-qoVEtvw_HbX8^dJ? z_bC)JI8PcKT~(U>S~5A;+9puTl#V;QF9zpYEunluE~5hfgzIJn!`{GZ9-YHL%NlQlD%A;S)+ zjG zqa17wX2Qk-8yF-NX3d=0*f^D!r$OmWLW2tH#d8N38N_tW88(=nNX-Unzopr0G(GlSpWb4 delta 229 zcmV>!@GnA3Z7)$ z-TU0h288#%)B1}Lf-x#qRrR61;hcljrWC>H8c}mkrZe|$rc0Ij8OM7>Q&1QIiBgdV z4VPOS40#f~7J$rw=ZwsXB*V?R*J0bt;&5iil<vEtFayuH-wH-4-p{A)!K+8Je f@%@nd_swA5ei$(H9Z(k=00000NkvXXu0mjfp@d;G diff --git a/Resources/Textures/Interface/Misc/food_icons.rsi/thirsty.png b/Resources/Textures/Interface/Misc/food_icons.rsi/thirsty.png index 89bc4240c1cf00f5b61b6aa169374d1acb2a8581..318b166abcadcba3578b2ba9cc258a6967707e45 100644 GIT binary patch delta 157 zcmZ3%G?8h7C*L6k2EId#q8eTe3=9lC6T{8x4~5Q_`1k+si37Xe=r$*~s5ZOYbz^fo zR-X`jfXm^*aesx4>zEHQHvL_7F+pmbgVI9YQ%