Server EntitySystem cleanup (#1617)

* 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>
This commit is contained in:
metalgearsloth
2020-08-13 22:17:12 +10:00
committed by GitHub
parent f4bf71edfe
commit 619386a04a
36 changed files with 172 additions and 424 deletions

View File

@@ -24,14 +24,12 @@ using Robust.Shared.Players;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
public class PointingSystem : EntitySystem
internal sealed class PointingSystem : EntitySystem
{
#pragma warning disable 649
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
#pragma warning restore 649
private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
@@ -156,8 +154,6 @@ namespace Content.Server.GameObjects.EntitySystems
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
EntityQuery = new TypeEntityQuery(typeof(PointingArrowComponent));
CommandBinds.Builder
.Bind(ContentKeyFunctions.Point, new PointerInputCmdHandler(TryPoint))
.Register<PointingSystem>();
@@ -173,9 +169,9 @@ namespace Content.Server.GameObjects.EntitySystems
public override void Update(float frameTime)
{
foreach (var entity in RelevantEntities)
foreach (var component in ComponentManager.EntityQuery<PointingArrowComponent>())
{
entity.GetComponent<PointingArrowComponent>().Update(frameTime);
component.Update(frameTime);
}
}
}