Page 1 of 1

How to change assembling-machine-1 to use coal

Posted: Thu Sep 26, 2019 6:07 pm
by Jarumba
Basically the title. I'm trying to make the assembling machine require coal instead of electricity from power poles for the first part of my mod. Any help on the subject would be super helpful.
Thank you.

Code I'm using at the moment for this.

Code: Select all

{
    type = "recipe",
    name = "assembling-machine-1",
	icon = "__xxxxxxx__/graphics/icons/assembling-machine-1.png",
	icon_size = 32,
	order = "d-b",
	category = "basic-crafting",
    normal =
    {
      enabled = true,
      ingredients =
      {
        {"simple-frame", 1}
      },
    results=
    {
      {type = "item", name = "assembling-machine-1", amount = 1}
    }, 
	energy_required = 2,
    },
},

Re: How to change assembling-machine-1 to use coal

Posted: Thu Sep 26, 2019 6:46 pm
by Schallfalke
Instead of giving a direct answer, I would like to give you a hint first, and see if you can find it out and learn the process.

You can compare between "stone-furnace", "steel-furnace", and "electric-furnace" of the base code.
"stone-furnace", "steel-furnace" are using coal (or other fuel).
"electric-furnace" is using electricity.
If you can spot the differences, it would be very easy for you to change the power source.

BTW, you should look into "entity" types, NOT "recipe" types.
The "energy_required" in "recipe" prototype is actually referring to the crafting time, really nothing to do with "energy".

Re: How to change assembling-machine-1 to use coal

Posted: Thu Sep 26, 2019 6:59 pm
by Jarumba
Ok so looking into this a bit, if i use the category = "smelting", what ever i have created a recipe for will automatically create the given output. But my intention is to use the same ingredient to output different things. For instance I would like to be able to select either crushed stone or bricks, both using the core ingredient of stone.

Maybe I'm missing your point though. Let me know.
also thanks for the help :)

Re: How to change assembling-machine-1 to use coal

Posted: Thu Sep 26, 2019 8:35 pm
by mat1k
https://wiki.factorio.com/Types/EnergySource

Read that. To get it to run on coal, you need to change the type to burner and set the properties in the burner section. Look at any prototype that uses fuel to see how it is done.

Re: How to change assembling-machine-1 to use coal

Posted: Thu Sep 26, 2019 11:17 pm
by Schallfalke
Jarumba wrote:
Thu Sep 26, 2019 6:59 pm
Ok so looking into this a bit, if i use the category = "smelting", what ever i have created a recipe for will automatically create the given output. But my intention is to use the same ingredient to output different things. For instance I would like to be able to select either crushed stone or bricks, both using the core ingredient of stone.

Maybe I'm missing your point though. Let me know.
also thanks for the help :)
Yes, you missed my point TOTALLY. Read that again:
Schallfalke wrote:
Thu Sep 26, 2019 6:46 pm
...
You can compare between "stone-furnace", "steel-furnace", and "electric-furnace" of the base code.
"stone-furnace", "steel-furnace" are using coal (or other fuel).
"electric-furnace" is using electricity.
If you can spot the differences, it would be very easy for you to change the power source.
...
The differences are the part where the energy sources are changed. And actually mat1k gave the answer.
The other things (like category, recipe) are totally irrelevant to the energy source, they can be changed individually to whatever you need.

Re: How to change assembling-machine-1 to use coal

Posted: Fri Sep 27, 2019 3:57 pm
by Jarumba
Ok so maybe im just looking in the wrong locations but i can't seem to find the base lua files that will help me create this. where exactly should i be looking?

Re: How to change assembling-machine-1 to use coal

Posted: Fri Sep 27, 2019 5:02 pm
by darkfrei
Jarumba wrote:
Fri Sep 27, 2019 3:57 pm
Ok so maybe im just looking in the wrong locations but i can't seem to find the base lua files that will help me create this. where exactly should i be looking?
From info-mod:
2019-09-27T18_59_01-Window.png
2019-09-27T18_59_01-Window.png (26.55 KiB) Viewed 1997 times
So the code that you need:

Code: Select all

data.raw["assembling-machine"]["assembling-machine-1"].energy_source = table.deepcopy( data.raw.furnace["stone-furnace"].energy_source)

Re: How to change assembling-machine-1 to use coal

Posted: Fri Sep 27, 2019 5:08 pm
by Schallfalke
Jarumba wrote:
Fri Sep 27, 2019 3:57 pm
Ok so maybe im just looking in the wrong locations but i can't seem to find the base lua files that will help me create this. where exactly should i be looking?
In file {GameDir}\data\base\prototypes\entity\demo-entities.lua, search for type = "furnace".
All three furnaces can be found in this file.