ConstructionPlacementHijack nullability fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Client.GameObjects.Components.Construction;
|
#nullable enable
|
||||||
|
using Content.Client.GameObjects.Components.Construction;
|
||||||
using Content.Client.GameObjects.EntitySystems;
|
using Content.Client.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using Robust.Client.Placement;
|
using Robust.Client.Placement;
|
||||||
@@ -11,15 +12,15 @@ namespace Content.Client.Construction
|
|||||||
public sealed class ConstructionPlacementHijack : PlacementHijack
|
public sealed class ConstructionPlacementHijack : PlacementHijack
|
||||||
{
|
{
|
||||||
private readonly ConstructionSystem _constructionSystem;
|
private readonly ConstructionSystem _constructionSystem;
|
||||||
private readonly ConstructionPrototype _prototype;
|
private readonly ConstructionPrototype? _prototype;
|
||||||
|
|
||||||
public override bool CanRotate { get; }
|
public override bool CanRotate { get; }
|
||||||
|
|
||||||
public ConstructionPlacementHijack(ConstructionSystem constructionSystem, ConstructionPrototype prototype)
|
public ConstructionPlacementHijack(ConstructionSystem constructionSystem, ConstructionPrototype? prototype)
|
||||||
{
|
{
|
||||||
_constructionSystem = constructionSystem;
|
_constructionSystem = constructionSystem;
|
||||||
_prototype = prototype;
|
_prototype = prototype;
|
||||||
CanRotate = prototype.CanRotate;
|
CanRotate = prototype?.CanRotate ?? true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -36,7 +37,7 @@ namespace Content.Client.Construction
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool HijackDeletion(IEntity entity)
|
public override bool HijackDeletion(IEntity entity)
|
||||||
{
|
{
|
||||||
if (entity.TryGetComponent(out ConstructionGhostComponent ghost))
|
if (entity.TryGetComponent(out ConstructionGhostComponent? ghost))
|
||||||
{
|
{
|
||||||
_constructionSystem.ClearGhost(ghost.GhostID);
|
_constructionSystem.ClearGhost(ghost.GhostID);
|
||||||
}
|
}
|
||||||
@@ -48,7 +49,7 @@ namespace Content.Client.Construction
|
|||||||
{
|
{
|
||||||
base.StartHijack(manager);
|
base.StartHijack(manager);
|
||||||
|
|
||||||
manager.CurrentBaseSprite = _prototype.Icon.DirFrame0();
|
manager.CurrentBaseSprite = _prototype?.Icon.DirFrame0();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user