McJtyMods / XNet

Advanced item/liquid/energy/... networking
MIT License
92 stars 53 forks source link

Suggestion: Toggle to prevent partial stacks/counts from extracting #336

Open not-nocturnal opened 5 years ago

not-nocturnal commented 5 years ago

Right now, the extract function will send partial stacks (or counts) to a destination inventory if there is less than a full stack/count value in the source inventory. I don't believe this is a bug, and the current options seem to do what they're supposed to. However, when setting up automatic processing of materials, this can result in a machine being sent a number of items less than what it needs for one operation. These items will then sit in the machine and need to be manually cleared for it to be used for any other operation.

To clarify, without such a rule, if the source inventory contained 96 items, and was set to extract stacks, and keep 64 items in the source inventory, it would extract 32 items. If there is no 'keep' value present, it will simply extract everything in two operations; first one stack, then the remaining half-stack.

This applies to 'count' mode, too, and the above example can just be treated as having a 'count' of 64.

The workaround to avoid this is to use a logic rule, instead of setting a 'keep' value, with which you can ensure that there will always be enough of the item in the source inventory to extract a full stack/count; if there is less, it simply won't extract, rather than extracting a smaller amount. This logic rule will also need to be set to a value high enough to account for extraction speed, as the extraction might happen twice, or even three times during the time the logic is active. For 20 tick logic and 20 tick extract, I found 3x the 'count' to be safe number.

The workaround is quite messy and scales poorly, however. It requires a channel for every item, plus a logic channel for every four items, meaning a single network can only handle 6 items in this fashion.

A little button that toggled this behavior (above the speed setting, maybe?) would be super cool. On to only extract the exact stack/count value, or off to extract everything even if it's less than the stack/count value (the current behavior).

Edit: For a simpler solution with no UI changes, maybe just have it strictly obey the 'count' number, but extract everything when 'stack' is used.

not-nocturnal commented 5 years ago

280 Closed issue regarding this as a bug