Show human readable error when two mods have conflciting load order requirements
Improve cyclic error message text
This commit is contained in:
parent
2507837198
commit
6589bcc0a2
@ -116,7 +116,8 @@
|
||||
"mod-send_bundle_url": "[BUNDLE]: %s",
|
||||
"modloader-checked": "checked",
|
||||
"modloader-checking_mod": "checking: %s",
|
||||
"modloader-cyclic_dependency": "Cyclic dependency detected",
|
||||
"modloader-cyclic_dependency": "Cyclic dependency detected. This error needs to be fixed. The server is unable to start until this is fixed and will shut down",
|
||||
"modloader-load_order_conflict": "`{{modOneName}}` and `{{modTwoName}}` have conflicting load order requirements, the server is unable to start until this is fixed and will shut down",
|
||||
"modloader-dependency_container_not_initalized": "The dependency container was requested but it wasnt initialized",
|
||||
"modloader-error_parsing_mod_load_order": "Error parsing mod load order",
|
||||
"modloader-incompatibilities_not_string_array": "Mod %s package.json property 'incompatibilities' should be a string array",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData";
|
||||
import { ILogger } from "../models/spt/utils/ILogger";
|
||||
import { LocalisationService } from "../services/LocalisationService";
|
||||
@ -139,19 +140,25 @@ export class ModLoadOrder
|
||||
config.loadAfter ??= [];
|
||||
config.modDependencies ??= {};
|
||||
|
||||
const loadAfter = new Set<string>(Object.keys(config.modDependencies));
|
||||
const dependencies = new Set<string>(Object.keys(config.modDependencies));
|
||||
|
||||
for (const after of config.loadAfter)
|
||||
for (const modAfter of config.loadAfter)
|
||||
{
|
||||
if (this.modsAvailable.has(after))
|
||||
if (this.modsAvailable.has(modAfter))
|
||||
{
|
||||
loadAfter.add(after);
|
||||
if (this.modsAvailable.get(modAfter)?.loadAfter?.includes(mod))
|
||||
{
|
||||
this.logger.error(this.localisationService.getText("modloader-load_order_conflict", {modOneName: mod, modTwoName: modAfter}));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
dependencies.add(modAfter);
|
||||
}
|
||||
}
|
||||
|
||||
visited.add(mod);
|
||||
|
||||
for (const mod of loadAfter)
|
||||
for (const mod of dependencies)
|
||||
{
|
||||
this.getLoadOrderRecursive(mod, visited);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user