Page 1 of 1

Add LuaItemPrototype.effect

Posted: Fri Mar 29, 2024 1:07 pm
by mrvn
TL;DR
Add the effect table from ModulePrototype to LuaItemPrototype.
What ?
In the data phase modules have an effect table detailing what effects the module item has. In the game phase modules use the LuaItemPrototype class and the effect table is unavailable. Add the table when the item is a module.
Why ?
I calculate the required ingredients to produce a certain amount of product for a recipe in an assembling machine for a crafting combinator. The combinator sets a recipe and insert modules, if possible, into the assembler. But it can only do that once the next recipe has been chosen. So I need to know the effect of modules before inserting them into the assembler.

Re: Add LuaItemPrototype.effect

Posted: Fri Mar 29, 2024 1:15 pm
by boskid

Re: Add LuaItemPrototype.effect

Posted: Fri Mar 29, 2024 2:21 pm
by mrvn
Thanks.

But why, Why, WHY rename the field between the data and game stage? :(

Re: Add LuaItemPrototype.effect

Posted: Fri Mar 29, 2024 2:52 pm
by boskid
Do not ask me, that name was selected 29th august 2015 when this read was added to LuaItemPrototype in version 0.12.6. Back then there were only like 16 values that were possible to read from LuaItemPrototype.