I want to make a mod which allows various things, such as better power armour, a personal robo-port that draws from your inventory, fluid tank wagons for trains, etc.
How would i be able to find the code for things like power armour, robo-ports, fluid tanks, etc?
Just started coding, and need an idea of where to base the code.
Edit: Do i have to simply base these off of descriptions in the game, as i can't find any code for items/entities at all.
How Can I Find This?
-
- Long Handed Inserter
- Posts: 80
- Joined: Sat Jan 10, 2015 3:42 am
- Contact:
-
- Burner Inserter
- Posts: 19
- Joined: Tue Aug 19, 2014 12:47 pm
- Contact:
Re: How Can I Find This?
You Factorio directory contains /data/base. There you can find the base mod which contains a whole lot of things. If you want to create a custom item or entity this is a great place to start. Do you know how to add an item/entity into the game? If not you should read this to get started.
You can find the basic power armor item in /data/base/prototypes/item/armor.lua:
and then copy and paste that into your own mod to create your custom power armor. However, you can't see or modify most of the game's code/logic, so some things just can't be done in a sensible way at this time.
You can also find the locomotive/cargo wagons in /data/base/prototypes/entity/entities.lua. They're called "diesel-locomotive" and "cargo-wagon" respectively.
Another great resource is looking at other people's mods. Find a mod which is close to what you want to do, download it, extract it, and look at how the author created it and maybe you can figure out how to do what you want to do.
I recommend a text editor with the functionality to search through files (like Notepad++ if you're on windows) so you can search the whole /data/base directory for a certain item.
You can find the basic power armor item in /data/base/prototypes/item/armor.lua:
Code: Select all
{
type = "armor",
name = "power-armor",
icon = "__base__/graphics/icons/power-armor.png",
flags = {"goes-to-main-inventory"},
resistances =
{
{
type = "physical",
decrease = 8,
percent = 30
},
{
type = "acid",
decrease = 7,
percent = 30
},
{
type = "explosion",
decrease = 15,
percent = 30
}
},
durability = 15000,
subgroup = "armor",
order = "d[power-armor]",
stack_size = 1,
equipment_grid = {width = 7, height = 7}
},
You can also find the locomotive/cargo wagons in /data/base/prototypes/entity/entities.lua. They're called "diesel-locomotive" and "cargo-wagon" respectively.
Another great resource is looking at other people's mods. Find a mod which is close to what you want to do, download it, extract it, and look at how the author created it and maybe you can figure out how to do what you want to do.
I recommend a text editor with the functionality to search through files (like Notepad++ if you're on windows) so you can search the whole /data/base directory for a certain item.
-
- Long Handed Inserter
- Posts: 80
- Joined: Sat Jan 10, 2015 3:42 am
- Contact:
Re: How Can I Find This?
Thanks for the help! I didn't realize the code would be in that folder, and thought that was just for generating the world, the title screen, etc.
Edit: Can't find the data folder, would it be in the Factorio folder inside of Roaming?
Also: I'm on windows, if that matters.
Edit: Can't find the data folder, would it be in the Factorio folder inside of Roaming?
Also: I'm on windows, if that matters.
-
- Burner Inserter
- Posts: 19
- Joined: Tue Aug 19, 2014 12:47 pm
- Contact:
Re: How Can I Find This?
I'm on windows as well. I set it to not use the %appdata% directory though.
For me the folder is at D:/Win8/Spel/Factorio/data/ where Factorio is my install dir. If it's not there it ought to be in the %appdata% (roaming) directory
For me the folder is at D:/Win8/Spel/Factorio/data/ where Factorio is my install dir. If it's not there it ought to be in the %appdata% (roaming) directory
Re: How Can I Find This?
I find the zip versions much easier to edit, as all the files are contained within the one directory you extract.
As for modding, yes, there are *Many* mods on the forums, and I don't know if there's a single part of the game that hasn't been modded at some point. Look throughout this subforum for mods that sound like they're similar to what you want. Particularly, use the search box with a couple terms at a time.
Also useful is the Factorio wiki and it's documentation of the various variables, methods, and definitions. (Only partially documented now, as it's been awhile since it was updated, and several new entries are missing from most categories.)
As for modding, yes, there are *Many* mods on the forums, and I don't know if there's a single part of the game that hasn't been modded at some point. Look throughout this subforum for mods that sound like they're similar to what you want. Particularly, use the search box with a couple terms at a time.
Also useful is the Factorio wiki and it's documentation of the various variables, methods, and definitions. (Only partially documented now, as it's been awhile since it was updated, and several new entries are missing from most categories.)
-
- Long Handed Inserter
- Posts: 80
- Joined: Sat Jan 10, 2015 3:42 am
- Contact:
Re: How Can I Find This?
That's the problem. I can't find the data folder, and have even looked in any hidden folders, which apparently don't exist. I used Run (Win7), put in C:\Users\Us\AppData\Roaming\Factorio\data, and still nothing. I have no clue what is going on here.ForFoxAche wrote:I'm on windows as well. I set it to not use the %appdata% directory though.
For me the folder is at D:/Win8/Spel/Factorio/data/ where Factorio is my install dir. If it's not there it ought to be in the %appdata% (roaming) directory
If anyone can tell me how to insert an image, i will put my Factorio directory in the main post.
-
- Burner Inserter
- Posts: 19
- Joined: Tue Aug 19, 2014 12:47 pm
- Contact:
Re: How Can I Find This?
Try searching through your entire HDD(s) for some of the files in the /data/ folder. Here are some examples that are all in /data/ or in one of its subfolders:DoctorWho? wrote:That's the problem. I can't find the data folder, and have even looked in any hidden folders, which apparently don't exist
laser-turret-upgrades.lua
shotgun-shell-upgrades.lua
basic-electric-discharge-defense-equipment.png
express-transport-belt-to-ground.png
acid-projectile-purple-shadow.png
assembling-machine-t3-2.ogg
inserter-long-handed.ogg
I picked out a few that are probably unique to Factorio.
In case you don't know how to search, just open up the explorer and click "This PC", in the top right there's a search box. Make sure it says "Search This PC", and then type in something like "basic-electric-discharge-defense-equipment.png" without the quotes. Make sure to enable hidden folders. It could take a while to search through every single HDD.
When you find one of the files you can just right-click it and click "Open file location"
Good luck
-
- Long Handed Inserter
- Posts: 80
- Joined: Sat Jan 10, 2015 3:42 am
- Contact:
Re: How Can I Find This?
Thanks for the help!ForFoxAche wrote:Try searching through your entire HDD(s) for some of the files in the /data/ folder. Here are some examples that are all in /data/ or in one of its subfolders:DoctorWho? wrote:That's the problem. I can't find the data folder, and have even looked in any hidden folders, which apparently don't exist
laser-turret-upgrades.lua
shotgun-shell-upgrades.lua
basic-electric-discharge-defense-equipment.png
express-transport-belt-to-ground.png
acid-projectile-purple-shadow.png
assembling-machine-t3-2.ogg
inserter-long-handed.ogg
I picked out a few that are probably unique to Factorio.
In case you don't know how to search, just open up the explorer and click "This PC", in the top right there's a search box. Make sure it says "Search This PC", and then type in something like "basic-electric-discharge-defense-equipment.png" without the quotes. Make sure to enable hidden folders. It could take a while to search through every single HDD.
When you find one of the files you can just right-click it and click "Open file location"
Good luck
-
- Filter Inserter
- Posts: 402
- Joined: Fri May 23, 2014 8:54 am
- Contact:
Re: How Can I Find This?
All these mods exist already so you probably want to just download them and read the code.DoctorWho? wrote:I want to make a mod which allows various things, such as better power armour, a personal robo-port that draws from your inventory, fluid tank wagons for trains, etc.
How would i be able to find the code for things like power armour, robo-ports, fluid tanks, etc?
Just started coding, and need an idea of where to base the code.
Edit: Do i have to simply base these off of descriptions in the game, as i can't find any code for items/entities at all.
Advanced Equipment
Pocket Bots
Rail Tanker
-
- Burner Inserter
- Posts: 9
- Joined: Fri Mar 18, 2016 10:16 pm
- Contact:
Re: How Can I Find This?
I found my data folder in C:\Program Files\FactorioDoctorWho? wrote:That's the problem. I can't find the data folder, and have even looked in any hidden folders, which apparently don't exist. I used Run (Win7), put in C:\Users\Us\AppData\Roaming\Factorio\data, and still nothing. I have no clue what is going on here.ForFoxAche wrote:I'm on windows as well. I set it to not use the %appdata% directory though.
For me the folder is at D:/Win8/Spel/Factorio/data/ where Factorio is my install dir. If it's not there it ought to be in the %appdata% (roaming) directory
If anyone can tell me how to insert an image, i will put my Factorio directory in the main post.