-
Hi again squid, i'm here from the create compat pr Creators-of-Create/Create#7883. We have a wip StockTicker peripheral, a block with access to an item network, similar to any big storage mod, but also has it's own little payment inventory which is filled with payment funds if someone uses the store functionality. we'd wanna add the generic itemhandler api to it like so: {
.list(?Detailed) -- <- for stock ticker's stock
.getItemDetail(index) -- <- for getting deteails of a specific item in the stock
.requestFiltered(?address, ?filter, ...) -- <- for requesting things in the stock
.getPaymentInventory() -- <- would return the generic IItemhandler functions for the payment inventory, like .list(), .pushItems() etc
} or {
.list(?Detailed) -- <- for stock ticker's stock
.getItemDetail(index) -- <- for getting deteails of a specific item in the stock
.requestFiltered(?address, ?filter, ...) -- <- for requesting things in the stock
.paymentInventory = {
.list() -- <- to list items in the payment inventory
.getItemDetail() -- <- to get item details of an item in X slot of the payment inventory
-- same for all other generic functions
}
} is that possible with the current api? For now we just reimplement .list() as .listPaymentInventory() and so on, but it's wordy and doesn't have the full functionality |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hrrrm, it's tricky. So in theory, you can have a However, this object will stick around even if the peripheral is detached (e.g. the stock ticker being broken), which means you could extract items from an inventory which no exists, which is obviously no good! Honestly, I'm afraid I probably would recommend sticking with what you've got now. Or rename the |
Beta Was this translation helpful? Give feedback.
-
actually @SquidDev passing IItemHandler doesn't seem to expose pushing/pulling anyways (and yes, it's ephemeral, i can peek into the inv even when it's disconnected) so i guess we'll stick to just doing our own .list() function for the payment inventory for now. Thanks for the help squid :D |
Beta Was this translation helpful? Give feedback.
Hrrrm, it's tricky.
So in theory, you can have a
paymentInventory()
method just return the underlyingIItemHandler
, and that will have all the right methods.However, this object will stick around even if the peripheral is detached (e.g. the stock ticker being broken), which means you could extract items from an inventory which no exists, which is obviously no good!
Honestly, I'm afraid I probably would recommend sticking with what you've got now. Or rename the
list()
method to bestock()
.