Closed insomnious closed 5 months ago
Although the extension defines a couple of modTypes to support the game's different modding patterns; it does not include modType tests to correctly identify these mods. A custom installer will also be needed to cater for some mod packaging patterns.
To unblock:
.dl_bin
extension - that should be sufficient to assign the helldivers2-data
modType)Could you help me out with how to code to automatically assign modType in mod installers? I understand how to get the installer to see the .dl_bin to check if the mod is supported for the installer, but I am not certain how to assign the modType to it at that point.
Here's what I have:
const modFileExt = ".dl_bin";
function testSupportedContent(files, gameId) {
// Make sure we're able to support this mod.
let supported = (gameId === spec.game.id) &&
(files.find(file => path.extname(file).toLowerCase() === modFileExt) !== undefined);
// Test for a mod installer.
if (supported && files.find(file =>
(path.basename(file).toLowerCase() === 'moduleconfig.xml') &&
(path.basename(path.dirname(file)).toLowerCase() === 'fomod'))) {
supported = false;
}
return Promise.resolve({
supported,
requiredFiles: [],
});
}
function installContent(files) {
// The .fbmod file is expected to always be positioned in the mods directory we're going to disregard anything placed outside the root.
const modFile = files.find(file => path.extname(file).toLowerCase() === modFileExt);
const idx = modFile.indexOf(path.basename(modFile));
const rootPath = path.dirname(modFile);
// Remove directories and anything that isn't in the rootPath.
const filtered = files.filter(file =>
((file.indexOf(rootPath) !== -1) &&
(!file.endsWith(path.sep))));
const instructions = filtered.map(file => {
return {
type: 'copy',
source: file,
destination: path.join(file.substr(idx)),
};
});
return Promise.resolve({ instructions });
}
//In the main function:
context.registerInstaller('helldivers2-dlbin', 25, testSupportedContent, installContent);
Certainly - you can create an additional instruction in the installer like so:
const setModTypeInstruction = { type: 'setmodtype', value: MODTYPE_ID }
Then just add the new instruction to the instructions array before returning the promise.
instructions.push(setModTypeInstruction);
Got it! Updated the mod to Nexus.
Hi again - I didn't get to test your extension yet as I can already see that the installer hasn't been tested.
function installContent(files, gameSpec) {
<...>
MODTYPE_ID = "helldivers2-data"; // You're missing the variable declaration!
const setModTypeInstruction = { type: 'setmodtype', value: MODTYPE_ID };
<...>
instructions.push(setModTypeInstruction);
return Promise.resolve({ instructions });
}
// declare your variable before using it:
// const/var/let MODTYPE_ID
Fixed and uploaded to Nexus. Just a note that I did test the code and it did work. But yes, I did add the proper declaration.
Verify Extension: Helldivers 2 Vortex Extension
Use this template to verify game extensions for Vortex
Extension Information
Get all relevant metadata and links from nexusmods.com
Check to see if there is an existing extension for this game
Verification checklist
Adding extension to manifest
When complete, the verified extension needs adding to our manifest.