Add catalyst_amount to LuaRecipePrototype ingredients/products

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Therenas
Fast Inserter
Fast Inserter
Posts: 126
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Therenas » Thu Sep 12, 2019 6:01 pm

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
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by PyroFire » Thu Oct 10, 2019 10:24 am

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?

Therenas
Fast Inserter
Fast Inserter
Posts: 126
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Therenas » 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.

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

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Klonan » Thu Oct 10, 2019 10:47 am

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

Therenas
Fast Inserter
Fast Inserter
Posts: 126
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Therenas » Thu Oct 10, 2019 10:57 am

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: 3884
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Klonan » Thu Oct 10, 2019 1:15 pm

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
Fast Inserter
Fast Inserter
Posts: 112
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Add catalyst_amount to LuaRecipePrototype ingredients/products

Post by Honktown » Mon Oct 14, 2019 1:38 pm

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.

Post Reply

Return to “Modding interface requests”

Who is online

Users browsing this forum: No registered users