* 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>
35 lines
911 B
C#
35 lines
911 B
C#
using Content.Server.GameObjects.Components.Interactable;
|
|
using Robust.Shared.GameObjects.Systems;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
|
{
|
|
internal sealed class RadioSystem : EntitySystem
|
|
{
|
|
private readonly List<string> _messages = new List<string>();
|
|
|
|
public void SpreadMessage(IEntity source, string message)
|
|
{
|
|
if (_messages.Contains(message))
|
|
{
|
|
return;
|
|
}
|
|
|
|
_messages.Add(message);
|
|
|
|
foreach (var radio in ComponentManager.EntityQuery<RadioComponent>())
|
|
{
|
|
if (radio.Owner == source || !radio.RadioOn)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
radio.Speaker(message);
|
|
}
|
|
|
|
_messages.Remove(message);
|
|
}
|
|
}
|
|
}
|