Make item slot containers nullable (#6198)

This commit is contained in:
Leon Friedrich
2022-01-18 08:22:35 +13:00
committed by GitHub
parent 167e6e5cb6
commit 5679f1e4fb
4 changed files with 21 additions and 15 deletions

View File

@@ -156,7 +156,7 @@ namespace Content.Shared.Containers.ItemSlots
public string? EjectVerbText;
[ViewVariables]
public ContainerSlot ContainerSlot = default!;
public ContainerSlot? ContainerSlot = default!;
/// <summary>
/// If this slot belongs to some de-constructible component, should the item inside the slot be ejected upon
@@ -192,10 +192,10 @@ namespace Content.Shared.Containers.ItemSlots
[DataField("swap")]
public bool Swap = true;
public string ID => ContainerSlot.ID;
public string? ID => ContainerSlot?.ID;
// Convenience properties
public bool HasItem => ContainerSlot.ContainedEntity != null;
public EntityUid? Item => ContainerSlot.ContainedEntity;
public bool HasItem => ContainerSlot?.ContainedEntity != null;
public EntityUid? Item => ContainerSlot?.ContainedEntity;
}
}