Enable nullability in Content.Client (#3257)

* Enable nullability in Content.Client

* Remove #nullable enable

* Merge fixes

* Remove Debug.Assert

* Merge fixes

* Fix build

* Fix build
This commit is contained in:
DrSmugleaf
2021-03-10 14:48:29 +01:00
committed by GitHub
parent 4f9bd4e802
commit 902aa128c2
270 changed files with 1774 additions and 1550 deletions

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalRouterComponent;

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalTaggerComponent;

View File

@@ -1,5 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalUnitComponent;

View File

@@ -15,36 +15,36 @@ namespace Content.Client.GameObjects.Components.Disposal
private const string AnimationKey = "disposal_unit_animation";
[DataField("state_anchored", required: true)]
private string _stateAnchored;
private string? _stateAnchored;
[DataField("state_unanchored", required: true)]
private string _stateUnAnchored;
private string? _stateUnAnchored;
[DataField("state_charging", required: true)]
private string _stateCharging;
private string? _stateCharging;
[DataField("overlay_charging", required: true)]
private string _overlayCharging;
private string? _overlayCharging;
[DataField("overlay_ready", required: true)]
private string _overlayReady;
private string? _overlayReady;
[DataField("overlay_full", required: true)]
private string _overlayFull;
private string? _overlayFull;
[DataField("overlay_engaged", required: true)]
private string _overlayEngaged;
private string? _overlayEngaged;
[DataField("state_flush", required: true)]
private string _stateFlush;
private string? _stateFlush;
[DataField("flush_sound", required: true)]
private string _flushSound;
private string? _flushSound;
[DataField("flush_time", required: true)]
private float _flushTime;
private Animation _flushAnimation;
private Animation _flushAnimation = default!;
void ISerializationHooks.AfterDeserialization()
{
@@ -57,7 +57,11 @@ namespace Content.Client.GameObjects.Components.Disposal
var sound = new AnimationTrackPlaySound();
_flushAnimation.AnimationTracks.Add(sound);
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound, 0));
if (_flushSound != null)
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound, 0));
}
}
private void ChangeState(AppearanceComponent appearance)
@@ -67,7 +71,7 @@ namespace Content.Client.GameObjects.Components.Disposal
return;
}
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
{
return;
}

View File

@@ -4,8 +4,6 @@ using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Disposal
{
@@ -13,15 +11,17 @@ namespace Content.Client.GameObjects.Components.Disposal
public class DisposalVisualizer : AppearanceVisualizer
{
[DataField("state_free")]
private string _stateFree;
private string? _stateFree;
[DataField("state_anchored")]
private string _stateAnchored;
private string? _stateAnchored;
[DataField("state_broken")]
private string _stateBroken;
private string? _stateBroken;
private void ChangeState(AppearanceComponent appearance)
{
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
{
return;
}