Page 1 of 1
How to define a specific fuel type for furnaces.
Posted: Sun Sep 27, 2020 9:11 am
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.
Re: How to define a specific fuel type for furnaces.
Posted: Wed Sep 30, 2020 3:41 pm
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"
Re: How to define a specific fuel type for furnaces.
Posted: Mon Oct 05, 2020 7:11 pm
by Saniee
Thank you so much!
Edit: Sry for late response.
Re: How to define a specific fuel type for furnaces.
Posted: Tue Oct 06, 2020 8:05 am
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!
Re: How to define a specific fuel type for furnaces.
Posted: Thu Oct 22, 2020 9:39 am
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.)
Re: How to define a specific fuel type for furnaces.
Posted: Thu Oct 22, 2020 10:03 am
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.
Re: How to define a specific fuel type for furnaces.
Posted: Sat Oct 24, 2020 11:19 am
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.
Re: How to define a specific fuel type for furnaces.
Posted: Sat Oct 24, 2020 11:52 am
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.
Re: How to define a specific fuel type for furnaces.
Posted: Sat Oct 24, 2020 12:42 pm
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!
Re: How to define a specific fuel type for furnaces.
Posted: Mon Nov 09, 2020 9:34 pm
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
Re: How to define a specific fuel type for furnaces.
Posted: Mon Nov 09, 2020 10:31 pm
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"}
Re: How to define a specific fuel type for furnaces.
Posted: Tue Nov 10, 2020 8:01 am
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!