Page 1 of 1
I want to modify the content of function in another mod in my mod. Is there any way?
Posted: Sun Jun 05, 2022 11:39 am
by sdgmlj
His function is called by "control.lua". I only make small changes to apply to my mod, not destructive changes, and will not affect his mod. Is there any way?
Re: I want to modify the content of function in another mod in my mod. Is there any way?
Posted: Sun Jun 05, 2022 11:44 am
by sdgmlj
To put it simply, I want to modify the content of function in another mod. For example, the name is ABCDE (). Is there any way to modify it in my mod?
Re: I want to modify the content of function in another mod in my mod. Is there any way?
Posted: Sun Jun 05, 2022 2:05 pm
by FuryoftheStars
I think each mod’s control.lua is running in its own instance, so no, but I’m not 100% on that.
Re: I want to modify the content of function in another mod in my mod. Is there any way?
Posted: Sun Jun 05, 2022 5:00 pm
by Pi-C
sdgmlj wrote: Sun Jun 05, 2022 11:44 am
To put it simply, I want to modify the content of function in another mod. For example, the name is ABCDE (). Is there any way to modify it in my mod?
Overwriting another mod's function? I hope there's no way you can do that! Could you imagine what kind of nightmare it would be to debug a crash in your mod if somebody else changed one of your functions -- and you can't find anything wrong because your own code is correct, but the overwritten function isn't?
What you should do is to contact the author of the other mod and ask for some compatibility code, e.g. modifying the function if they detect that your mod is running.
Re: I want to modify the content of function in another mod in my mod. Is there any way?
Posted: Sun Jun 05, 2022 5:56 pm
by FuryoftheStars
Pi-C wrote: Sun Jun 05, 2022 5:00 pm
Overwriting another mod's function? I hope there's no way you can do that! Could you imagine what kind of nightmare it would be to debug a crash in your mod if somebody else changed one of your functions -- and you can't find anything wrong because your own code is correct, but the overwritten function isn't?
In the games where I’ve modded where this was possible, it wasn’t that bad. Typically the mods that did the overwriting or hooking of the other mod’s functions openly declared that they were, so if there was a problem, it was fairly easy to identify the offender. And at least in the case of an error, the game still knew which mod that code came from so could point you to the correct one.
It was also something of a God send, too, because then you could introduce mod compatibility between your mod and another, without having to wait (potentially) weeks or months for the other modder to do this, assuming they were even still around at all. (I’ve got a mod right now where I think I need to contact 3-4 different mod authors to have them change some code, otherwise my mod won’t work along side theirs.) It also prevents the other modder from needing to include compatibility in their mod for yours, and that person’s, and some other’s, etc, etc.
Personally, the benefits have always outweighed the troubles. But that’s not something I ever see this game doing. Aside from the fact that it would require some major reworking on the devs’ end, it’d probably break every mod in existence right now.
Re: I want to modify the content of function in another mod in my mod. Is there any way?
Posted: Sun Jun 05, 2022 6:02 pm
by ptx0
FuryoftheStars wrote: Sun Jun 05, 2022 5:56 pm
Pi-C wrote: Sun Jun 05, 2022 5:00 pm
Overwriting another mod's function? I hope there's no way you can do that! Could you imagine what kind of nightmare it would be to debug a crash in your mod if somebody else changed one of your functions -- and you can't find anything wrong because your own code is correct, but the overwritten function isn't?
In the games where I’ve modded where this was possible, it wasn’t that bad. Typically the mods that did the overwriting or hooking of the other mod’s functions openly declared that they were, so if there was a problem, it was fairly easy to identify the offender. And at least in the case of an error, the game still knew which mod that code came from so could point you to the correct one.
It was also something of a God send, too, because then you could introduce mod compatibility between your mod and another, without having to wait (potentially) weeks or months for the other modder to do this, assuming they were even still around at all. (I’ve got a mod right now where I think I need to contact 3-4 different mod authors to have them change some code, otherwise my mod won’t work along side theirs.) It also prevents the other modder from needing to include compatibility in their mod for yours, and that person’s, and some other’s, etc, etc.
Personally, the benefits have always outweighed the troubles. But that’s not something I ever see this game doing. Aside from the fact that it would require some major reworking on the devs’ end, it’d probably break every mod in existence right now.
yeah, this is why Barotrauma mods are really fun to develop. also, they give you complete source access to the game.