Maris Posted January 14, 2015 Share Posted January 14, 2015 How to disable other mods from my mod? Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/ Share on other sites More sharing options...
Maris Posted January 14, 2015 Author Share Posted January 14, 2015 I mean that I need to disable some specific mods if and only if my mod is active. And if user turns off my mod then other mods should be active as usual. Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-602022 Share on other sites More sharing options...
imsomony Posted January 15, 2015 Share Posted January 15, 2015 Well, if you are hosting a world, then you are setting which mods are actively running for the server. Character- or Craftable- or WorldGen-mods need to be on the server, or clients can't properly use them. UI-only mods will be the clients choice (such as Always On Status, Geometric Placement, Gesture Wheel, etc). But I guess you are looking to disable even the UI type of mods also? Someone way more advanced in this will need to answer, I don't have the foggiest clue how to temp-disable a client-subscribed mod. I know, my comment doesn't help, mostly this is just to understand what you're working for here. Can you give an example of what you're trying to accomplish? If you don't want to reveal the full truth of your mod, can you come up with a comparable-fake example? Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-602080 Share on other sites More sharing options...
Developer PeterA Posted January 15, 2015 Developer Share Posted January 15, 2015 @Maris, I'm not sure what your reasons for disabling other mods are, but we do something similar when joining a server. If you have a mod enabled that is required by all clients when connecting, it is temporarily disabled.This code exists in networking.lua in the function DownloadMods. KnownModIndex:UpdateModInfo()for _,mod_name in pairs(ModManager:GetEnabledModNames()) do local modinfo = KnownModIndex:GetModInfo(mod_name) if modinfo.all_clients_require_mod then if server_listing_contains( server_listing.mods_description, mod_name ) then --we found it, so leave the mod enabled else --this mod is required by all clients but the server doesn't have it enabled, so locally disable it temporarily. print("Temp disabling ",mod_name) KnownModIndex:TempDisable(mod_name) end endendKnownModIndex:Save()There's actually a bug in there, "if modinfo.all_clients_require_mod then" should be "if not modinfo.client_only_mod then". Expect that to change in the next update.Your mod could probably hook into function ServerCreationScreen:Create(), looking for the other mods you want to disable and then call KnownModIndex:TempDisable and KnownModIndex:Save. That said, unless you have a really good reason why you want to disable another mod, it's probably better to structure your mod so that it doesn't conflict with others. Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-602101 Share on other sites More sharing options...
Developer PeterA Posted January 15, 2015 Developer Share Posted January 15, 2015 Your mod could probably hook into function ServerCreationScreen:Create() Actually that likely won't work for dedicated servers, which are coming very soon! But that may be acceptable for your purposes. Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-602103 Share on other sites More sharing options...
Maris Posted May 5, 2015 Author Share Posted May 5, 2015 It does not work because code is in modmain.lua while all mods are loading. But I found another solution. And now I have another question: How to get config options of another mod from my modmain.lua? Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-634610 Share on other sites More sharing options...
Maris Posted May 5, 2015 Author Share Posted May 5, 2015 (edited) I'm not sure what your reasons for disabling other mods areVery simple reasons. I have to disable certain client mods if it is incompatible with my "all_clients_reqiure" mod. I mean incompatible interface design in general (not the code). Edited May 5, 2015 by Maris Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-634612 Share on other sites More sharing options...
DarkXero Posted May 5, 2015 Share Posted May 5, 2015 GLOBAL.GetModConfigData("optionname", "othermodname", [get_local_config])which is almost like the one in the mod environment, it just passes the modname of your mod as parameter. It's in modutil. Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-634616 Share on other sites More sharing options...
Developer PeterA Posted May 5, 2015 Developer Share Posted May 5, 2015 Hey @Maris, @DarkXero beat me to it Link to comment https://forums.kleientertainment.com/forums/topic/49133-how-to-disable-other-mods/#findComment-634622 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now