[GUIDE] Furnace Mod 101
Posted: Thu Feb 28, 2013 5:53 am
Creating a furnace 101
This is a quick tutorial on how I created an iron furnace in factorio.
I'm on windows 7 64-bit so my data folder is inside of C:\Program Files\Factorio\data\
if you have a different OS your data folder will probably be somewhere else (i don't know where but you should be able to look it up, or ask on here)
First on windows systems make sure that you can actually see file extensions (if not open a folder and find the 'organize' button click it and then 'folder and serach options' when that is open there are three tabs 'general', 'view', and 'search'. click on 'view' and you'll see a bunch of options with checkboxes next to them, without scrolling at the bottom of the list should be 'hide extensions for known file types' UNcheck this box and then click ok) otherwise when you use notepad to create a json file it will mostly likely save as a .json.txt file and you probably wouldn't notice until you tried to start factorio and it acted as if your mod didn't exist (because factorio would not read the .txt files)
next create an iron-furnace.json file inside of data\prototype-definitions\entity (you can open the folder and right click>new>'text document' just be sure that you change the .txt extension to .json
then open up the demo-entities.json file and copy+paste the entry for the stone-furnace make sure you include everything from the { above "type": "furnace", to the }.
Now change the values to what you want them to be. Most of the names are self-explanatory, if you can't figure it out by the name, then edit the values by a large fraction (like from .001 to .5 and see what the result is. in my iron-furnace I made it cook 2x as fast but only be 65% as efficient. As well as setting the health to 50 (it's made of iron not stone after all). Play around with the values and see what you like (and what feels balanced)
For example, i made mine:
make sure you change the name from stone-furnace to iron-furnace, the same with the "minable" result and the png files for picture (I usually use ctrl+h to open the 'find and repace' menu and simply change all references at the same time)
You can create the images now (they are saved in the data\resources\entity folder), all i did was copy the stone-furnace image and increase it's brightness so it was more white than gray (or you could simply copy the stone-furnace image and without modifying it as a placeholder, just remember to change it's name to iron-furnace). Now it is not referenced in this file but you will also need an icon picture in data\resources\icon (again i copied the stone-furnace in the icons folder and made it brighter)
You could also wait until later to create the images, if you forget, well you'll be told when you go to start factorio
next you will need to create an iron-furnace.json file inside of \prototype-definitions\item
inside you could either copy and paste the stone-furnace info from demo-item.json or copy and paste this:
You will then need another iron-furnace.json file inside of \prototype-definitions\recipe
the format is:
now you need a way to unlock the recipe, I initially added it to the techonology.json file inside of prototype-definitions\technology\technology.json
under iron-working there is an "effects" block, copy and paste:
to be underneath the iron-chest. now when iron-working is researched it unlocks your iron-furnace recipe.
Or (as i eventually did) you could create your own research branch by simply copying the entire iron-working block to a new .json file (from the [ to }) and changing the name and inserting your unlock-recipes in there (remember to add a closing ] at the end of the file and you'll need to remove the comma on the next to last line or you'll get an 'expected value' error. (note if you do create a research branch you will also need a technology icon under data\resources\technology\icons)
The last thing you need to do is open the data\locale\[your language]\entity-names.cfg add
If you created your own research branch you will also need to name it in technology-names.cfg (ex. )
If you skip the locale steps then in the game your furnaces gui will show up as Unknown Key:"entity.iron-furnace" and (if you made one) your technology name will be Unknown key:"technology-name.iron-furnace" (not exactly what we want now is it?)
That's it, you have now created your own furnace that does whatever you want.
if you want you can download the mod i made for myself (it took about 5-7 hours for me to figure all of this out) and look it all over to see what exactly i did and how i did it. Hope it helps someone out. http://www.freewebs.com/hjp1993/Factori ... urnace.zip
P.S. I know this is not a great tutorial, mainly because I did not even try to cover what everything meant however it's about midnight for me right now and I don't even know if people will find this particuarly useful. If it turns out that people like this I'll probably rewrite it and try to make it more of an actual tutorial than a technical 'do this to achieve this' post like it is right now.
This is a quick tutorial on how I created an iron furnace in factorio.
I'm on windows 7 64-bit so my data folder is inside of C:\Program Files\Factorio\data\
if you have a different OS your data folder will probably be somewhere else (i don't know where but you should be able to look it up, or ask on here)
First on windows systems make sure that you can actually see file extensions (if not open a folder and find the 'organize' button click it and then 'folder and serach options' when that is open there are three tabs 'general', 'view', and 'search'. click on 'view' and you'll see a bunch of options with checkboxes next to them, without scrolling at the bottom of the list should be 'hide extensions for known file types' UNcheck this box and then click ok) otherwise when you use notepad to create a json file it will mostly likely save as a .json.txt file and you probably wouldn't notice until you tried to start factorio and it acted as if your mod didn't exist (because factorio would not read the .txt files)
next create an iron-furnace.json file inside of data\prototype-definitions\entity (you can open the folder and right click>new>'text document' just be sure that you change the .txt extension to .json
then open up the demo-entities.json file and copy+paste the entry for the stone-furnace make sure you include everything from the { above "type": "furnace", to the }.
Now change the values to what you want them to be. Most of the names are self-explanatory, if you can't figure it out by the name, then edit the values by a large fraction (like from .001 to .5 and see what the result is. in my iron-furnace I made it cook 2x as fast but only be 65% as efficient. As well as setting the health to 50 (it's made of iron not stone after all). Play around with the values and see what you like (and what feels balanced)
For example, i made mine:
Code: Select all
"heat-loss": 0.006,
"heat-transport-speed": 0.03,
"burning-speed": 0.002,
"effectivity": 650,
You can create the images now (they are saved in the data\resources\entity folder), all i did was copy the stone-furnace image and increase it's brightness so it was more white than gray (or you could simply copy the stone-furnace image and without modifying it as a placeholder, just remember to change it's name to iron-furnace). Now it is not referenced in this file but you will also need an icon picture in data\resources\icon (again i copied the stone-furnace in the icons folder and made it brighter)
You could also wait until later to create the images, if you forget, well you'll be told when you go to start factorio
next you will need to create an iron-furnace.json file inside of \prototype-definitions\item
inside you could either copy and paste the stone-furnace info from demo-item.json or copy and paste this:
Code: Select all
[
{
"type": "item",
"name": "iron-furnace",
"place-result": "iron-furnace",
"order": "h-b-a",
"stack-size": 64,
"flags": [ "goes-to-quickbar" ]
}
]
the format is:
Code: Select all
[
{
"result": "iron-furnace",
"ingredients": { "stone-furnace": 1, "iron-plate": 8 },
"enabled": "false"
}
]
under iron-working there is an "effects" block, copy and paste:
Code: Select all
{
"type" : "unlock-recipe",
"recipe" : "iron-furnace"
}
Or (as i eventually did) you could create your own research branch by simply copying the entire iron-working block to a new .json file (from the [ to }) and changing the name and inserting your unlock-recipes in there (remember to add a closing ] at the end of the file and you'll need to remove the comma on the next to last line or you'll get an 'expected value' error. (note if you do create a research branch you will also need a technology icon under data\resources\technology\icons)
The last thing you need to do is open the data\locale\[your language]\entity-names.cfg add
Code: Select all
iron-furnace=Iron Furnace
Code: Select all
iron-furnace=Furnace Upgrades
If you skip the locale steps then in the game your furnaces gui will show up as Unknown Key:"entity.iron-furnace" and (if you made one) your technology name will be Unknown key:"technology-name.iron-furnace" (not exactly what we want now is it?)
That's it, you have now created your own furnace that does whatever you want.
if you want you can download the mod i made for myself (it took about 5-7 hours for me to figure all of this out) and look it all over to see what exactly i did and how i did it. Hope it helps someone out. http://www.freewebs.com/hjp1993/Factori ... urnace.zip
P.S. I know this is not a great tutorial, mainly because I did not even try to cover what everything meant however it's about midnight for me right now and I don't even know if people will find this particuarly useful. If it turns out that people like this I'll probably rewrite it and try to make it more of an actual tutorial than a technical 'do this to achieve this' post like it is right now.