Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -46,7 +46,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (canReturn)
|
||||
{
|
||||
ghost.Name = mind.CharacterName;
|
||||
ghost.Name = mind.CharacterName ?? string.Empty;
|
||||
mind.Visit(ghost);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -7,6 +7,7 @@ using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
@@ -33,7 +34,6 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
|
||||
|
||||
var mind = player.ContentData().Mind;
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!int.TryParse(args[0], out var targetId))
|
||||
@@ -51,20 +51,25 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
|
||||
var target = entityManager.GetEntity(eUid);
|
||||
if (!target.TryGetComponent(out MindComponent mindComponent))
|
||||
if (!target.TryGetComponent(out MindComponent? mindComponent))
|
||||
{
|
||||
shell.WriteLine(Loc.GetString("Target entity is not a mob!"));
|
||||
return;
|
||||
}
|
||||
|
||||
var oldEntity = mind.CurrentEntity;
|
||||
var mind = player.ContentData()?.Mind;
|
||||
|
||||
DebugTools.AssertNotNull(mind);
|
||||
|
||||
var oldEntity = mind!.CurrentEntity;
|
||||
|
||||
mindComponent.Mind?.TransferTo(null);
|
||||
mind.TransferTo(target);
|
||||
|
||||
if(oldEntity.HasComponent<GhostComponent>())
|
||||
oldEntity.Delete();
|
||||
DebugTools.AssertNotNull(oldEntity);
|
||||
|
||||
if (oldEntity!.HasComponent<GhostComponent>())
|
||||
oldEntity.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Content.Server.Administration.Commands
|
||||
if (found.GetGridId(entityManager) != GridId.Invalid)
|
||||
{
|
||||
player.AttachedEntity.Transform.Coordinates = found;
|
||||
if (player.AttachedEntity.TryGetComponent(out IPhysBody physics))
|
||||
if (player.AttachedEntity.TryGetComponent(out IPhysBody? physics))
|
||||
{
|
||||
physics.LinearVelocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user