Files
wwdpublic/Content.Server/CartridgeLoader/Cartridges/GlimmerMonitorCartridgeSystem.cs
VMSolidus 151e1b60a3 TCJ Makes A Rage Performance PR (#2298)
# 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)
2025-04-26 11:45:35 +03:00

44 lines
1.6 KiB
C#

using Content.Shared.CartridgeLoader;
using Content.Shared.CartridgeLoader.Cartridges;
using Content.Server.Psionics.Glimmer;
namespace Content.Server.CartridgeLoader.Cartridges;
public sealed class GlimmerMonitorCartridgeSystem : EntitySystem
{
[Dependency] private readonly CartridgeLoaderSystem? _cartridgeLoaderSystem = default!;
[Dependency] private readonly PassiveGlimmerReductionSystem _glimmerReductionSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<GlimmerMonitorCartridgeComponent, CartridgeUiReadyEvent>(OnUiReady);
SubscribeLocalEvent<GlimmerMonitorCartridgeComponent, CartridgeMessageEvent>(OnMessage);
}
/// <summary>
/// This gets called when the ui fragment needs to be updated for the first time after activating
/// </summary>
private void OnUiReady(EntityUid uid, GlimmerMonitorCartridgeComponent component, CartridgeUiReadyEvent args)
{
UpdateUiState(uid, args.Loader, component);
}
private void OnMessage(EntityUid uid, GlimmerMonitorCartridgeComponent component, CartridgeMessageEvent args)
{
if (args is not GlimmerMonitorSyncMessageEvent)
return;
UpdateUiState(uid, EntityManager.GetEntity(args.LoaderUid), component);
}
public void UpdateUiState(EntityUid uid, EntityUid loaderUid, GlimmerMonitorCartridgeComponent? component)
{
if (!Resolve(uid, ref component))
return;
var state = new GlimmerMonitorUiState(_glimmerReductionSystem.GlimmerValues);
_cartridgeLoaderSystem?.UpdateCartridgeUiState(loaderUid, state);
}
}