Convert ItemSize to prototypes (#21481)

* item sizes are prototypes

* eek
This commit is contained in:
Nemanja
2023-11-06 02:20:50 -05:00
committed by GitHub
parent 38904904d0
commit 4729024d3e
20 changed files with 213 additions and 110 deletions

View File

@@ -3,6 +3,7 @@ using Content.Shared.Containers.ItemSlots;
using Content.Shared.Item;
using Content.Shared.Toilet;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
namespace Content.Server.Storage.Components
{
@@ -19,7 +20,7 @@ namespace Content.Server.Storage.Components
/// Max item size that can be fitted into secret stash.
/// </summary>
[DataField("maxItemSize")]
public ItemSize MaxItemSize = ItemSize.Small;
public ProtoId<ItemSizePrototype> MaxItemSize = "Small";
/// <summary>
/// IC secret stash name. For example "the toilet cistern".

View File

@@ -13,6 +13,7 @@ namespace Content.Server.Storage.EntitySystems
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedItemSystem _item = default!;
public override void Initialize()
{
@@ -66,7 +67,7 @@ namespace Content.Server.Storage.EntitySystems
}
// check if item is too big to fit into secret stash
if (item.Size > component.MaxItemSize)
if (_item.GetSizePrototype(item.Size) > _item.GetSizePrototype(component.MaxItemSize))
{
var msg = Loc.GetString("comp-secret-stash-action-hide-item-too-big",
("item", itemToHideUid), ("stash", GetSecretPartName(uid, component)));