Make item size scale with stack size (#17623)
* Make stack count affect item size * and the test, too * readd this check * vwoom * huh * if you ever read this commit message ping me on discord in #contributors * changerinos
This commit is contained in:
@@ -2,6 +2,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Popups;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameStates;
|
||||
@@ -19,11 +20,11 @@ namespace Content.Shared.Stacks
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly IViewVariablesManager _vvm = default!;
|
||||
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
||||
[Dependency] protected readonly SharedHandsSystem HandsSystem = default!;
|
||||
[Dependency] protected readonly SharedHandsSystem Hands = default!;
|
||||
[Dependency] protected readonly SharedTransformSystem Xform = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] protected readonly SharedPopupSystem PopupSystem = default!;
|
||||
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -75,18 +76,18 @@ namespace Content.Shared.Stacks
|
||||
switch (transfered)
|
||||
{
|
||||
case > 0:
|
||||
PopupSystem.PopupCoordinates($"+{transfered}", popupPos, Filter.Local(), false);
|
||||
Popup.PopupCoordinates($"+{transfered}", popupPos, Filter.Local(), false);
|
||||
|
||||
if (GetAvailableSpace(recipientStack) == 0)
|
||||
{
|
||||
PopupSystem.PopupCoordinates(Loc.GetString("comp-stack-becomes-full"),
|
||||
Popup.PopupCoordinates(Loc.GetString("comp-stack-becomes-full"),
|
||||
popupPos.Offset(new Vector2(0, -0.5f)), Filter.Local(), false);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 0 when GetAvailableSpace(recipientStack) == 0:
|
||||
PopupSystem.PopupCoordinates(Loc.GetString("comp-stack-already-full"), popupPos, Filter.Local(), false);
|
||||
Popup.PopupCoordinates(Loc.GetString("comp-stack-already-full"), popupPos, Filter.Local(), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -133,12 +134,12 @@ namespace Content.Shared.Stacks
|
||||
if (!Resolve(item, ref itemStack, false))
|
||||
{
|
||||
// This isn't even a stack. Just try to pickup as normal.
|
||||
HandsSystem.PickupOrDrop(user, item, handsComp: hands);
|
||||
Hands.PickupOrDrop(user, item, handsComp: hands);
|
||||
return;
|
||||
}
|
||||
|
||||
// This is shit code until hands get fixed and give an easy way to enumerate over items, starting with the currently active item.
|
||||
foreach (var held in HandsSystem.EnumerateHeld(user, hands))
|
||||
foreach (var held in Hands.EnumerateHeld(user, hands))
|
||||
{
|
||||
TryMergeStacks(item, held, out _, donorStack: itemStack);
|
||||
|
||||
@@ -146,7 +147,7 @@ namespace Content.Shared.Stacks
|
||||
return;
|
||||
}
|
||||
|
||||
HandsSystem.PickupOrDrop(user, item, handsComp: hands);
|
||||
Hands.PickupOrDrop(user, item, handsComp: hands);
|
||||
}
|
||||
|
||||
public virtual void SetCount(EntityUid uid, int amount, StackComponent? component = null)
|
||||
|
||||
Reference in New Issue
Block a user