Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user