How to change assembling-machine-1 to use coal

Place to get help with not working mods / modding interface.
Post Reply
Jarumba
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Apr 05, 2018 4:31 am

How to change assembling-machine-1 to use coal

Post 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,
    },
},

Schallfalke
Fast Inserter
Fast Inserter
Posts: 162
Joined: Sun Oct 28, 2018 7:57 am
Contact:

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

Post 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".

Jarumba
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Apr 05, 2018 4:31 am

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

Post 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 :)

User avatar
mat1k
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Sat Dec 22, 2018 8:48 am
Contact:

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

Post 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.

Schallfalke
Fast Inserter
Fast Inserter
Posts: 162
Joined: Sun Oct 28, 2018 7:57 am
Contact:

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

Post 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.

Jarumba
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Apr 05, 2018 4:31 am

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

Post 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?

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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 1958 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)

Schallfalke
Fast Inserter
Fast Inserter
Posts: 162
Joined: Sun Oct 28, 2018 7:57 am
Contact:

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

Post 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.

Post Reply

Return to “Modding help”