This repository has been archived by the owner on Aug 26, 2021. It is now read-only.
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.
Additional item transfer function #230
Labels
enhancement
An improvement to an existing feature, or a new one
Explanation:
This suggestion is for a function that acts like a sort of combination between
inventory.pushItems
andinventory.pullItems
. It would be defined (in the lua docs) as something like this (with the current name for the function being "pu:How it works:
First checks to see if
toSlot
has an items in it. If it is full, the function returns immediately. It might be easiest to just use the metadata value ofmaxCount
but that would be problematic for Black Hole Units and Black Hole Controllers from Industrial Foregoing.Next, the function should look through the inventory specified by
fromName
, and essentially do the equivalent of callingpullItems
on each non-empty slot untiltoSlot
is at capacity. If an item already exists intoSlot
or an item is placed there (but the slot is not full) then the equivalent of doingpullItems
should only be done for slots that actually have the specific item.The function will finally return the number of items moved.
Uses:
The only one I can think of at the moment is inventory compression, making it so that partial itemstacks across chests are easily merged together, reducing the total number of slots used. I'm finding this difficult to do efficiently with just
pushItems
andpullItems
.The text was updated successfully, but these errors were encountered: