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

@@ -11,14 +11,11 @@ using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
public class ExtinguisherCabinetComponent : Component, IInteractUsing, IInteractHand, IActivate
@@ -29,7 +26,7 @@ namespace Content.Server.GameObjects.Components
[DataField("doorSound")]
private string _doorSound = "/Audio/Machines/machine_switch.ogg";
[ViewVariables] protected ContainerSlot ItemContainer;
[ViewVariables] protected ContainerSlot ItemContainer = default!;
[ViewVariables] public string DoorSound => _doorSound;
public override void Initialize()
@@ -75,7 +72,7 @@ namespace Content.Server.GameObjects.Components
_opened = false;
ClickLatchSound();
}
else if (eventArgs.User.TryGetComponent(out HandsComponent hands))
else if (eventArgs.User.TryGetComponent(out HandsComponent? hands))
{
Owner.PopupMessage(eventArgs.User,
Loc.GetString("You take {0:extinguisherName} from the {1:cabinetName}", ItemContainer.ContainedEntity.Name, Owner.Name));
@@ -106,7 +103,7 @@ namespace Content.Server.GameObjects.Components
private void UpdateVisuals()
{
if (Owner.TryGetComponent(out AppearanceComponent appearance))
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
{
appearance.SetData(ExtinguisherCabinetVisuals.IsOpen, _opened);
appearance.SetData(ExtinguisherCabinetVisuals.ContainsExtinguisher, ItemContainer.ContainedEntity != null);