Small Mod For Turrets

This is the place to request new mods or give ideas about what could be done.
Post Reply
Meade
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Oct 30, 2018 5:02 am
Contact:

Small Mod For Turrets

Post by Meade »

Hey there,

Was looking into doing this myself but I have no modding experience what so ever... ended up finding the task too daunting especially when what I want to ask probably takes no time at all for an experienced modder to set up.

Returned to Factorio after about 5-6 months of playing other games and found that the Gun Turrets had become quite a bit more expensive to build. Or perhaps they always had that cost and I've just forgotten?

Either way, I wanted to ask if it might be possible for someone to whip up a mod that removes the need for copper and lowers the amount of iron plates needed to craft them?

Now, I don't mean to make it sound as if modding is easy by saying that I think it'd be a walk in the park to put something together that merely alters the resource amount of Gun Turrets. So please don't take it in that way, you modders are fantastic and I sure as hell don't have the skill or patience to do what you guys do.

Would really appreciate if someone could make this happen as I find the cost of turrets being quite a bit too high when adding in resource costs for ammunition, loaders and belts to ferry the stuff around.

Thanks in advance for any help you can provide!

//"Meade"

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

Re: Small Mod For Turrets

Post by darkfrei »

The changing of some recipe is really easy mod. Can you write which ingredients are you want and amount of them for one gun turret.
Do you want to make it by yourself?

Meade
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Oct 30, 2018 5:02 am
Contact:

Re: Small Mod For Turrets

Post by Meade »

Well... I would like to be able to write easy mods like that but I have no experience as I said.

No idea how or what to write in terms of code. I tried learning by looking at the setup of another mod I have which lowers the cost of landfill but I think they just changed the amount of landfill given from 1 to 20.

Hence it didn't have what I would've needed to re-write it.

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

Re: Small Mod For Turrets

Post by darkfrei »

Meade wrote:
Tue Oct 30, 2018 2:51 pm
Well... I would like to be able to write easy mods like that but I have no experience as I said.

No idea how or what to write in terms of code. I tried learning by looking at the setup of another mod I have which lowers the cost of landfill but I think they just changed the amount of landfill given from 1 to 20.

Hence it didn't have what I would've needed to re-write it.
It's not so complicated. Vanilla code is table OR just parameters:

Table:

Code: Select all

data:extend({
  {
    type = "recipe",
    name = "gun-turret",
    enabled = false,
    energy_required = 8,
    ingredients =
    {
      {"iron-gear-wheel", 10},
      {"copper-plate", 10},
      {"iron-plate", 20}
    },
    result = "gun-turret"
  }
})
Same code, but as list of parameters:

Code: Select all

data.raw.recipe["gun-turret"].type = "recipe" 
data.raw.recipe["gun-turret"].name = "gun-turret" 
data.raw.recipe["gun-turret"].enabled = false 
data.raw.recipe["gun-turret"].energy_required = 8 
data.raw.recipe["gun-turret"].ingredients[1][1] = "iron-gear-wheel" 
data.raw.recipe["gun-turret"].ingredients[1][2] = 10 
data.raw.recipe["gun-turret"].ingredients[2][1] = "copper-plate" 
data.raw.recipe["gun-turret"].ingredients[2][2] = 10 
data.raw.recipe["gun-turret"].ingredients[3][1] = "iron-plate" 
data.raw.recipe["gun-turret"].ingredients[3][2] = 20 
data.raw.recipe["gun-turret"].result = "gun-turret" 

You can change this recipe just so:

Code: Select all

data.raw.recipe["gun-turret"].ingredients = 
  {
    {"iron-gear-wheel", 10},
    {"iron-plate", 20}
  }
And you haven't copper plates in ingredient anymore. You can add this code to any data.lua and save the file without BOM (use Notepad++ for it).

Setup info.json (just take it from another mod and change mod name, version, author and mod description).
For mod MyTestMod you are need folder with the name MyTestMod_0.0.1, place there file info.json with this content:

Code: Select all

{
  "name": "MyTestMod",
  "version": "0.0.1",
  "title": "My Test Mod",
  "author": "Author Name",
  "description": "I want to test new features",
  "dependencies": ["base"],
  "factorio_version": "0.16"
}
Mod example (use zip archives only):
MyTestMod_0.0.1.zip
(721 Bytes) Downloaded 46 times
2018-10-30 21_46_44-Factorio 0.16.51.png
2018-10-30 21_46_44-Factorio 0.16.51.png (56.55 KiB) Viewed 1599 times

Meade
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Oct 30, 2018 5:02 am
Contact:

Re: Small Mod For Turrets

Post by Meade »

Thanks for setting up this mod Darkfrei and the information you provided, really appreciate it! :)

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

Re: Small Mod For Turrets

Post by darkfrei »

Meade wrote:
Wed Oct 31, 2018 8:46 pm
Thanks for setting up this mod Darkfrei and the information you provided, really appreciate it! :)
You can get whole data.lua table with this mod: viewtopic.php?f=135&t=45107
If you want to change only one parameter, then enough:

Code: Select all

data.raw.recipe["gun-turret"].ingredients[1][2] = 1
It changes amount of iron gears to 1, see code above.

Post Reply

Return to “Ideas and Requests For Mods”