Page 1 of 1

How to retrieve a recipe prototype by name

Posted: Tue Dec 02, 2014 8:41 pm
by Simn
Hi!

I'm trying to find the ingredients of items in control.lua and can't figure out how to do that. I see that the game object allows me to get prototypes for items and entities, but what about recipes? I tried querying data.raw only to find out that data is a nil value at this point.

Thanks!

Re: How to retrieve a recipe prototype by name

Posted: Tue Dec 02, 2014 8:57 pm
by L0771
You can't get ingredients from the recipes for now, only this parameters are available.

Re: How to retrieve a recipe prototype by name

Posted: Tue Dec 02, 2014 9:06 pm
by Simn
Thanks for the reply. I know only these properties are available on the object, my hope was that I could get the prototype somehow. Oh well...

Re: How to retrieve a recipe prototype by name

Posted: Tue Dec 02, 2014 9:21 pm
by L0771
From here?
If you have an idea how can you get a property from prototypes, please tell me, i have the same problem with resources and trees.

Or can post here for it.

Re: How to retrieve a recipe prototype by name

Posted: Tue Dec 02, 2014 9:47 pm
by Simn
I thought you could get the prototype of trees from game.entityprototypes, but it seems that's not actually a Prototype/Entity but a Lua/EntityPrototype with only a few properties.

Re: How to retrieve a recipe prototype by name

Posted: Tue Dec 02, 2014 9:51 pm
by L0771
that's the problem, with recipe's ingredient is the same

Re: How to retrieve a recipe prototype by name

Posted: Tue Dec 02, 2014 9:54 pm
by Simn
From my understanding a recipe is not an entity though. It's not an item either, which are the two entity functions available on the game object.