Fix hunger/thirst 'Dead' thresholds (#9453)

This commit is contained in:
themias
2022-07-05 23:08:57 -04:00
committed by GitHub
parent f9f460af31
commit 1014c7c335
5 changed files with 10 additions and 8 deletions

View File

@@ -64,6 +64,7 @@ namespace Content.Server.Nutrition.Components
{ HungerThreshold.Overfed, AlertType.Overfed },
{ HungerThreshold.Peckish, AlertType.Peckish },
{ HungerThreshold.Starving, AlertType.Starving },
{ HungerThreshold.Dead, AlertType.Starving },
};
public void HungerThresholdEffect(bool force = false)

View File

@@ -48,6 +48,7 @@ namespace Content.Server.Nutrition.Components
{ThirstThreshold.OverHydrated, AlertType.Overhydrated},
{ThirstThreshold.Thirsty, AlertType.Thirsty},
{ThirstThreshold.Parched, AlertType.Parched},
{ThirstThreshold.Dead, AlertType.Parched},
};
}
}

View File

@@ -44,7 +44,7 @@ namespace Content.Server.Nutrition.EntitySystems
private void OnRefreshMovespeed(EntityUid uid, ThirstComponent component, RefreshMovementSpeedModifiersEvent args)
{
var mod = (component.CurrentThirstThreshold & (ThirstThreshold.Parched | ThirstThreshold.Dead)) != 0x0 ? 0.75f : 1.0f;
var mod = component.CurrentThirstThreshold <= ThirstThreshold.Parched ? 0.75f : 1.0f;
args.ModifySpeed(mod, mod);
}

View File

@@ -24,10 +24,10 @@ namespace Content.Shared.Nutrition.Components
[Serializable, NetSerializable]
public enum HungerThreshold : byte
{
Overfed,
Okay,
Peckish,
Starving,
Dead,
Overfed = 1 << 3,
Okay = 1 << 2,
Peckish = 1 << 1,
Starving = 1 << 0,
Dead = 0,
}
}

View File

@@ -1,4 +1,4 @@
using Content.Shared.Movement.Systems;
using Content.Shared.Movement.Systems;
using Content.Shared.Nutrition.Components;
namespace Content.Shared.Nutrition.EntitySystems
@@ -14,7 +14,7 @@ namespace Content.Shared.Nutrition.EntitySystems
private void OnRefreshMovespeed(EntityUid uid, SharedHungerComponent component, RefreshMovementSpeedModifiersEvent args)
{
float mod = component.CurrentHungerThreshold == HungerThreshold.Starving ? 0.75f : 1.0f;
float mod = component.CurrentHungerThreshold <= HungerThreshold.Starving ? 0.75f : 1.0f;
args.ModifySpeed(mod, mod);
}
}