Add LuaItemPrototype.effect

Things that already exist in the current mod API
Post Reply
mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Add LuaItemPrototype.effect

Post 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.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add LuaItemPrototype.effect

Post by boskid »


mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Add LuaItemPrototype.effect

Post by mrvn »

Thanks.

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

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add LuaItemPrototype.effect

Post 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.

Post Reply

Return to “Already exists”