Jump to content

Intelligent inventory?


gcewing

Recommended Posts

I'm creating a device with two inventory slots that needs a specific kind of item to be placed in each slot.

 

Currently I'm using ISidedInventory to allow items to be piped into particular slots, which works okay. But it would be better if I could accept an item from any side and automatically route it to the appropriate slot.

 

Some mods have devices that behave this way -- anyone know how they do it? IInventory and ISidedInventory don't seem to support this behaviour, since they require the caller to have already decided which slot the item goes in.

 

A related question is whether it's possible to reject items of the wrong kind. There doesn't seem to be any obvious way to do that either.

Link to comment
Share on other sites

One way I saw is to have a set of like 9 invisible slots that are not actually on the GUI that all the sides interact with.  And when the block detects an item in there it automatically moves it to the proper spot, and if all spots are full then it usually 'unlinks' them.  There are a few ways though.

 

I have been itching to created an ISidedInventoryEx that extends ISidedInventory with such functions though, unless someone else wants to do it first?  Please?

 

The BC API for item handling is a good basis, just needs changes to become generic.

Link to comment
Share on other sites

Well, I'd just use the six slots, then route it. But yeah, ISidedInventoryAwesomness (That's what it should be called) would be great!

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

Link to comment
Share on other sites

One way I saw is to have a set of like 9 invisible slots...  And when the block detects an item in there it automatically moves it to the proper spot

 

Hmmm... what happens if one of the slots is full, but the others aren't? It seems like items will end up in the invisible inventory with nowhere to go.

 

I was wondering whether I could just have setInventorySlotContents ignore the slot index passed in, and make its own determination of where to put the item. Or would that confuse callers too much?

 

I have been itching to created an ISidedInventoryEx that extends ISidedInventory with such functions though, unless someone else wants to do it first?  Please?

 

The BC API for item handling is a good basis, just needs changes to become generic.

 

I may have a look at that and see what I can come up with.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.