Page MenuHomeFeedback Tracker

Feature Request: Proper support for Softdependencies
Feedback, UrgentPublic

Description

Since there are a lot of different mods for things like maps or other extra functionality, many mods implement extra plugins to be compatible with most of the other mods, but there is one big Problem I have never been able to fully get to work:

Adding mods only as Softdepenndencies instead of Required Dependencies.

We have the #ifdef MOD_DEFINE thing, which also has been greatly reworked with one of the last updates to automatically add a define with the name of the CfgMods Class in the config.cpp, which is really good to have, but that still does not ensure, that these mods are loaded first.

I am currently using something like this, but I noticed, that it doesn't even work, since it seems like the ifdef is never set to that time:

class CfgPatches {
	class MyModName {
		requiredAddons[] = {
			"DZ_Data"
			#ifdef BASEBUILDINGPLUS
			,"BasebuildingPlus"
			#endif
		};
	};
};

So basically we have to hope, that the scripts of Basebuilding plus are loaded before my mod tries to use anything of the scripts.

The problem is, that loading different mods with different required addons affect this loadorder in a way, that this may work for some people, but not for everyone, which can be really annoying

my suggestion would be so simply add annother option to the same place as the requiredAddon, which could be named preloadedAddons, where one could add other mod names without having to add them to the requiredAddons and getting an error when this mod is not loaded. It would basically just try to load it first if it's found, or just ignore it when it's not found.

so the example from above would become:

class CfgPatches {
	class MyModName {
		requiredAddons[] = {
			"DZ_Data"
		};
		preloadedAddons[] = {
			"BasebuildingPlus"
		};
	};
};

That would make it finally possible to do some proper plugins for other mods without having to create multiple PBOs only loading the code when needed to use their functions

Details

Severity
Feature
Resolution
Open
Reproducibility
Random
Operating System
Windows 7
Category
General

Event Timeline

Geez changed the task status from New to Feedback.Nov 20 2023, 11:11 AM

I just saw a fix for "Can't find matching overload for function Error" was scheduled for the 1.24 update and I wanted to emphasize, that this has also been a major problem for me in the past, that sometimes the loadorder of mods is not the way you need to have it and supporting a load of different mods will get very tedious without some proper softdependencies. Currently it's just luck if it works or I have to make a seperate PBO for the plugin, which is not really doable especially for only a few lines of code for every plugin.

Also I think this should be reletavely easy to add, the main part is already implemented with the requiredAddons, just don't throw an error if it's a preloadedAddons entry and ignore it

LBmaster renamed this task from Feature Rrequest: Proper support for Softdependencies to Feature Request: Proper support for Softdependencies.Jan 3 2024, 2:19 PM
LBmaster added a subscriber: Geez.
DafixCz added a subscriber: DafixCz.Jan 3 2024, 3:11 PM

I just checked again, becaus I saw other mods using somthing like

class CfgAddons {
    class PreloadBanks {};
    class PreloadAddons {
        class dayz {
            list[] = {
                "Other_Mod_Name"
            };
        };
    };
};

but this doesn't seem to work either

Yuki added a subscriber: Yuki.Mar 17 2024, 11:09 AM

I also talked to some other modders and I worte two small mods explaining the problem with the softdependencies. Is this example there Is a Test1 and Test2 mod. The Test2 mod contains a method, which should be overwritten by the Test1 mod. Due to the default alphabetical Loadorder, the Test1 mod is loaded first and therefore tries to overwrite a method, which does not exist. Even when the old #define LBmaster_Test_2_custom define and putting that in the scripts loaded by Test1 doesn't work.

The Zip already includes a preloadedAddons list in the config.cpp of the Test1 mod, so it's very simple to test if the changes made to make it possible are working as they should. From how I understand the addons system, it should be exactly the same like the requiredAddons list, but just don't show the error message telling you, that you are missing a required addon and continue loading the PBO instead of not loading it when you hit ok.

Weelder added a subscriber: Weelder.Wed, Apr 3, 2:12 PM

As demonstrated in this example with Test1 and Test2 mods, the default alphabetical load order can lead to issues when one mod attempts to override a method from another mod that has not yet been loaded.