Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/StomachSystem.cs
DrSmugleaf 4a8ed41e3a Fix namespaces and optimize imports (#1651)
* Fix namespaces and optimize imports

* Cleanup fixes

* Merge conflict fixes

* Merge conflict fixes

* Merge conflict fixes
2020-08-13 14:40:27 +02:00

30 lines
906 B
C#

using Content.Server.GameObjects.Components.Nutrition;
using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
{
/// <summary>
/// Triggers digestion updates on <see cref="StomachComponent"/>
/// </summary>
[UsedImplicitly]
internal sealed class StomachSystem : EntitySystem
{
private float _accumulatedFrameTime;
public override void Update(float frameTime)
{
//Update at most once per second
_accumulatedFrameTime += frameTime;
if (_accumulatedFrameTime > 1.0f)
{
foreach (var component in ComponentManager.EntityQuery<StomachComponent>())
{
component.OnUpdate(_accumulatedFrameTime);
}
_accumulatedFrameTime -= 1.0f;
}
}
}
}