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

@@ -6,6 +6,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using static Content.Shared.GameObjects.Components.Doors.SharedDoorComponent;
namespace Content.Server.Construction.Conditions
{
@@ -17,15 +18,15 @@ namespace Content.Server.Construction.Conditions
public async Task<bool> Condition(IEntity entity)
{
if (!entity.TryGetComponent(out ServerDoorComponent doorComponent)) return false;
if (!entity.TryGetComponent(out ServerDoorComponent? doorComponent)) return false;
return doorComponent.IsWeldedShut == Welded;
}
public bool DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange)
{
if (!entity.TryGetComponent(out ServerDoorComponent doorComponent)) return false;
if (!entity.TryGetComponent(out ServerDoorComponent? doorComponent)) return false;
if (doorComponent.State == ServerDoorComponent.DoorState.Closed && Welded)
if (doorComponent.State == DoorState.Closed && Welded)
{
message.AddMarkup(Loc.GetString("First, weld the door.\n"));
return true;

View File

@@ -2,9 +2,8 @@
using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Physics;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
namespace Content.Server.Construction.Conditions
@@ -17,14 +16,14 @@ namespace Content.Server.Construction.Conditions
public async Task<bool> Condition(IEntity entity)
{
if (!entity.TryGetComponent(out IPhysBody physics)) return false;
if (!entity.TryGetComponent(out IPhysBody? physics)) return false;
return (physics.BodyType == BodyType.Static && Anchored) || (physics.BodyType != BodyType.Static && !Anchored);
}
public bool DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange)
{
if (!entity.TryGetComponent(out IPhysBody physics)) return false;
if (!entity.TryGetComponent(out IPhysBody? physics)) return false;
switch (Anchored)
{

View File

@@ -17,14 +17,14 @@ namespace Content.Server.Construction.Conditions
public async Task<bool> Condition(IEntity entity)
{
if (!entity.TryGetComponent(out WiresComponent wires)) return false;
if (!entity.TryGetComponent(out WiresComponent? wires)) return false;
return wires.IsPanelOpen == Open;
}
public bool DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange)
{
if (!entity.TryGetComponent(out WiresComponent wires)) return false;
if (!entity.TryGetComponent(out WiresComponent? wires)) return false;
switch (Open)
{