Recipe woes
Posted: Fri Feb 20, 2015 8:25 am
Hi,
I'm currently trying to implement some kind of recycler which takes items and cracks them into their components. Then cracks these again until whitelisted or "raw" items (wood, ore) without a recipe are found.
Now that 0.11.16 is finally here ^^ I tried out LuaRecipe.ingredients.
As described in the wiki It gives me a nice list of the entity's ingredients, much to my delight.
What it however does not show is a, let's call it "gives amount of", attribute. For example this is necessary with the copper wire: 1x copper plate gives 2x copper wire
The ingredients tells me for one copper wire it's composed of 1 copper plate, which is not what the game recipe is, as you get two copper wire for one copper plate.
So it should be 0,5 copper plate as an ingredient for the copper wire or an additional "gives amount of" attribute like there is for PrototypeRecipe: result_count
Edit: okay, found this one: LuaRecipe.products[n].amount but why is this structure so different than in PrototypeRecipe?
Then I totally lost it and am questioning now what this Lua/* Prototype/* is all about.
I have questions that hopefully someone can answer to get the model I'm builing in my head, how this is supposed to work, raised.
1) why is there a Lua/Recipe and a Prototype/Recipe?
1a) both seem to try to accomplish the same, give similar information (ingredients) but they are still so different (result_count, energy)
1b) one is not castable into the other, they are AFAICS not connected in any way
2) why are there prototypes at all?
2a) like 3c above - what the either bring above the other, why is there a Lua/* and a Prototype/* ? I can't see what this is needed for
3) strings to objects
3a) often the exposed item information is a string, e.g. the item type is e.g. "iron-plate". Sometimes it's an object, see the event handlers. I assume this has been done to save memory and just say "this chest has 400x iron-plate" than keeping 400 entity objects.
3b) Probably fair enough but how do I get an Entity froma string, e.g. to get it's recipe?
3c) Currently I'm using "local aItemToCrackRecipe = game.player.force.recipes[cargItemToCrackName]" but this does not seem right to me and gives me (only) LuaRecipe, where no "result_count" is given.
4) where is the crafting time stored?
4a) neither LuaRecipe nor ProtoypeRecipe indicate how much time crafting from a recipe takes. I would have expected an attribute (or hackishly a time ingredient) here for this?
Confused.
I'm currently trying to implement some kind of recycler which takes items and cracks them into their components. Then cracks these again until whitelisted or "raw" items (wood, ore) without a recipe are found.
Now that 0.11.16 is finally here ^^ I tried out LuaRecipe.ingredients.
As described in the wiki It gives me a nice list of the entity's ingredients, much to my delight.
What it however does not show is a, let's call it "gives amount of", attribute. For example this is necessary with the copper wire: 1x copper plate gives 2x copper wire
The ingredients tells me for one copper wire it's composed of 1 copper plate, which is not what the game recipe is, as you get two copper wire for one copper plate.
So it should be 0,5 copper plate as an ingredient for the copper wire or an additional "gives amount of" attribute like there is for PrototypeRecipe: result_count
Edit: okay, found this one: LuaRecipe.products[n].amount but why is this structure so different than in PrototypeRecipe?
Then I totally lost it and am questioning now what this Lua/* Prototype/* is all about.
I have questions that hopefully someone can answer to get the model I'm builing in my head, how this is supposed to work, raised.
1) why is there a Lua/Recipe and a Prototype/Recipe?
1a) both seem to try to accomplish the same, give similar information (ingredients) but they are still so different (result_count, energy)
1b) one is not castable into the other, they are AFAICS not connected in any way
2) why are there prototypes at all?
2a) like 3c above - what the either bring above the other, why is there a Lua/* and a Prototype/* ? I can't see what this is needed for
3) strings to objects
3a) often the exposed item information is a string, e.g. the item type is e.g. "iron-plate". Sometimes it's an object, see the event handlers. I assume this has been done to save memory and just say "this chest has 400x iron-plate" than keeping 400 entity objects.
3b) Probably fair enough but how do I get an Entity froma string, e.g. to get it's recipe?
3c) Currently I'm using "local aItemToCrackRecipe = game.player.force.recipes[cargItemToCrackName]" but this does not seem right to me and gives me (only) LuaRecipe, where no "result_count" is given.
4) where is the crafting time stored?
4a) neither LuaRecipe nor ProtoypeRecipe indicate how much time crafting from a recipe takes. I would have expected an attribute (or hackishly a time ingredient) here for this?
Confused.