Hi,
is it possible to remove/change funcions or recipes from mods with another mod?
If yes, are there examples of it or how this would be done?
lets say i have downloaded mod-A from the mod portal but i dont like certain functions or recipes added by that mod.
so my usual action would be: unzip the mod and change it directly and be happy about it.
when i want to do this in multiplayer this would not be practical because i would have to send everyone the modded files or redistribute the mod on my own.. wich may lead to drama and dispute over copyright stuff.
so i thougt of mod-B that would change mod-A without any problems. since i dont change or redistribute mod-A there would be no copyright drama.
Thanks in advance!
Modifying a mod with another mod
Re: Modifying a mod with another mod
I did this with Combat by Samuel + minus. It's a mod that just adds options to modify attributes set by another mod. The important thing is, you need to make sure that the other mod is loaded before yours, so it doesn't revert your changes. You can achieve this by adding a dependency in info.json. I did it this way:
Code: Select all
"dependencies": ["base >= 0.17.0", "Combat_by_Samuel >= 1.1.1"]
Code: Select all
"[?|(?)|!] ModName [ModVersion specifier]"
- "? ModName" marks an optional dependency: If ModName is active, it will be loaded before your mod.
- "(?) ModName" marks a hidden optional dependency: It's just the same as a normal optional dependency, but won't be listed by the game's mods manager.
- "! ModName" marks a conflict: Only one of the mods can be active.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: Modifying a mod with another mod
It is not possible to change or remove functions in another mod.
It is very easy to change recipes that were registered by another mod by simply ensuring your code runs after the data you need to modify is registered.
This can be done by depending on that mod (so it loads first), or by using the next data stage (e.g. if the mod uses data-updates, i can put my changes in data-final-fixes).
During the control stage you cannot interact with other mods without the use of remotes.
https://lua-api.factorio.com/latest/LuaRemote.html
Re: Modifying a mod with another mod
Ooops, didn't notice the functions part when I replied previously …
Wouldn't a dependency be safer? Using the next data stage wouldn't work if the other mod changed something there as well. Also, what works today (e.g. the other mod only acts in data.lua, yours in data-updates.lua) could break tomorrow (if the other mod is changed to act in, say, data-final-fixes.lua).It is very easy to change recipes that were registered by another mod by simply ensuring your code runs after the data you need to modify is registered.
This can be done by depending on that mod (so it loads first), or by using the next data stage (e.g. if the mod uses data-updates, i can put my changes in data-final-fixes).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: Modifying a mod with another mod
Dependency is definitely safer. Please save data-final-fixes for mods that actually need it.