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

@@ -14,6 +14,7 @@ using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Shared.Inventory;
@@ -23,12 +24,16 @@ public abstract partial class InventorySystem
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly INetManager _netMan = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[ValidatePrototypeId<ItemSizePrototype>]
private const string PocketableItemSize = "Small";
private void InitializeEquip()
{
//these events ensure that the client also gets its proper events raised when getting its containerstate updated
@@ -264,7 +269,9 @@ public abstract partial class InventorySystem
if (slotDefinition.DependsOn != null && !TryGetSlotEntity(target, slotDefinition.DependsOn, out _, inventory))
return false;
var fittingInPocket = slotDefinition.SlotFlags.HasFlag(SlotFlags.POCKET) && item is { Size: <= ItemSize.Small };
var fittingInPocket = slotDefinition.SlotFlags.HasFlag(SlotFlags.POCKET) &&
item != null &&
_item.GetSizePrototype(item.Size) <= _item.GetSizePrototype(PocketableItemSize);
if (clothing == null && !fittingInPocket
|| clothing != null && !clothing.Slots.HasFlag(slotDefinition.SlotFlags) && !fittingInPocket)
{