I created a mod that adds more labs. I added integration for bob's module lab but now it interferes with the 30 more science pack mod. I know the simple fix is to change the MSP files directly but I was wondering if I could fix it in my mod alone.
This is the MSP list I need to append.
local blacklistLabs ={"creative-mode-fix_creative-lab", "lab-module"}
How do you edit other mod lists/arrays from within your own mod
-
- Manual Inserter
- Posts: 4
- Joined: Thu Feb 01, 2018 1:45 am
- Contact:
Re: How do you edit other mod lists/arrays from within your own mod
You set the mod as a (optional) dependency, then clean up everything it did that you don't like.
Since the MSP blacklist is in data-updates.lua, you should also put your fix in data-updates.lua.
Since the MSP blacklist is in data-updates.lua, you should also put your fix in data-updates.lua.
-
- Manual Inserter
- Posts: 4
- Joined: Thu Feb 01, 2018 1:45 am
- Contact:
Re: How do you edit other mod lists/arrays from within your own mod
Here is my mod.
https://mods.factorio.com/mod/morelabs
How do I edit their list cause it is local and I can not seem to edit it, closest I think I got it to was this.
https://mods.factorio.com/mod/morelabs
How do I edit their list cause it is local and I can not seem to edit it, closest I think I got it to was this.
Code: Select all
if not morescience.blacklistLabs then morescience.blacklistLabs = {} end
if settings.startup["morelabs-modlabs"].value == true and settings.startup["morelabs-msp"].value == true then
morescience.blacklistLabs = {"creative-mode-fix_creative-lab", "lab-module", "lab-mod-mk2", "lab-mod-mk3", "lab-mod-mk4", "lab-mod-mk5", "lab-bigmod-mk1", "lab-bigmod-mk2", "lab-bigmod-mk3", "lab-bigmod-mk4", "lab-bigmod-mk5"}
end
Re: How do you edit other mod lists/arrays from within your own mod
You can't edit a local variable in another mod.
The only option is to undo whatever it did.
The only option is to undo whatever it did.
-
- Manual Inserter
- Posts: 4
- Joined: Thu Feb 01, 2018 1:45 am
- Contact:
Re: How do you edit other mod lists/arrays from within your own mod
So there is NO way for me to make my new labs not have the new sciences added without changing MSP. I think im going to contact the MSP creator and see if they could add that for me and other coders could have that useful function.
Re: How do you edit other mod lists/arrays from within your own mod
Here is an example of how to undo another mod's changes to data.raw:
You must put this in data-updates.lua.
Code: Select all
local base_inputs = {
"automation-science-pack",
"logistic-science-pack",
"military-science-pack",
"chemical-science-pack",
"production-science-pack",
"utility-science-pack",
"space-science-pack",
}
data.raw.lab["lab-mk2"].inputs = base_inputs
data.raw.lab["lab-mk3"].inputs = base_inputs
data.raw.lab["lab-mk4"].inputs = base_inputs
data.raw.lab["lab-mk5"].inputs = base_inputs
-
- Manual Inserter
- Posts: 4
- Joined: Thu Feb 01, 2018 1:45 am
- Contact:
Re: How do you edit other mod lists/arrays from within your own mod
Thank you, I will be implimenting this code with the needed changes and updating my mod then, Thanks.
Edit - Works completely now thanks, if you have any suggestions of anything I should add I would love to hear them
Edit - Works completely now thanks, if you have any suggestions of anything I should add I would love to hear them