Jump to content

Stellaris Game Extension Mod Folder Redirection


TempestValdyr

Recommended Posts

Hello, I am attempting to set up a game extension for the game Stellaris; however, I am having trouble telling the extension where to put the mods.

The game extension itself is recognized and accessible from Vortex. All I am trying to do is tell Vortex to put the mods into the proper folder for Stellaris mods in the Documents folder. What I have so far (yes, it is barebones, sorry):

The queryModPath is where I believe it tells Vortex to put the mods, but every time I change it, it upsets the game extension (makes it disappear from Vortex). Help would greatly be appreciated, thank you!

//Import some assets from Vortex we'll need.
const path = require('path');
const { fs, log, util } = require('vortex-api');

// Nexus Mods domain for the game. e.g. https://www.nexusmods.com/stellaris
const GAME_ID = 'stellaris';

//Steam Application ID, you can get this from https://steamdb.info/apps/
const STEAMAPP_ID = '281990';

function main(context) {
	//This is the main function Vortex will run when detecting the game extension. 
	context.registerGame({
    id: GAME_ID,
    name: 'Stellaris',
    mergeMods: true,
    queryPath: findGame,
    supportedTools: [],
    queryModPath: () => 'mod',
    logo: 'gameart.jpg',
    executable: () => 'stellaris.exe',
    requiredFiles: [
      'stellaris.exe',
    ],
    setup: undefined,
    environment: {
      SteamAPPId: STEAMAPP_ID,
    },
    details: {
      steamAppId: STEAMAPP_ID,
    },
	compatible: {
      symlinks: false
    },
  });
	return true
}

module.exports = {
    default: main,
  };
  
function findGame() {
  return util.GameStoreHelper.findByAppId([STEAMAPP_ID,])
      .then(game => game.gamePath);
} 
Edited by TempestValdyr
Link to comment
Share on other sites

Hey TempestValdyr,

 

Looks like you're almost there! What is the exact path that mods should be installed to?

 

You might want to look at how ESO does it: https://github.com/Nexus-Mods/vortex-games/blob/b774bab4fd5011e88fcac294c5fde7bfece21309/game-teso/index.js#L27

function modPath() {
  return path.join(remote.app.getPath('documents'), 'Elder Scrolls Online', 'live', 'Addons');
}
Link to comment
Share on other sites

Actually I would suggest you use util.getVortexPath('documents') instead of remote.app.getPath('documents')

util is the util from vortex-api.

 

It's not a huge difference realistically but

a) getVortexPath is cached which might save a little bit of performance

b) we may be able to build in fallbacks or something in the future

c) electron is gradually shedding functionality from "remote" so it's possible this call might break at some point in the future whereas getVortexPath we have control over and can keep functional.

Link to comment
Share on other sites

  • 3 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...