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:
@@ -1,5 +1,7 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using System.Diagnostics;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
@@ -12,7 +14,8 @@ namespace Content.Client.GameObjects.Components
|
||||
[RegisterComponent]
|
||||
public sealed class SubFloorHideComponent : Component
|
||||
{
|
||||
private SnapGridComponent _snapGridComponent;
|
||||
[ComponentDependency(nameof(OnAddSnapGrid))]
|
||||
private SnapGridComponent? _snapGridComponent;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Name => "SubFloorHide";
|
||||
@@ -30,7 +33,6 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
_snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged;
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new SubFloorHideDirtyEvent(Owner));
|
||||
}
|
||||
|
||||
@@ -39,13 +41,23 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
if(Owner.Transform.Running == false)
|
||||
if (Owner.Transform.Running == false)
|
||||
return;
|
||||
|
||||
_snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged;
|
||||
if (_snapGridComponent != null)
|
||||
{
|
||||
_snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged;
|
||||
}
|
||||
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new SubFloorHideDirtyEvent(Owner));
|
||||
}
|
||||
|
||||
private void OnAddSnapGrid()
|
||||
{
|
||||
DebugTools.AssertNotNull(_snapGridComponent);
|
||||
_snapGridComponent!.OnPositionChanged += SnapGridOnPositionChanged;
|
||||
}
|
||||
|
||||
private void SnapGridOnPositionChanged()
|
||||
{
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new SubFloorHideDirtyEvent(Owner));
|
||||
|
||||
Reference in New Issue
Block a user