Add catalyst_amount to LuaRecipePrototype ingredients/products

Post Reply
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Therenas »

Currently, during the control stage, the catalyst_amount attribute is available on ingredients and products of LuaRecipe, but not of LuaRecipePrototype. I suggest adding that attribute to the prototype too, to make it consistent for one and because it doesn't change during runtime, so it should probably be part of the prototype definition. It makes modders not have to reach into the LuaRecipe when they have the prototype right there.

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by PyroFire »

This appears to be a thing already ?

https://lua-api.factorio.com/latest/Lua ... ngredients

https://lua-api.factorio.com/latest/Lua ... ngredients

https://lua-api.factorio.com/latest/Con ... Ingredient

Unless you are saying the api shows this value *should* be in the ingredients table but is actually bugged and the value isn't there?

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Therenas »

That's the LuaRecipe, not the LuaRecipePrototype. I want it on the prototype so I can access it without having to associate it with a player, which can be inconvenient/impossible at times. As the value doesn't change at runtime, I don't see why it shouldn't be accessible on the prototype as well.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Klonan »

Therenas wrote:
Thu Oct 10, 2019 10:34 am
That's the LuaRecipe, not the LuaRecipePrototype. I want it on the prototype so I can access it without having to associate it with a player, which can be inconvenient/impossible at times. As the value doesn't change at runtime, I don't see why it shouldn't be accessible on the prototype as well.
It is accessible on the prototype:
https://lua-api.factorio.com/latest/Lua ... ngredients

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Therenas »

It's not in reality though (The first log is the LuaRecipePrototype, the second is the LuaRecipe):

Code: Select all

6103.263 Script @__factoryplanner__/data/util.lua:236: {
  {
    amount = 5,
    name = "uranium-238",
    type = "item"
  },
  {
    amount = 40,
    name = "uranium-235",
    type = "item"
  }
}
6103.264 Script @__factoryplanner__/data/util.lua:241: {
  {
    amount = 5,
    catalyst_amount = 2,
    name = "uranium-238",
    type = "item"
  },
  {
    amount = 40,
    catalyst_amount = 40,
    name = "uranium-235",
    type = "item"
  }
}
So it might even be a bug then?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Klonan »

So its some special logic, that the recipe will set up itself to auto detect catalysts

So kovarex enrichment doesn't actually specify any catalyst amount,
Just when the recipe is 'setup', the game auto detects the catalysts.

Honktown
Smart Inserter
Smart Inserter
Posts: 1025
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Honktown »

If I recall correctly, if an item is both an ingredient and output product, logic was added to not apply certain things like productivity to that ingredient (explicitly for the case of kovarex enrichment). Is there a way to make a hidden output inventory for a catalyst, fully consume the catalyst, and still have the logic trigger?

In addition, there are mods that use different output recipes automatically, besides the smelter itself in vanilla. Reverse Factory is the first one I can think of. If a machine could auto-detect multiple ingredients, and if the recipe matched the most complex recipe first (say it checked catalyst slot before checking the first) one could have a smelter which took an optional catalyst and output more as a result, by auto-switching recipes when the catalyst is present.

These are workarounds, as there is no catalyst = , catalyst_result = , and/or the plural+tables, which might be the best case of what you're going for.

I always wondered why we needed no carbon to convert iron to steel (maybe a catalyst_ingredients could be added, but that adds a bit more complexity). Perhaps a catalyst_effects would be the easiest way to implement all of these things, so you can multiply the output products, alter the crafting speed, etc. Kovarex could be changed to be a painfully slow process without the catalyst, and sped up and double the output products with it (3 lousy uranium to one good takes 10 minutes, or 2 minutes and 2 good). Steel could be made slowly by itself, or using "refined carbon" e.g. smelt coal and stuff that in the furnace. Most mod recipes could use the catalyst to add a multiplier to output product, or even have the option to change it entirely. Non-consumable catalysts would have their uses, too.
I have mods! I guess!
Link

Erythion
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sun May 20, 2018 3:40 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Erythion »

I just found out that this issue existed, and thankfully got pointed to this thread. It does seem wasteful to not have the catalyst data in LuaRecipePrototype.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13198
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Rseding91 »

It's now changed for the next version of 0.17 thanks to Boodals.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Therenas »

Great news, thanks to you and thanks again to Boodals.

Post Reply

Return to “Implemented mod requests”