2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Movement.Components;
|
2022-06-24 17:44:30 +10:00
|
|
|
using Content.Shared.Movement.Systems;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Nutrition.Components;
|
2020-06-24 02:21:20 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Nutrition.Components
|
2020-06-24 02:21:20 +02:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2022-05-28 16:29:12 +02:00
|
|
|
[ComponentReference(typeof(SharedHungerComponent))]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class HungerComponent : SharedHungerComponent
|
2020-06-24 02:21:20 +02:00
|
|
|
{
|
|
|
|
|
private HungerThreshold _currentHungerThreshold;
|
|
|
|
|
public override HungerThreshold CurrentHungerThreshold => _currentHungerThreshold;
|
|
|
|
|
|
|
|
|
|
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
|
|
|
|
{
|
2020-11-26 14:33:31 +01:00
|
|
|
base.HandleComponentState(curState, nextState);
|
|
|
|
|
|
|
|
|
|
if (curState is not HungerComponentState hunger)
|
2020-06-24 02:21:20 +02:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_currentHungerThreshold = hunger.CurrentThreshold;
|
|
|
|
|
|
2021-12-07 21:54:00 +11:00
|
|
|
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
|
2020-06-24 02:21:20 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|