Overriding someone else's mod
Re: Overriding someone else's mod
Thanks. Right now I'm just messing about with your ores, so I'm going to use the shortcut, but that extra info is handy if I ever add compatibility with other mods.
Also, the ore still pops up in the map generator. How do I remove it from that list?
Also, the ore still pops up in the map generator. How do I remove it from that list?
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Overriding someone else's mod
using bobmods.ores.gold.enabled = false should turn that off if you put it in the data stage (not updates or final fixes).
if it doesn't work for whatever reason, use the other method I mentioned.
if it doesn't work for whatever reason, use the other method I mentioned.
- Arch666Angel
- Smart Inserter
- Posts: 1636
- Joined: Sun Oct 18, 2015 11:52 am
- Contact:
Re: Overriding someone else's mod
Depends really on what you want to achieve. For simply disabling the ores bob provided a number of ways to do it.CMH wrote:@Arch666Angel: I had a look at your mod. I don't really understand how you have programmed the ore generation. Would appreciate a bit of explanation to what you have done![]()
Also, wondering how to remove an ore from bobsores (say I'd like to remove gold ore fields from being generated).
I'm thinking the easiest way would be for me to totally remove the ores I don't need, and re-write the ores>plates to the ones I want. There's no real need for me to generate new ores if I can just take over the ones already generated, although it does mean I'll need to remove the ones I don't want.
p.s. I will post my mod here when I think I've got enough for a release
viewtopic.php?f=97&t=26024
Important is that you have set the dependency to bobores, so they will load BEFORE your own mod and than it's also best to place your override in the data-updates.lua.
What I do in my mods happens in two places, there is the ore disabling in angelsinfiniteores/prototypes/angels-override:
Code: Select all
if bobmods.ores then
data.raw.resource["bauxite-ore"] = nil
data.raw["autoplace-control"]["bauxite-ore"] = nil
data.raw.resource["cobalt-ore"] = nil
data.raw["autoplace-control"]["cobalt-ore"] = nil
data.raw.resource["gem-ore"] = nil
data.raw["autoplace-control"]["gem-ore"] = nil
data.raw.resource["gold-ore"] = nil
data.raw["autoplace-control"]["gold-ore"] = nil
data.raw.resource["lead-ore"] = nil
data.raw["autoplace-control"]["lead-ore"] = nil
data.raw.resource["nickel-ore"] = nil
data.raw["autoplace-control"]["nickel-ore"] = nil
data.raw.resource["quartz"] = nil
data.raw["autoplace-control"]["quartz"] = nil
data.raw.resource["rutile-ore"] = nil
data.raw["autoplace-control"]["rutile-ore"] = nil
data.raw.resource["silver-ore"] = nil
data.raw["autoplace-control"]["silver-ore"] = nil
data.raw.resource["sulfur"] = nil
data.raw["autoplace-control"]["sulfur"] = nil
data.raw.resource["tin-ore"] = nil
data.raw["autoplace-control"]["tin-ore"] = nil
data.raw.resource["tungsten-ore"] = nil
data.raw["autoplace-control"]["tungsten-ore"] = nil
data.raw.resource["zinc-ore"] = nil
data.raw["autoplace-control"]["zinc-ore"] = nil
end
Another way is to delete the autoplace-control, the noise-layer and the autoplace from the resource entity, but keeping the rest of the resource entity for mod which are dependend on that, I ran into an issue for example with landfill when I disabled the stone resource entity.
Angels Mods
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ

"should be fixed"
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ

"should be fixed"
Re: Overriding someone else's mod
@bobingabout: ah, it works now. I did put it in data-updates, that was the problem! Thanks.
@Arch66Angel: Ok, that makes sense. Problem with looking at someone else's mod is that there's so many files, and the codes refer everywhere I wasn't sure exactly what I should be looking at.
@Arch66Angel: Ok, that makes sense. Problem with looking at someone else's mod is that there's so many files, and the codes refer everywhere I wasn't sure exactly what I should be looking at.
- Arch666Angel
- Smart Inserter
- Posts: 1636
- Joined: Sun Oct 18, 2015 11:52 am
- Contact:
Re: Overriding someone else's mod
I also did start with trying to understand what other people did, specially bob. And the real magic is in using functions and doing stuff with scripts. Most of what I do with my mods is pure modifying other and writing new entity definitions...and graphics of course.CMH wrote:@bobingabout: ah, it works now. I did put it in data-updates, that was the problem! Thanks.
@Arch66Angel: Ok, that makes sense. Problem with looking at someone else's mod is that there's so many files, and the codes refer everywhere I wasn't sure exactly what I should be looking at.
Angels Mods
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ

"should be fixed"
I. Angel's Mods Subforum
II. Development and Discussion
III. Bugs & FAQ

"should be fixed"
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Overriding someone else's mod
That's how I started.Arch666Angel wrote:I also did start with trying to understand what other people did, specially bob. And the real magic is in using functions and doing stuff with scripts. Most of what I do with my mods is pure modifying other and writing new entity definitions...and graphics of course.
Then you realise that there's cases where you do the same thing over and over.
and then you do the same thing in 2 mods, so it happens twice, and causes a crash, so you need to do a check before you do it.
before you know it, you have this huge sprawling if block doing endless checks, repeated several times, so you make it a function to reduce the size of your code, and repeatings.
then you end up using the same function in multiple mods that were doing the same, or similar things.
so you remove the repeating functions from each mod, and put them in a common mod, and then you end up with a library.
And then you find the library is so useful, you start to shift away from edited blocks of copied code, to using mostly functions to build it for you.
And that's how my mods ended up as they are now.
Re: Overriding someone else's mod
Doubt mine will come anywhere close to the complexity of either of your mods guys.
Anyway, a new hurdle: adding my own technology.
I've put this into a technology.lua file, but it gives me a "Error while loading technology prototype "aluminium-titanium" (technology): No such node (type)" error.
Anyway, a new hurdle: adding my own technology.
I've put this into a technology.lua file, but it gives me a "Error while loading technology prototype "aluminium-titanium" (technology): No such node (type)" error.
Code: Select all
data:extend(
{
{
type = "technology",
name = "aluminium-titanium",
icon = "__CMHMod__/graphics/icons/aluminium-titanium2.png",
prerequisites =
{ "aluminium-processing", "titanium-processing", },
effects =
{ type = "unlock-recipe",
recipe = "aluminium-titanium",
},
unit =
{
count = 75,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 1},
{"science-pack-3", 1},
{"science-pack-4", 1},
},
time = 30,
}
}
}
)
Re: Overriding someone else's mod
effects should be a table of tables.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Overriding someone else's mod
Sorry, I'm kinda new to this. What do you mean?
p.s. I figured out what you meant. Thanks
p.s. I figured out what you meant. Thanks

- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Overriding someone else's mod
{} denotes a table. {{}} denotes a table in a table.CMH wrote:Sorry, I'm kinda new to this. What do you mean?
p.s. I figured out what you meant. Thanks
Effects requires a table of tables.
This means you want..
effects = {
{unlock 1},
{unlock 2},
etc
},
in this specific instance, you need to replace this
Code: Select all
effects =
{ type = "unlock-recipe",
recipe = "aluminium-titanium",
},
Code: Select all
effects = {
{
type = "unlock-recipe",
recipe = "aluminium-titanium"
}
},
Code: Select all
effects = {
{ type = "unlock-recipe", recipe = "aluminium-titanium" }
},
Re: Overriding someone else's mod
Thanks for explaining it.
Just for those interested a version of this mod is up.
viewtopic.php?f=97&t=26024
Just for those interested a version of this mod is up.
viewtopic.php?f=97&t=26024
Re: Overriding someone else's mod
@bobingabout
I've just run into a small issue with boblibrary.
I'm trying to get a recipe to change from alien science to your science 4, but it doesn't seem to want to change.
Here's the coding:
The game loads up fine, but it still requires alien science instead of science pack 4.
I've just run into a small issue with boblibrary.
I'm trying to get a recipe to change from alien science to your science 4, but it doesn't seem to want to change.
Here's the coding:
Code: Select all
if data.raw.tool["science-pack-4"] then
bobmods.lib.replace_science_pack ("aluminium-titanium", "alien-science-pack", "science-pack-4")
end
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Overriding someone else's mod
Due to the fact that most of the errors that occur in the library mod basically just point you to the line in the library mod, I took the approach that the library functions will do as many checks as possible to see if the data you are passing it is valid, and if it isn't, just discard it and cancel. Of course this isn't the case everywhere yet, certain functions will still error rather than drop it, but the one in your example is one of the ones that does not error. If there is no error, and you are not seeing the expected results, the issue is most likely that you did something wrong.
The first thing I would check is if your spelling is correct. I would also suggest that if it is in the data.lua phase that you move it to data-updates.lua phase instead, the non-existing item drop-out might be a result of the science-pack-4 item not existing yet if it is in the data phase.
That's about as much information I can think of right now that might be useful.
The first thing I would check is if your spelling is correct. I would also suggest that if it is in the data.lua phase that you move it to data-updates.lua phase instead, the non-existing item drop-out might be a result of the science-pack-4 item not existing yet if it is in the data phase.
That's about as much information I can think of right now that might be useful.
Re: Overriding someone else's mod
Thanks.
I fixed the problem, but it was my coding noobiness that did it.
I didn't think that the order of the "requires" in data.lua mattered (it definitely does!).
I fixed the problem, but it was my coding noobiness that did it.
I didn't think that the order of the "requires" in data.lua mattered (it definitely does!).
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Overriding someone else's mod
Glad to hear you figured it out.