How to define a specific fuel type for furnaces.

Place to get help with not working mods / modding interface.
Post Reply
Saniee
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Sep 27, 2020 9:08 am
Contact:

How to define a specific fuel type for furnaces.

Post by Saniee »

Im trying to do a furnace that accepts only rocket fuel, but I cant wrap my head around how to define the fuel-category. I just need help with this, becouse Im really new to this and I dont really know if you can define specific fuel types.

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

Re: How to define a specific fuel type for furnaces.

Post by darkfrei »

Saniee wrote:
Sun Sep 27, 2020 9:11 am
Im trying to do a furnace that accepts only rocket fuel, but I cant wrap my head around how to define the fuel-category. I just need help with this, becouse Im really new to this and I dont really know if you can define specific fuel types.

Code: Select all

data:extend({{type = "fuel-category", name = "rocket"}})

Code: Select all

data.raw.item["rocket-fuel"].fuel_category = "rocket"

Code: Select all

data.raw.furnace["steel-furnace"].energy_source.fuel_category = "rocket"

Saniee
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Sep 27, 2020 9:08 am
Contact:

Re: How to define a specific fuel type for furnaces.

Post by Saniee »

Thank you so much!

Edit: Sry for late response.

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

Re: How to define a specific fuel type for furnaces.

Post by darkfrei »

Saniee wrote:
Mon Oct 05, 2020 7:11 pm
Thank you so much!

Edit: Sry for late response.
No problem, you are welcome!

Saniee
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Sep 27, 2020 9:08 am
Contact:

Re: How to define a specific fuel type for furnaces.

Post by Saniee »

darkfrei wrote:
Wed Sep 30, 2020 3:41 pm
Saniee wrote:
Sun Sep 27, 2020 9:11 am
Im trying to do a furnace that accepts only rocket fuel, but I cant wrap my head around how to define the fuel-category. I just need help with this, becouse Im really new to this and I dont really know if you can define specific fuel types.

Code: Select all

data:extend({{type = "fuel-category", name = "rocket"}})

Code: Select all

data.raw.item["rocket-fuel"].fuel_category = "rocket"

Code: Select all

data.raw.furnace["steel-furnace"].energy_source.fuel_category = "rocket"
so I just found a bug. Its a wierd one. When I do this for a nuclear type furnace. It makes the nuclear reactor not accept nuclear cells. I tried to find the bug fix myself but did not succeded. If you want the source here it is = https://github.com/Saniee/furnacesPlus

Edit: I think that by doing this with nuclear fuel cells im overwriting theyre hard coding. Aka overwriting theire fuel category too. (Btw I tested the rocket fuel too. The same happens with that too. Trains dont accept it and furnaces too.)

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

Re: How to define a specific fuel type for furnaces.

Post by darkfrei »

Saniee wrote:
Thu Oct 22, 2020 9:39 am
When I do this for a nuclear type furnace.
I've made this nuclear furnace, see https://mods.factorio.com/mod/NuclearFurnace

Nothing is hardcoded.

If your item has fuel type "nuclear", then it can be used in assemblers/furnaces/etc. with the same fuel type only.

Saniee
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Sep 27, 2020 9:08 am
Contact:

Re: How to define a specific fuel type for furnaces.

Post by Saniee »

darkfrei wrote:
Thu Oct 22, 2020 10:03 am
Saniee wrote:
Thu Oct 22, 2020 9:39 am
When I do this for a nuclear type furnace.
I've made this nuclear furnace, see https://mods.factorio.com/mod/NuclearFurnace

Nothing is hardcoded.

If your item has fuel type "nuclear", then it can be used in assemblers/furnaces/etc. with the same fuel type only.
Now I forgot to say that I made the nuclear furnace work (I switched from my custom fuel category to a vanilla "nuclear"). But the rocket furnace does the same thing too. Trains other vanilla furnaces dont accept rocket fuel other then my furnace.
Attachments
in game testing
in game testing
factorio_XW4XjrmZeZ.png (16.55 KiB) Viewed 2500 times

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: How to define a specific fuel type for furnaces.

Post by Deadlock989 »

Saniee wrote:
Sun Sep 27, 2020 9:11 am
Im trying to do a furnace that accepts only rocket fuel, but I cant wrap my head around how to define the fuel-category. I just need help with this, becouse Im really new to this and I dont really know if you can define specific fuel types.
Fuel items can only have one category. In vanilla rocket fuel is "chemical", the same as coal and everything else you burn in a furnace.

Machines, including locomotives, can accept more than one category. These are defined in a list, e.g {"chemical","nuclear"}, usually specified here.

To achieve what you want - a furnace that only burns rocket fuel - rocket fuel will need a unique category, e.g. "rocket-fuel". Then everything else that currently burns chemical will need "rocket-fuel" added to their list.

These are the steps:

- Create fuel category "rocket-fuel".
- Set rocket fuel item's fuel category to "rocket-fuel".
- Create new furnace and set its fuel category to {"rocket-fuel"}.
- Set the category of everything else that currently accepts chemical fuel to {"chemical","rocket-fuel"}. You could have a hardcoded list of specific entities or you could check every entity in the game to see if it already has "chemical" as a fuel category. The advanced method would be, in case you want to avoid overwriting changes from other mods, check the list to see if it already contains "rocket-fuel" and if it doesn't then insert rocket-fuel into the list.
Image

Saniee
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Sep 27, 2020 9:08 am
Contact:

Re: How to define a specific fuel type for furnaces.

Post by Saniee »

Deadlock989 wrote:
Sat Oct 24, 2020 11:52 am
Saniee wrote:
Sun Sep 27, 2020 9:11 am
Im trying to do a furnace that accepts only rocket fuel, but I cant wrap my head around how to define the fuel-category. I just need help with this, becouse Im really new to this and I dont really know if you can define specific fuel types.
Fuel items can only have one category. In vanilla rocket fuel is "chemical", the same as coal and everything else you burn in a furnace.

Machines, including locomotives, can accept more than one category. These are defined in a list, e.g {"chemical","nuclear"}, usually specified here.

To achieve what you want - a furnace that only burns rocket fuel - rocket fuel will need a unique category, e.g. "rocket-fuel". Then everything else that currently burns chemical will need "rocket-fuel" added to their list.

These are the steps:

- Create fuel category "rocket-fuel".
- Set rocket fuel item's fuel category to "rocket-fuel".
- Create new furnace and set its fuel category to {"rocket-fuel"}.
- Set the category of everything else that currently accepts chemical fuel to {"chemical","rocket-fuel"}. You could have a hardcoded list of specific entities or you could check every entity in the game to see if it already has "chemical" as a fuel category. The advanced method would be, in case you want to avoid overwriting changes from other mods, check the list to see if it already contains "rocket-fuel" and if it doesn't then insert rocket-fuel into the list.
Honestly dont know why I didnt thinked of this before. Thank you!

Saniee
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Sep 27, 2020 9:08 am
Contact:

Re: How to define a specific fuel type for furnaces.

Post by Saniee »

Ok so... Gosh this is something. Im getting somewhere. I moved the declaracion of fuel categories to data-final-fixes.lua.
the code there:

Code: Select all

data.raw["locomotive"]["locomotive"].burner.fuel_category = "chemical","rocket"

data.raw["furnace"]["stone-furnace"].energy_source.fuel_category = "chemical","rocket"

data.raw["furnace"]["steel-furnace"].energy_source.fuel_category = "chemical","rocket"

data.raw["boiler"]["boiler"].energy_source.fuel_category = "chemical","rocket"

data.raw["inserter"]["burner-inserter"].energy_source.fuel_category = "chemical","rocket"

data.raw["car"]["car"].burner.fuel_category = "chemical","rocket"
It wont let me put the {} brackets in, and when I removed them the error is gone(the error was that it wasnt a string). Now im really hoping that this is the last call for help im feeling like a dumbass asking all the time and getting into problems. I tried doing a deepcopy. But that failed too saying that the array was bad.
the previous code here:

Code: Select all

data:extend({{type = "fuel-category", name = "rocket"}})
data.raw.item["rocket-fuel"].fuel_category = "rocket"

local locomotive = table.deepcopy(data.raw["locomotive"]["locomotive"])
local stoneFurnace = table.deepcopy(data.raw["furnace"]["stone-furnace"])
local steelFurnace = table.deepcopy(data.raw["furnace"]["steel-furnace"])
local boiler = table.deepcopy(data.raw["boiler"]["boiler"])
local burnerInsterter = table.deepcopy(data.raw["inserter"]["burner-inserter"])
local car = table.deepcopy(data.raw["car"]["car"])

locomotive.burner.fuel_category = {"chemical", "rocket"}

stoneFurnace.energy_source.fuel_category = {"chemical", "rocket"}

steelFurnace.energy_source.fuel_category = {"chemical", "rocket"}

boiler.energy_source.fuel_category = {"chemical", "rocket"}

burnerInsterter.energy_source.fuel_category = {"chemical", "rocket"}

car.burner.fuel_category = {"chemical", "rocket"}

data:extend(locomotive, stoneFurnace, steelFurnace, boiler, burnerInsterter, car)
Again really hope this is the last time im asking this question. And I hope im not wasting your time with this.

Edit: Almost forgot, I still cant put rocket fuel in those god damned things!
Edit Edit:

Code: Select all

data:extend({{type = "fuel-category", name = "rocket"}})
data.raw.item["rocket-fuel"].fuel_category = "rocket"
this is still in one of my prototypes

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to define a specific fuel type for furnaces.

Post by DaveMcW »

Saniee wrote:
Mon Nov 09, 2020 9:34 pm

Code: Select all

data.raw["locomotive"]["locomotive"].burner.fuel_category = "chemical","rocket"
You need to use fuel_categories if you want more than one fuel. Also you need to delete fuel_category.

Code: Select all

data.raw["locomotive"]["locomotive"].burner.fuel_category = nil
data.raw["locomotive"]["locomotive"].burner.fuel_categories = {"chemical","rocket"}

Saniee
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Sep 27, 2020 9:08 am
Contact:

Re: How to define a specific fuel type for furnaces.

Post by Saniee »

DaveMcW wrote:
Mon Nov 09, 2020 10:31 pm
Saniee wrote:
Mon Nov 09, 2020 9:34 pm

Code: Select all

data.raw["locomotive"]["locomotive"].burner.fuel_category = "chemical","rocket"
You need to use fuel_categories if you want more than one fuel. Also you need to delete fuel_category.

Code: Select all

data.raw["locomotive"]["locomotive"].burner.fuel_category = nil
data.raw["locomotive"]["locomotive"].burner.fuel_categories = {"chemical","rocket"}
Thanks for clarifying. Works perfectly!

Post Reply

Return to “Modding help”