Hunger and thirst huds fix (#32832)
* Hunger and thirst huds fix * delete poor caching
This commit is contained in:
@@ -33,18 +33,10 @@ public sealed class HungerSystem : EntitySystem
|
||||
[ValidatePrototypeId<SatiationIconPrototype>]
|
||||
private const string HungerIconStarvingId = "HungerIconStarving";
|
||||
|
||||
private SatiationIconPrototype? _hungerIconOverfed;
|
||||
private SatiationIconPrototype? _hungerIconPeckish;
|
||||
private SatiationIconPrototype? _hungerIconStarving;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
DebugTools.Assert(_prototype.TryIndex(HungerIconOverfedId, out _hungerIconOverfed) &&
|
||||
_prototype.TryIndex(HungerIconPeckishId, out _hungerIconPeckish) &&
|
||||
_prototype.TryIndex(HungerIconStarvingId, out _hungerIconStarving));
|
||||
|
||||
SubscribeLocalEvent<HungerComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<HungerComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<HungerComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||
@@ -221,13 +213,13 @@ public sealed class HungerSystem : EntitySystem
|
||||
switch (component.CurrentThreshold)
|
||||
{
|
||||
case HungerThreshold.Overfed:
|
||||
prototype = _hungerIconOverfed;
|
||||
_prototype.TryIndex(HungerIconOverfedId, out prototype);
|
||||
break;
|
||||
case HungerThreshold.Peckish:
|
||||
prototype = _hungerIconPeckish;
|
||||
_prototype.TryIndex(HungerIconPeckishId, out prototype);
|
||||
break;
|
||||
case HungerThreshold.Starving:
|
||||
prototype = _hungerIconStarving;
|
||||
_prototype.TryIndex(HungerIconStarvingId, out prototype);
|
||||
break;
|
||||
default:
|
||||
prototype = null;
|
||||
|
||||
Reference in New Issue
Block a user