Enable nullability in Content.Server (#3685)

This commit is contained in:
DrSmugleaf
2021-03-16 15:50:20 +01:00
committed by GitHub
parent 90fec0ed24
commit a5ade526b7
306 changed files with 1616 additions and 1441 deletions

View File

@@ -12,14 +12,7 @@ namespace Content.Server.GameObjects.EntitySystems
{
public class SignalLinkerSystem : EntitySystem
{
private Dictionary<NetUserId, SignalTransmitterComponent> _transmitters;
public override void Initialize()
{
base.Initialize();
_transmitters = new Dictionary<NetUserId, SignalTransmitterComponent>();
}
private readonly Dictionary<NetUserId, SignalTransmitterComponent?> _transmitters = new();
public bool SignalLinkerKeybind(NetUserId id, bool? enable)
{
@@ -35,7 +28,9 @@ namespace Content.Server.GameObjects.EntitySystems
if (_transmitters.Count == 0)
{
CommandBinds.Builder
.BindBefore(EngineKeyFunctions.Use, new PointerInputCmdHandler(HandleUse), typeof(InteractionSystem))
.BindBefore(EngineKeyFunctions.Use,
new PointerInputCmdHandler(HandleUse),
typeof(InteractionSystem))
.Register<SignalLinkerSystem>();
}
@@ -59,8 +54,13 @@ namespace Content.Server.GameObjects.EntitySystems
return enable.Value;
}
private bool HandleUse(ICommonSession session, EntityCoordinates coords, EntityUid uid)
private bool HandleUse(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
if (session?.AttachedEntity == null)
{
return false;
}
if (!_transmitters.TryGetValue(session.UserId, out var signalTransmitter))
{
return false;
@@ -88,6 +88,5 @@ namespace Content.Server.GameObjects.EntitySystems
return false;
}
}
}