CyclopsMC / IntegratedDynamics

A Minecraft mod to take full and automated control of your appliances.
http://cyclopsmc.github.io/IntegratedDynamics/
MIT License
134 stars 62 forks source link

Operator to read a Card's value from its item form #839

Open TheTrigg opened 4 years ago

TheTrigg commented 4 years ago

Issue type:


Short description:

This may be kind of a confusing request at first, but the chat I had over at the discord server may clarify why this could be useful.

Use example; from what I originally intended to do before I found out I couldn't:

Use an inventory reader on a variable store Return a list of all cards Map them to this new operator and return a list of all their values You may now have a dynamically assembled list from tons of readers You can then map them all to whatever you may need. Removing or adding a card to the store automatically updates the list and the resulting maps.

Yogghy commented 4 years ago

Thumbs up to this feature request; it would allow pretty powerful meta-programming. Part and card IDs are powerful but inaccessible to the users unfortunately.

A possible way of implementing this feature would be by creating a rather simple operator: Get Card Value :: Integer -> Any Parameter is card id, result is whatever is stored in the card. The operator can then be used in a few ways - for example, create a lazy list of integers, store a bunch of cards from readers into a store, then map the list via this operator, then do whatever is necessary. (Discord link: https://discordapp.com/channels/386052815128100865/386054223688630272/705551702761275463 )

Yet another nice thing might be taking this one step further and allow the same kind of operations but with the readers themselves: Get aspect :: Integer -> String -> Any Parameters are: part ID, aspect name, result is whatever is produced by that reader. This would even eliminate the necessity for cards if you have a large self-repeating structure with consecutive part IDs!

Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
7eggert commented 3 years ago

I immediately imagined something to the effect of map(getCardValue, $VARIABLESTORE->contents()) or $VARIABLESTORE->slot(SlotNr)->callCardFunction($VARIABLESTORE_B->slot(slotNr_b)).

Put a named variable store next to your machine, put in all the item cards you want it to process, put the resulting list into an item exporter.

Maybe less useful?: $NETWORK.getCardWithID($VARIABLESTORE.slot(42).getCardID + 23).getCardValue() - 63

rubensworks commented 3 years ago

Related to #525

anton85bk commented 1 month ago

+1 my voice to this feature, waiting for it to be implemented