How to define a specific fuel type for furnaces.
How to define a specific fuel type for furnaces.
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.
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.
Thank you so much!
Edit: Sry for late response.
Edit: Sry for late response.
Re: How to define a specific fuel type for furnaces.
No problem, you are welcome!
Re: How to define a specific fuel type for furnaces.
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/furnacesPlusdarkfrei wrote: ↑Wed Sep 30, 2020 3:41 pmCode: 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"
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.
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.
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.darkfrei wrote: ↑Thu Oct 22, 2020 10:03 amI'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.
- Attachments
-
- in game testing
- factorio_XW4XjrmZeZ.png (16.55 KiB) Viewed 2500 times
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: How to define a specific fuel type for furnaces.
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.
Honestly dont know why I didnt thinked of this before. Thank you!Deadlock989 wrote: ↑Sat Oct 24, 2020 11:52 amFuel 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.
Ok so... Gosh this is something. Im getting somewhere. I moved the declaracion of fuel categories to data-final-fixes.lua.
the code there:
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:
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: this is still in one of my prototypes
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"
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)
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"
Re: How to define a specific fuel type for furnaces.
You need to use fuel_categories if you want more than one fuel. Also you need to delete fuel_category.Saniee wrote: ↑Mon Nov 09, 2020 9:34 pmCode: Select all
data.raw["locomotive"]["locomotive"].burner.fuel_category = "chemical","rocket"
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.
Thanks for clarifying. Works perfectly!DaveMcW wrote: ↑Mon Nov 09, 2020 10:31 pmYou need to use fuel_categories if you want more than one fuel. Also you need to delete fuel_category.Saniee wrote: ↑Mon Nov 09, 2020 9:34 pmCode: Select all
data.raw["locomotive"]["locomotive"].burner.fuel_category = "chemical","rocket"
Code: Select all
data.raw["locomotive"]["locomotive"].burner.fuel_category = nil data.raw["locomotive"]["locomotive"].burner.fuel_categories = {"chemical","rocket"}