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

@@ -1,27 +1,13 @@
using Content.Server.GameObjects.Components.Interactable;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Content.Server.GameObjects.EntitySystems
{
class RadioSystem : EntitySystem
internal sealed class RadioSystem : EntitySystem
{
private List<string> _messages;
public override void Initialize()
{
base.Initialize();
EntityQuery = new TypeEntityQuery(typeof(RadioComponent));
_messages = new List<string>();
}
private readonly List<string> _messages = new List<string>();
public void SpreadMessage(IEntity source, string message)
{
@@ -32,10 +18,9 @@ namespace Content.Server.GameObjects.EntitySystems
_messages.Add(message);
foreach (var radioEntity in RelevantEntities)
foreach (var radio in ComponentManager.EntityQuery<RadioComponent>())
{
var radio = radioEntity.GetComponent<RadioComponent>();
if (radioEntity == source || !radio.RadioOn)
if (radio.Owner == source || !radio.RadioOn)
{
continue;
}