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:
Nemanja
2023-06-25 11:44:37 -04:00
committed by GitHub
parent 0d086df2e5
commit 5c60a27c7c
39 changed files with 399 additions and 81 deletions

View File

@@ -50,13 +50,10 @@ namespace Content.Server.Stack
if (!Resolve(uid, ref stack))
return null;
if (stack.StackTypeId == null)
return null;
// Get a prototype ID to spawn the new entity. Null is also valid, although it should rarely be picked...
var prototype = _prototypeManager.TryIndex<StackPrototype>(stack.StackTypeId, out var stackType)
? stackType.Spawn
: Prototype(stack.Owner)?.ID;
: Prototype(uid)?.ID;
// Try to remove the amount of things we want to split from the original stack...
if (!Use(uid, amount, stack))
@@ -113,7 +110,7 @@ namespace Content.Server.Stack
private void OnStackAlternativeInteract(EntityUid uid, StackComponent stack, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanAccess || !args.CanInteract || args.Hands == null)
if (!args.CanAccess || !args.CanInteract || args.Hands == null || stack.Count == 1)
return;
AlternativeVerb halve = new()
@@ -158,7 +155,7 @@ namespace Content.Server.Stack
if (amount <= 0)
{
PopupSystem.PopupCursor(Loc.GetString("comp-stack-split-too-small"), userUid, PopupType.Medium);
Popup.PopupCursor(Loc.GetString("comp-stack-split-too-small"), userUid, PopupType.Medium);
return;
}
@@ -171,9 +168,9 @@ namespace Content.Server.Stack
_storage.UpdateStorageUI(container.Owner, storage);
}
HandsSystem.PickupOrDrop(userUid, split);
Hands.PickupOrDrop(userUid, split);
PopupSystem.PopupCursor(Loc.GetString("comp-stack-split"), userUid);
Popup.PopupCursor(Loc.GetString("comp-stack-split"), userUid);
}
}
}