Page 1 of 1

Get all raw resources for item?

Posted: Sun Apr 30, 2017 7:20 am
by Cryotech
Is there a way to view the raw resources required for an item to be built inside an event listener?

For example, a way to find that a single "transport belt" is valued at 1.5 iron? (Note that this is because the recipe takes 3 iron, but crafts 2 belts)

Thanks!

Re: Get all raw resources for item?

Posted: Tue May 02, 2017 12:18 pm
by DedlySpyder
There's definitely a way to do it, but it may be a bit convoluted. Which event are you trying to do this in?

I'll post this here if you want an idea of how I did something similar without any base information for each item in the game. I am assigning arbitrary values to all items (giving basic items like ores a base value). I needed to get the recipes of each item, iterate through its ingredients, and add up my values for each, then divide it by the products.

You'd probably need to look up the recipe and do something similar.

https://github.com/DedlySpyder/Proxy_Wa ... values.lua

Re: Get all raw resources for item?

Posted: Thu May 04, 2017 11:59 pm
by Cryotech
DedlySpyder wrote:There's definitely a way to do it, but it may be a bit convoluted. Which event are you trying to do this in?

I'll post this here if you want an idea of how I did something similar without any base information for each item in the game. I am assigning arbitrary values to all items (giving basic items like ores a base value). I needed to get the recipes of each item, iterate through its ingredients, and add up my values for each, then divide it by the products.

You'd probably need to look up the recipe and do something similar.

https://github.com/DedlySpyder/Proxy_Wa ... values.lua
I'd be doing it in the on_player_mined_entity event. I'll take a look at your work and see if I can pull off something similar, thanks!