* Server EntitySystem cleanup I went after low-hanging fruit systems. * Add / change to internal access modifiers to systems * Use EntityQuery to get components instead * Add sealed modifier to systems * Remove unused imports * Add jetbrains annotation for unused classes * Removed some pragmas for dependencies This should also fix a decent chunk of the server build warnings, at least the ones that matter. * Also disposals * Update Content.Server/GameObjects/EntitySystems/GravitySystem.cs * Fix build Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using Content.Server.GameObjects.Components.Mobs;
|
|
using Content.Shared.GameObjects.Components.Mobs;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects.Systems;
|
|
using Robust.Shared.Interfaces.Timing;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
|
{
|
|
[UsedImplicitly]
|
|
internal sealed class TimedOverlayRemovalSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
foreach (var component in ComponentManager.EntityQuery<ServerOverlayEffectsComponent>())
|
|
{
|
|
|
|
foreach (var overlay in component.ActiveOverlays.ToArray())
|
|
{
|
|
if (overlay.TryGetOverlayParameter<TimedOverlayParameter>(out var parameter))
|
|
{
|
|
if (parameter.StartedAt + parameter.Length <= _gameTiming.CurTime.TotalMilliseconds)
|
|
{
|
|
component.RemoveOverlay(overlay);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|