Change crafting time

Place to get help with not working mods / modding interface.
lepe
Burner Inserter
Burner Inserter
Posts: 7
Joined: Wed Apr 06, 2016 9:10 pm
Contact:

Change crafting time

Post by lepe »

How do I change the crafting time of an item?

I tried a couple of things that didn't have any effect—

e.g.

Code: Select all

-- This doesn't work!
data.raw.recipe["medium-electric-pole"].time = 2;
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Change crafting time

Post by Nexela »

energy :: double [Read-only]
Energy required to execute this recipe. This directly affects the crafting time: Recipe's energy is exactly its crafting time in seconds, when crafted in an assembling machine with crafting speed exactly equal to one.


I think it is energy_required in the protoype
lepe
Burner Inserter
Burner Inserter
Posts: 7
Joined: Wed Apr 06, 2016 9:10 pm
Contact:

Re: Change crafting time

Post by lepe »

Nexela wrote:energy :: double [Read-only]
Energy required to execute this recipe. This directly affects the crafting time: Recipe's energy is exactly its crafting time in seconds, when crafted in an assembling machine with crafting speed exactly equal to one.


I think it is energy_required in the protoype
Yes, that was it — thanks!
sarcolopter
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Sun Jul 26, 2015 5:08 pm
Contact:

Re: Change crafting time

Post by sarcolopter »

How would you do this for a recipe that has no "energy required" field? For example:


{
type = "recipe",
name = "electronic-circuit",
normal =
{
ingredients =
{
{"iron-plate", 1},
{"copper-cable", 3},
},
result = "electronic-circuit"
},
expensive =
{
ingredients =
{
{"iron-plate", 2},
{"copper-cable", 8}
},
result = "electronic-circuit"
}
},
Pi-C
Smart Inserter
Smart Inserter
Posts: 1731
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Change crafting time

Post by Pi-C »

sarcolopter wrote: Wed Mar 30, 2022 7:11 pm How would you do this for a recipe that has no "energy required" field?
Every recipe has energy_required, see here:

Code: Select all

energy_required

Type: double
Default: 0.5
Optional. The amount of time it takes to make this recipe.

This is the number of seconds it takes to craft at crafting speed 1. 
If any fields haven't been explicitly set at the of the data stage, the default values will be used instead. So if you have a recipe without energy_required, just add it!

For example:
{
type = "recipe",

},
Check it out yourself: Create that recipe, start the game, and use CTRL+SHIFT+E to open the prototype browser. Look for this recipe and check its properties -- there will be energy_required!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”