Re-organize all projects (#4166)
This commit is contained in:
30
Content.Client/Nutrition/Components/HungerComponent.cs
Normal file
30
Content.Client/Nutrition/Components/HungerComponent.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Nutrition.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class HungerComponent : SharedHungerComponent
|
||||
{
|
||||
private HungerThreshold _currentHungerThreshold;
|
||||
public override HungerThreshold CurrentHungerThreshold => _currentHungerThreshold;
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
if (curState is not HungerComponentState hunger)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_currentHungerThreshold = hunger.CurrentThreshold;
|
||||
|
||||
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement))
|
||||
{
|
||||
movement.RefreshMovementSpeedModifiers();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user