Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -158,6 +158,11 @@ namespace Content.Server.GameObjects.Components.Observer
|
||||
var warpName = new List<string>();
|
||||
foreach (var point in warpPoints)
|
||||
{
|
||||
if (point.Location == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
warpName.Add(point.Location);
|
||||
}
|
||||
SendNetworkMessage(new GhostReplyWarpPointData(warpName));
|
||||
|
||||
@@ -6,6 +6,7 @@ using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Observer.GhostRoles
|
||||
@@ -33,7 +34,7 @@ namespace Content.Server.GameObjects.Components.Observer.GhostRoles
|
||||
[CanBeNull]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("prototype")]
|
||||
public string Prototype { get; private set; }
|
||||
public string? Prototype { get; private set; }
|
||||
|
||||
public override bool Take(IPlayerSession session)
|
||||
{
|
||||
@@ -50,7 +51,11 @@ namespace Content.Server.GameObjects.Components.Observer.GhostRoles
|
||||
|
||||
mob.EnsureComponent<MindComponent>();
|
||||
|
||||
session.ContentData().Mind.TransferTo(mob);
|
||||
var mind = session.ContentData()?.Mind;
|
||||
|
||||
DebugTools.AssertNotNull(mind);
|
||||
|
||||
mind!.TransferTo(mob);
|
||||
|
||||
if (++_currentTakeovers < _availableTakeovers) return true;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Observer.GhostRoles
|
||||
{
|
||||
@@ -24,10 +25,14 @@ namespace Content.Server.GameObjects.Components.Observer.GhostRoles
|
||||
|
||||
var mind = Owner.EnsureComponent<MindComponent>();
|
||||
|
||||
if(mind.HasMind)
|
||||
if (mind.HasMind)
|
||||
throw new Exception("MindComponent already has a mind!");
|
||||
|
||||
session.ContentData().Mind.TransferTo(Owner);
|
||||
var sessionMind = session.ContentData()?.Mind;
|
||||
|
||||
DebugTools.AssertNotNull(sessionMind);
|
||||
|
||||
sessionMind!.TransferTo(Owner);
|
||||
|
||||
EntitySystem.Get<GhostRoleSystem>().UnregisterGhostRole(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user