drawers icon indicating copy to clipboard operation
drawers copied to clipboard

Please add support for pipeworks injectors

Open cplir-c opened this issue 5 years ago • 11 comments

The only way I can think of to automatically retrieve items from drawers is by breaking the drawer and having all the items fall out. This is too hard on the server for drawers with tens of thousands of items, and would almost certainly break the vacuum pipes.

I'd like to be able to use injectors on drawers directly, and if possible on a drawer controller too.

Alternatively, and maybe this would be harder, but if a node breaker is trying to break a drawer from the front it could act like a player punching it?

This would be very useful for automatic storage systems so I don't need to use 12 technic gold chests to store my items instead of 1 diamond upgraded drawer.

Thank you!

EDIT: On the to-do checklist you said that pipeworks support was added, and injectors are part of pipeworks. That is why I expected them to work with drawers.

cplir-c avatar May 03 '19 19:05 cplir-c

This won't be a problem with the 1x1 drawers as it is clear which item you want to extract with the injector. But what about the 2x2 or 4x4 drawers: which item do you want to get? The simplest solution here would be a round-robin over the 2 or 4 drawer items...

thomasrudin avatar Jan 06 '20 14:01 thomasrudin

You could extract an item based on the side you're pulling from (e.g. left side might be upper left item, down might be lower left ...)

cplir-c avatar Jan 06 '20 15:01 cplir-c

You could extract an item based on the side you're pulling from (e.g. left side might be upper left item, down might be lower left ...)

Yes, but then, items will need to be injected the same way you add them, right?

6r1d avatar Feb 27 '20 09:02 6r1d

It would be enough if drawer provided inventory that pipeworks can check, then you could use pipeworks filter injector's filter part to get item that you want to get. That would also work with digiline injector and would work from any side. And that would also provide configurable rotation through normal filter injector interface.

It is just that pipeworks want to look at inventory unless you're gonna build special compatibility layer for injectors.

But I think that would be best option, there 1x1 drawer would have 1 slot inventory (replenished automatically until drawer is empty) and 2x2 would 4 slot inventory, any size goes just add slots as needed and keep 1 itemstack in each slot as long as there's items left in drawer.

Inventory would of course actually be hidden and not directly accessible via formspec, just for injectors to look at.

S-S-X avatar Jun 24 '20 23:06 S-S-X

replenished automatically until drawer is empty

If injector / any related way to get item by pipeworks has a callback and timers are not required, this is perfect!

6r1d avatar Jun 25 '20 07:06 6r1d

If injector / any related way to get item by pipeworks has a callback

Injectors do have enough callbacks for this (both before and after filter action)

So it could, for example, do it this way:

  • tube.before_filter
    • add items to inventory slots, max stack size that is available and fits in (fill partial stacks if possible)
  • tube.after_filter
    • restore stack to drawer storage (taking it away from inventory) if nothing was taken

There's other options too, just need to find best way/moment to take items from drawer storage and to put items into inventory.

Then stack should be restored to drawer storage if filter does not find itemstack it wants and takes nothing, like if you have ice blocks in filter and drawer only has cobble left then inventory is empty and injector cant take anything but as drawer does not know about the fact that filter injector want ice it had to replenish cobble stack in inventory and remove it from drawer storage.

So there's these situations that need some good solutions, preferably with minimal inventory transfers if possible. One option is to keep stuff in inventory until someone punches drawer and then check if inventory slot has anything left, move items from inventory to drawer. But that approach would also need another update: when drawer is digged and items drop it should also drop items from inventory.

S-S-X avatar Jun 25 '20 07:06 S-S-X

Cool, so it's perfectly possible to implement

6r1d avatar Jun 25 '20 11:06 6r1d

Has this become irrelevant with digiline support having been added? Are mesecon injectors really needed?

SwissalpS avatar Oct 07 '20 06:10 SwissalpS

Has this become irrelevant with digiline support having been added? Are mesecon injectors really needed?

Not completely irrelevant but most probably not needed. Digilines is optional dependency for drawers and pipeworks and it is possible to have pipeworks and drawers without digilines. For setup like that it could be useful to allow using injectors to take items out by punching without digilines but not sure if all required extra code and complexity is worth it.

S-S-X avatar Oct 07 '20 14:10 S-S-X

Digilines? That makes it require no injector, at all.

The4codeblocks avatar Nov 03 '22 19:11 The4codeblocks

Digilines? That makes it require no injector, at all.

There is already drawer controller that works with digilines. Last comment was about situation where server does not have digilines mod installed at all so no digilines available. That is unlikely situation and I wouldn't support it unless explicitly requested.

S-S-X avatar Nov 03 '22 20:11 S-S-X