using Content.Server.GameObjects.Components.Nutrition; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; namespace Content.Server.Interfaces.GameObjects.Components.Interaction { /// /// Triggers digestion updates on /// [UsedImplicitly] public class StomachSystem : EntitySystem { private float _accumulatedFrameTime; public override void Initialize() { EntityQuery = new TypeEntityQuery(typeof(StomachComponent)); } public override void Update(float frameTime) { //Update at most once per second _accumulatedFrameTime += frameTime; if (_accumulatedFrameTime > 1.0f) { foreach (var entity in RelevantEntities) { var comp = entity.GetComponent(); comp.OnUpdate(_accumulatedFrameTime); } _accumulatedFrameTime = 0.0f; } } } }