WOTCStrategyOverhaul / CovertInfiltration

A mod that overhauls the Covert Actions system to bring back the Infiltration mechanic from Long War 2
MIT License
21 stars 8 forks source link

InfiltrationModifier struct DLC element only registers FXS DLC, not mods. #672

Closed shiremct closed 3 years ago

shiremct commented 3 years ago

The DLC gate element in the InfiltrationModifier struct is intended to check for DLCs and Mods.

The following code is used:

static function bool IsDLCLoaded (coerce string DLCName)
{
    local array<string> DLCs;

    DLCs = class'Helpers'.static.GetInstalledDLCNames();

    return DLCs.Find(DLCName) != INDEX_NONE;
}

but class'Helpers'.static.GetInstalledDLCNames() only returns actual FXS DLC. There is also a class'Helpers'.static.GetInstalledModNames() function that may be the ticket for checking Mods. Needs investigating whether it looks for package name or Mod's DLCIdentifier.

robojumper commented 3 years ago

The canonical approach is

    local XComOnlineEventMgr OnlineEventMgr;
    local int i;

    OnlineEventMgr = `ONLINEEVENTMGR;

    for (i = 0; i < OnlineEventMgr.GetNumDLC(); ++i)
    {
        // use result of...
        OnlineEventMgr.GetDLCNames(i);
    }

which checks the base name of the .XComMod/.XComDLC name (and which is what the CHL dependency checker uses).

GetInstalledDLCNames has zero usage in base game UC code, and two usages in CHL code that checks for AH/SLG installations. GetInstalledModNames has zero usage in base game UC code and CHL code.

shiremct commented 3 years ago

Did some logging and the class'Helpers'.static.GetInstalledModNames() seems to return the name of the mod's .XComModFile, including mods with no DLCIdentifier set, or config only mods with no script files whatsoever. Tested with 292 mods active and all were reported, with no worry about DLCIdentifier or multiple script packages etc.

Edit, Nevermind - I see Robo's method does essentially the same thing, but covers both DLC and Mods in one!