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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user