Modular Routers

Modular Routers

33M Downloads

Feature Request: Existing Items Filter

desagas opened this issue ยท 5 comments

commented

Minecraft Version 1.16.4

Forge Version ..13

Mod Version modular-routers-1.16.3-7.2.0-39

While the big item filters are nice, with 54 slots, and I love the shift-right click function, for a drawer system, this quickly becomes problematic, as there is not way to linerally program the filters, as in, the first 54 items in one, the next 54 in the next, etc. Thus, I would love to see a "check existing items" filter, so all pulling module types check to see if the item exists in the inventory before pulling into the buffer for transport.

Also, one of the main reasons I choose not to use many item transport mods is because they can plug up a system if there is no where for an item to flow to ... so ...

I would also love it if sometime down the road, there was a "check for room/will it fit" filter / toggle !!in game!!. Back to drawers, for example, their nbt shows one inventory slot and the max stack size per slot based on drawer size and upgrades, thus, if MR looks into the inventory, it could see if one of two conditions are met: is there a current/empty slot where this item does exist or could be placed, and is currently inventory + is the stack I want to pull and send equal or less than max stack size. I know that is the check that is already taking place in MR before sending the buffered items, it would be nice, however, if we could add a filter like that to all upgrades that pull into the MR buffers. I say "in game," because, with drawers again, for example, if you are voiding excess, this would continue to pull and send items, which is fine, but if you are not voiding excess, again, the MR can be plugged up. Of course, it would make sense for this feature to only be applicable to upgrades/modules that insert into the buffer, otherwise, crashes would happen if trying to send to a full inventory stack.

Love the mod ... keep it up.

commented

Regarding an existing-items-filter, does the Bulk Filter inventory add/merge functionality not do the job? That is, where you have a Bulk Item Filter installed in a module which is installed in a router, you get the "+" and "=" buttons in the bulk filter GUI; those buttons let you merge or load the contents of the module's targeted inventory.

Or do you want a filter that only allows in items that currently exist in the target inventory?

Regarding your second point, are you suggesting that the puller module should check in advanced whether subsequent modules can actually send the item on somewhere before they pull, to avoid items clogging the router buffer? I have thought about that in the past, but decided against directly adding that, for a few reasons:

  1. It's a lot of code complexity, and potentially heavy on server CPU (each module would need to scan every subsequent module and perform a simulated operation)
  2. Routers are pretty cheap to make, and free to run (no power costs) so there need to be limits on their capabilities
  3. This sort of thing can be done already with external signalling (e.g. vanilla comparators & redstone, or more sophisticated inventory scanning & wireless redstone from various mods). I appreciate it's more work this way, but see point 2...
commented

Thank you for responding.

Sadly, the filters do not work that way. While you can merge/set to equal filters an inventory, MR bulk item filter will not go past the first 54 inventory slots, unless each item is manually programmed into another filter.

Server Performance: Related to subsequent checks in a single MR, I always love to phrase it in this manner ... let's say I only use MR to pull into an inventory system, without void / overflow protection, even only up to the bulk item filter capacity. In order to prevent any overflow bulking up / making MR break the system, I would need to have a minimum of 54 MRs. Would 54 MRs cost more, server side than having a check inventory call?

All that being said, you are exactly right, there are other means like inventory scanners and such that can help with that. So, not too important. Disregard that part, I agree with you ... more importantly, however, is the filtering of what can be pulled paired with what can be sent ...

Or do you want a filter that only allows in items that currently exist in the target inventory?
Yes

Another solution, is an "existing item filter" that can be bound to a target inventory, that can be placed inside of any module, exactly like the bulk item filter. I could work in two possible ways:

  1. Server intensive, requires a lot of coding: Instead of setting the "existing item filters" inventory contents, like bulk item filters, it would check the inventory linked in that filter before pulling/sending. Instead of checking each pull/send, it could check say once a minute, or something like that? But, the constant checks will definitely use more Server Resources. so ...
  2. Alternatively, even better: because you already have the code written for this in the bulk item filter: if the shift-click sets an "existing item filter" to all items in the scanned inventory, rather than only the first 54, you could then, for balancing and cost purposes, not allow the user to edit the contents of the filter, manually, requiring them to re-shift click it to update the filter, exactly like we would have to for the bulk item filter. This method would require very little additional code, and would still maintain balance.

Costs: As for its costs, I would argue that, while the infrastructure is slightly greater, other system do allow this, for less cost and power free. For example, 8 logistics pipes cost one osmium, two iron, and two redstone for 8, where their infrastructure only costs 4 iron, two redstone, 16 cobble, one osmium and a 2 pieces of redsone/coal for power. They can also send to as many inventories to which they are connected, with overflow protection, but not in as cool of a manner as MR. :) The wireless piece is the best piece by far!!

Just my thoughts.

commented

So, what you're really looking for is a Bulk Filter that can have more than 54 slots? And as a gameplay balancer, not allow it to be edited once set, only cleared & overwritten from scratch? I guess the other question is just how many items should be able to filter? There needs to be some limit...

commented

The problem with that approach is that the module constantly needs to check the inventory, so there is a lot of potential for server lag, especially for large inventories. Having said that, the Regulator Module needs to scan inventories to get item counts, so there is precedent.

I'll do some experimentation and see how well it works & how much load it puts on a server...

commented

Nah, i'm just looking for a filter that can check what exists in an inventory before pulling it to be sent to said inventory.

InventorytoSendto ---MR--- InventorytoPullFrom
MR.PullModule.Filter.ExistingFilter --> While.InventorytoPullFrom.HasInventory Check if InventorytoSendto.Contains.InventorytoPullFrom ifTrue.Pullfrom.InventorytoPullFrom return.SendItemsto.InventorytoSendto.

I get it if you don't want to, it's your mod. It was just a suggestion.