Make ItemCabinet use ItemSlots (#4771)

* pda slot names

* cabinets use item slots

* fix yaml

* fix tests
This commit is contained in:
Leon Friedrich
2021-10-06 08:55:45 +11:00
committed by GitHub
parent d2748d1e59
commit 6f50dd2f7b
14 changed files with 164 additions and 277 deletions

View File

@@ -2,6 +2,7 @@ using Content.Shared.Sound;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -31,9 +32,23 @@ namespace Content.Shared.Containers.ItemSlots
[ViewVariables] [DataField("insertSound")] public SoundSpecifier? InsertSound;
[ViewVariables] [DataField("ejectSound")] public SoundSpecifier? EjectSound;
/// <summary>
/// The name of this item slot. This will be shown to the user in the verb menu.
/// </summary>
[ViewVariables] public string Name
{
get => _name != string.Empty
? Loc.GetString(_name)
: ContainerSlot.ContainedEntity?.Name ?? string.Empty;
set => _name = value;
}
[DataField("name")] private string _name = string.Empty;
[DataField("item", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
[ViewVariables] public string? StartingItem;
[ViewVariables] public ContainerSlot ContainerSlot = default!;
public bool HasEntity => ContainerSlot.ContainedEntity != null;
}
}