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

@@ -143,10 +143,24 @@ namespace Content.Server.GameObjects.Components.Suspicion
public override ComponentState GetComponentState(ICommonSession player)
{
return Role == null
? new SuspicionRoleComponentState(null, null, Array.Empty<(string, EntityUid)>())
: new SuspicionRoleComponentState(Role?.Name, Role?.Antagonist,
_allies.Select(a => (a.Role!.Mind.CharacterName, a.Owner.Uid)).ToArray());
if (Role == null)
{
return new SuspicionRoleComponentState(null, null, Array.Empty<(string, EntityUid)>());
}
var allies = new List<(string name, EntityUid)>();
foreach (var role in _allies)
{
if (role.Role?.Mind.CharacterName == null)
{
continue;
}
allies.Add((role.Role!.Mind.CharacterName, role.Owner.Uid));
}
return new SuspicionRoleComponentState(Role?.Name, Role?.Antagonist, allies.ToArray());
}
public override void HandleMessage(ComponentMessage message, IComponent? component)