Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/HungerSystem.cs
metalgearsloth 480d3b26c4 Make nutrition less harsh (#439)
* Make nutrition less harsh

Also fix the accumulator because why did I put that in the loop.
Decay rates decreased and made drink thirst levels same as hunger for now.

* Also fix stomach frametime accumulation
2019-11-17 02:26:31 +01:00

32 lines
935 B
C#

using Content.Server.GameObjects.Components.Nutrition;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
public class HungerSystem : EntitySystem
{
private float _accumulatedFrameTime;
public override void Initialize()
{
EntityQuery = new TypeEntityQuery(typeof(HungerComponent));
}
public override void Update(float frameTime)
{
_accumulatedFrameTime += frameTime;
if (_accumulatedFrameTime > 1.0f)
{
foreach (var entity in RelevantEntities)
{
var comp = entity.GetComponent<HungerComponent>();
comp.OnUpdate(_accumulatedFrameTime);
}
_accumulatedFrameTime = 0.0f;
}
}
}
}