Files
tbd-station-14/Content.Shared/GameObjects/Components/Nutrition/SharedThirstComponent.cs
2020-06-24 02:21:20 +02:00

62 lines
1.6 KiB
C#

using System;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Nutrition
{
public abstract class SharedThirstComponent : Component, IMoveSpeedModifier
{
public sealed override string Name => "Thirst";
public sealed override uint? NetID => ContentNetIDs.THIRST;
public abstract ThirstThreshold CurrentThirstThreshold { get; }
float IMoveSpeedModifier.SprintSpeedModifier
{
get
{
if (CurrentThirstThreshold == ThirstThreshold.Parched)
{
return 0.25f;
}
return 1.0f;
}
}
float IMoveSpeedModifier.WalkSpeedModifier
{
get
{
if (CurrentThirstThreshold == ThirstThreshold.Parched)
{
return 0.5f;
}
return 1.0f;
}
}
[Serializable, NetSerializable]
protected sealed class ThirstComponentState : ComponentState
{
public ThirstThreshold CurrentThreshold { get; }
public ThirstComponentState(ThirstThreshold currentThreshold) : base(ContentNetIDs.THIRST)
{
CurrentThreshold = currentThreshold;
}
}
}
public enum ThirstThreshold : byte
{
// Hydrohomies
OverHydrated,
Okay,
Thirsty,
Parched,
Dead,
}
}