mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
# Description
I got baited by Ectoplasm, so I then spent 3 hours shaving off a
sizeable chunk of this game's performance cost, including by taking 3 of
the "Top 10 frametime consumers", and reducing their performance costs
by 99% each. Along with various examples of slimming down some of the
worst EQE's.
Oh, and I fixed EmitSoundOnMove being desynced with actual movement. As
part of making EmitSoundOnMove use 99% less CPU time, it was also
synchronized with the MoverController.
# Changelog
🆑
- fix: Fixed items such as tactical webbing, bell collars, and hardsuits
being desynced with character movement.
- tweak: Made various large performance improvements.
(cherry picked from commit 684e8175443167beb0e20e3323a05b5f493b3374)
50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using Content.Server.Chemistry.Components;
|
|
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Chemistry.Components.SolutionManager;
|
|
using Content.Shared.Chemistry.EntitySystems;
|
|
using Content.Shared.FixedPoint;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Server.Chemistry.EntitySystems;
|
|
|
|
public sealed class SolutionRegenerationSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
var query = EntityQueryEnumerator<SolutionRegenerationComponent>();
|
|
while (query.MoveNext(out var uid, out var regen))
|
|
{
|
|
if (_timing.CurTime < regen.NextRegenTime
|
|
|| !TryComp(uid, out SolutionContainerManagerComponent? manager))
|
|
continue;
|
|
|
|
// timer ignores if its full, it's just a fixed cycle
|
|
regen.NextRegenTime = _timing.CurTime + regen.Duration;
|
|
if (_solutionContainer.ResolveSolution((uid, manager), regen.SolutionName, ref regen.SolutionRef, out var solution))
|
|
{
|
|
var amount = FixedPoint2.Min(solution.AvailableVolume, regen.Generated.Volume);
|
|
if (amount <= FixedPoint2.Zero)
|
|
continue;
|
|
|
|
// dont bother cloning and splitting if adding the whole thing
|
|
Solution generated;
|
|
if (amount == regen.Generated.Volume)
|
|
{
|
|
generated = regen.Generated;
|
|
}
|
|
else
|
|
{
|
|
generated = regen.Generated.Clone().SplitSolution(amount);
|
|
}
|
|
|
|
_solutionContainer.TryAddSolution(regen.SolutionRef.Value, generated);
|
|
}
|
|
}
|
|
}
|
|
}
|