[2.0.27] Allow LuaEntity::get_recipe() for 'furnace'

Things that already exist in the current mod API
RedRafe
Inserter
Inserter
Posts: 26
Joined: Thu Nov 11, 2021 12:21 pm
Contact:

[2.0.27] Allow LuaEntity::get_recipe() for 'furnace'

Post by RedRafe »

Hi,
I've encountered this issue with my mod Factory Efficiency Tracker (https://mods.factorio.com/mod/factory-e ... cy-tracker).

When reading an entity's recipe, there's "get_recipe()" if type is "crafting-machine" and "previous_recipe" if type is "furnace".

However, a furnace starting crafting iron plates would never return "previous_recipe" until it stops or it changes recipe. This is quite the limitation as a furnace that starts crafting plates from ore and it's 100% fulfilled in input/output will never return any information about the recipe used/currently used for the whole game.

In this example (attachment: 10_crafts.png), a furnace is provided with 10 iron ore. No recipe is available until it stops or until I swap some iron for copper ore.
Technically, even returning "iron-plate" as "previous_recipe" after the 1st iron plate has been crafted would already be an upgrade of the current API.
Would be even better if "get_recipe()" method would work for both "crafting-machine" and "furnace" type tho.
Attachments
10_crafts.png
10_crafts.png (408.76 KiB) Viewed 207 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3458
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.27] Allow LuaEntity::get_recipe() for 'furnace'

Post by boskid »

I do not understand this. CraftingMachine is a parent class of both Furnace and AssemblingMachine, it should be working already.
RedRafe
Inserter
Inserter
Posts: 26
Joined: Thu Nov 11, 2021 12:21 pm
Contact:

Re: [2.0.27] Allow LuaEntity::get_recipe() for 'furnace'

Post by RedRafe »

Yup, sorry. :roll:

I got misled by "get_recipe(): Can only be used if this is CraftingMachine" and "previous_recipe: Can only be used if this is Furnace" and assumed it wasnt derived to child class.

Topic is already solved, thanks!
Post Reply

Return to “Already exists”