#throw me at documentation or example
1 messages · Page 1 of 1 (latest)
* register a mod type
* @param {string} id internal identifier for this mod type. can't be the empty string ''!
* @param {number} priority if there is difficulty differentiating between two mod types, the
* higher priority (smaller number) one wins.
* Otherwise please use 100 so there is room for other extensions
* with lower and higher priority
* @param {(gameId) => boolean} isSupported return true if the mod type is supported for this
* game
* @param {(game: IGame) => string} getPath given the specified game, return the absolute path to
* where games of this type should be installed.
* @param {(instructions) => Promise<boolean>} test given the list of install instructions,
* determine if the installed mod is of this type
* @param {IModTypeOptions} options options controlling the mod type
*/
registerModType: (id: string, priority: number, isSupported: (gameId: string) => boolean, getPath: (game: IGame) => string, test: (installInstructions: IInstruction[]) => Promise<boolean>, options?: IModTypeOptions) => void;
That's the interface
Usage example:
// This should be placed in your init/main function (or whatever your default export is)
context.registerModType(MOD_TYPE_BG3SE, 15, (gameId) => gameId === GAME_ID,
() => path.join(getGamePath(context.api), 'bin'),
isBG3SE as any,
{ name: 'BG3 BG3SE' });
export async function isBG3SE(files: types.IInstruction[]) {
// The instructions here are passed by reference and can be changed before
// the mod is installed in the staging folder.
const origFile = files.find(iter =>
(iter.type === 'copy') && (path.basename(iter.destination).toLowerCase() === 'dwrite.dll'));
return origFile !== undefined
? Promise.resolve(true)
: Promise.resolve(false);
}
apologies, got timed out trying to edit the link i posted
I'm afraid that modTypes aren't documented very well outside the codebase itself 😬 but there are a fair few examples in both bundled extensions such as BG3, Witcher 3, etc. But also in 3rd party/community ones.
I think you'll find the Starfield extension interesting as it uses stopPatterns alongside modTypes
of course a bethesda game would have a complex af mod plugin lol
Haha ofc
overall, what you think of the updated plugin code?
this was mostly made with the help of github copilot in learning and understanding js structure (coming from golang myself)
Looks pretty solid overall at a glance
The amount of time I tried to code for all occurances and possibilities severely impacted my caffine addiction lol
Would have to test it with the game to give more feedback 😋
Yeah, modding is fun but there are so many edge cases to cater for at times
I try to keep to one coffee per day; some days are more successful than others on that front
Oh it works quite well!
it ships with a custom override.txt file for ue4ss, and then installes ue4ss from either official releases (though a config change is needed if you use official releases), or use the ue4ss that has been repackaged with the updated config on nexus
The new mod format/structure that I am trying to have be the standard since LuaMods are becoming a thing, and later down the dev line, maybe even LogicMods
https://github.com/Merith-TK/game-intotheradius2-modformat
the only "untested" thing is LogicMods but thats because that doesnt exist yet
and of course fomods...
honestly if I didnt need to put things into the bin64 folder I wouldnt need to leave the pakDir scope
reposting code with proper highlighitng so I can read it
* register a mod type
* @param {string} id internal identifier for this mod type. can't be the empty string ''!
* @param {number} priority if there is difficulty differentiating between two mod types, the
* higher priority (smaller number) one wins.
* Otherwise please use 100 so there is room for other extensions
* with lower and higher priority
* @param {(gameId) => boolean} isSupported return true if the mod type is supported for this
* game
* @param {(game: IGame) => string} getPath given the specified game, return the absolute path to
* where games of this type should be installed.
* @param {(instructions) => Promise<boolean>} test given the list of install instructions,
* determine if the installed mod is of this type
* @param {IModTypeOptions} options options controlling the mod type
*/
registerModType: (id: string, priority: number, isSupported: (gameId: string) => boolean, getPath: (game: IGame) => string, test: (installInstructions: IInstruction[]) => Promise<boolean>, options?: IModTypeOptions) => void;
// This should be placed in your init/main function (or whatever your default export is)
context.registerModType(MOD_TYPE_BG3SE, 15, (gameId) => gameId === GAME_ID,
() => path.join(getGamePath(context.api), 'bin'),
isBG3SE as any,
{ name: 'BG3 BG3SE' });
export async function isBG3SE(files: types.IInstruction[]) {
// The instructions here are passed by reference and can be changed before
// the mod is installed in the staging folder.
const origFile = files.find(iter =>
(iter.type === 'copy') && (path.basename(iter.destination).toLowerCase() === 'dwrite.dll'));
return origFile !== undefined
? Promise.resolve(true)
: Promise.resolve(false);
}```
yeah I even opened up vortex's code to see if they had any handling for fomod