Page 1 of 1

Change crafting time

Posted: Sat Jul 30, 2016 7:54 pm
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;

Re: Change crafting time

Posted: Sat Jul 30, 2016 8:29 pm
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

Re: Change crafting time

Posted: Sat Jul 30, 2016 10:11 pm
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!

Re: Change crafting time

Posted: Wed Mar 30, 2022 7:11 pm
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"
}
},

Re: Change crafting time

Posted: Wed Mar 30, 2022 7:31 pm
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!