2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Movement.Components;
|
|
|
|
|
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]
|
|
|
|
|
public class ThirstComponent : SharedThirstComponent
|
|
|
|
|
{
|
|
|
|
|
private ThirstThreshold _currentThirstThreshold;
|
|
|
|
|
public override ThirstThreshold CurrentThirstThreshold => _currentThirstThreshold;
|
|
|
|
|
|
|
|
|
|
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
|
|
|
|
{
|
2020-11-26 14:33:31 +01:00
|
|
|
base.HandleComponentState(curState, nextState);
|
|
|
|
|
|
|
|
|
|
if (curState is not ThirstComponentState thirst)
|
2020-06-24 02:21:20 +02:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_currentThirstThreshold = thirst.CurrentThreshold;
|
|
|
|
|
|
2020-08-20 16:48:00 +02:00
|
|
|
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement))
|
2020-06-24 02:21:20 +02:00
|
|
|
{
|
|
|
|
|
movement.RefreshMovementSpeedModifiers();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|