* 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
32 lines
935 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|