Adjust some frametiming stuff (#6496)

This commit is contained in:
metalgearsloth
2022-03-01 01:11:25 +11:00
committed by GitHub
parent eeef210ae4
commit ffed5eec81
6 changed files with 33 additions and 23 deletions

View File

@@ -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;
}
}

View File

@@ -243,7 +243,7 @@ namespace Content.Client.DragDrop
if (_targetRecheckTime > TargetRecheckInterval)
{
HighlightTargets();
_targetRecheckTime = 0;
_targetRecheckTime -= TargetRecheckInterval;
}
return true;

View File

@@ -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<QueuedLog>(_logQueue.Count + _preRoundLogQueue.Count);

View File

@@ -37,8 +37,9 @@ namespace Content.Server.Animals.Systems
{
udder.AccumulatedFrameTime += frameTime;
if (udder.AccumulatedFrameTime < udder.UpdateRate)
continue;
while (udder.AccumulatedFrameTime > udder.UpdateRate)
{
udder.AccumulatedFrameTime -= udder.UpdateRate;
// Actually there is food digestion so no problem with instant reagent generation "OnFeed"
if (EntityManager.TryGetComponent<HungerComponent?>(udder.Owner, out var hunger))
@@ -50,12 +51,14 @@ namespace Content.Server.Animals.Systems
continue;
}
if (!_solutionContainerSystem.TryGetSolution(udder.Owner, udder.TargetSolutionName, out var solution))
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;
_solutionContainerSystem.TryAddReagent(udder.Owner, solution, udder.ReagentId,
udder.QuantityPerUpdate, out var accepted);
}
}
}

View File

@@ -72,7 +72,7 @@ namespace Content.Server.Botany.Systems
if (_timer < 3f)
return;
_timer = 0f;
_timer -= 3f;
foreach (var plantHolder in EntityManager.EntityQuery<PlantHolderComponent>())
{

View File

@@ -19,7 +19,8 @@ namespace Content.Server.Nutrition.EntitySystems
{
comp.OnUpdate(_accumulatedFrameTime);
}
_accumulatedFrameTime = 0;
_accumulatedFrameTime -= 1;
}
}
}