diff --git a/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs index 7f477619a4..4f3e2b2cb5 100644 --- a/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -176,8 +176,12 @@ namespace Content.Client.Atmos.EntitySystems var frameCount = FrameCounter[i]; Timer[i] += frameTime; - if (!(Timer[i] >= delays[frameCount])) continue; - Timer[i] = 0f; + var time = delays[frameCount]; + + if (Timer[i] < time) + continue; + + Timer[i] -= time; FrameCounter[i] = (frameCount + 1) % Frames[i].Length; } @@ -188,8 +192,10 @@ namespace Content.Client.Atmos.EntitySystems var frameCount = FireFrameCounter[i]; FireTimer[i] += frameTime; - if (!(FireTimer[i] >= delays[frameCount])) continue; - FireTimer[i] = 0f; + var time = delays[frameCount]; + + if (FireTimer[i] < time) continue; + FireTimer[i] -= time; FireFrameCounter[i] = (frameCount + 1) % FireFrames[i].Length; } } diff --git a/Content.Client/DragDrop/DragDropSystem.cs b/Content.Client/DragDrop/DragDropSystem.cs index f362f2a778..e400f0504d 100644 --- a/Content.Client/DragDrop/DragDropSystem.cs +++ b/Content.Client/DragDrop/DragDropSystem.cs @@ -243,7 +243,7 @@ namespace Content.Client.DragDrop if (_targetRecheckTime > TargetRecheckInterval) { HighlightTargets(); - _targetRecheckTime = 0; + _targetRecheckTime -= TargetRecheckInterval; } return true; diff --git a/Content.Server/Administration/Logs/AdminLogSystem.cs b/Content.Server/Administration/Logs/AdminLogSystem.cs index 9b4c114065..cc3b3181b6 100644 --- a/Content.Server/Administration/Logs/AdminLogSystem.cs +++ b/Content.Server/Administration/Logs/AdminLogSystem.cs @@ -182,7 +182,7 @@ public sealed partial class AdminLogSystem : SharedAdminLogSystem private async Task SaveLogs() { - _accumulatedFrameTime = 0; + _accumulatedFrameTime = 0f; // TODO ADMIN LOGS array pool var copy = new List(_logQueue.Count + _preRoundLogQueue.Count); diff --git a/Content.Server/Animals/Systems/UdderSystem.cs b/Content.Server/Animals/Systems/UdderSystem.cs index 758f8f6dd6..76255f4733 100644 --- a/Content.Server/Animals/Systems/UdderSystem.cs +++ b/Content.Server/Animals/Systems/UdderSystem.cs @@ -37,25 +37,28 @@ namespace Content.Server.Animals.Systems { udder.AccumulatedFrameTime += frameTime; - if (udder.AccumulatedFrameTime < udder.UpdateRate) - continue; - - // Actually there is food digestion so no problem with instant reagent generation "OnFeed" - if (EntityManager.TryGetComponent(udder.Owner, out var hunger)) + while (udder.AccumulatedFrameTime > udder.UpdateRate) { - hunger.HungerThresholds.TryGetValue(HungerThreshold.Peckish, out var targetThreshold); + udder.AccumulatedFrameTime -= udder.UpdateRate; - // Is there enough nutrition to produce reagent? - if (hunger.CurrentHunger < targetThreshold) + // Actually there is food digestion so no problem with instant reagent generation "OnFeed" + if (EntityManager.TryGetComponent(udder.Owner, out var hunger)) + { + hunger.HungerThresholds.TryGetValue(HungerThreshold.Peckish, out var targetThreshold); + + // Is there enough nutrition to produce reagent? + if (hunger.CurrentHunger < targetThreshold) + continue; + } + + if (!_solutionContainerSystem.TryGetSolution(udder.Owner, udder.TargetSolutionName, + out var solution)) continue; + + //TODO: toxins from bloodstream !? + _solutionContainerSystem.TryAddReagent(udder.Owner, solution, udder.ReagentId, + udder.QuantityPerUpdate, out var accepted); } - - if (!_solutionContainerSystem.TryGetSolution(udder.Owner, udder.TargetSolutionName, out var solution)) - continue; - - //TODO: toxins from bloodstream !? - _solutionContainerSystem.TryAddReagent(udder.Owner, solution, udder.ReagentId, udder.QuantityPerUpdate, out var accepted); - udder.AccumulatedFrameTime = 0; } } diff --git a/Content.Server/Botany/Systems/BotanySystem.Plant.cs b/Content.Server/Botany/Systems/BotanySystem.Plant.cs index 343c94e53d..dcf14ed354 100644 --- a/Content.Server/Botany/Systems/BotanySystem.Plant.cs +++ b/Content.Server/Botany/Systems/BotanySystem.Plant.cs @@ -72,7 +72,7 @@ namespace Content.Server.Botany.Systems if (_timer < 3f) return; - _timer = 0f; + _timer -= 3f; foreach (var plantHolder in EntityManager.EntityQuery()) { diff --git a/Content.Server/Nutrition/EntitySystems/HungerSystem.cs b/Content.Server/Nutrition/EntitySystems/HungerSystem.cs index 5d2bf0cf6d..215cbc56d4 100644 --- a/Content.Server/Nutrition/EntitySystems/HungerSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/HungerSystem.cs @@ -19,7 +19,8 @@ namespace Content.Server.Nutrition.EntitySystems { comp.OnUpdate(_accumulatedFrameTime); } - _accumulatedFrameTime = 0; + + _accumulatedFrameTime -= 1; } } }