MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / executeAllEnabledModsNode

Function executeAllEnabledModsNode

src/nodeExecutor.ts:541–612  ·  view source on GitHub ↗
(
  nodeId: string,
  textValue: string,
  config?: unknown,
)

Source from the content-addressed store, hash-verified

539}
540
541async function executeAllEnabledModsNode(
542 nodeId: string,
543 textValue: string,
544 config?: unknown,
545): Promise<NodeExecutionResult> {
546 console.log(`AllEnabledMods Node ${nodeId}: Processing all enabled mods`);
547
548 const packFiles = [] as PackFilesNodeFile[];
549
550 try {
551 // Parse the textValue to get includeBaseGame flag
552 const parsedConfig = getNodeConfig<{ includeBaseGame?: boolean }>(config, textValue);
553 const includeBaseGame = parsedConfig?.includeBaseGame !== false;
554
555 // Get all enabled mods from appData
556 const enabledMods = appData.enabledMods;
557
558 // Add all enabled mods to packFiles
559 for (const mod of enabledMods) {
560 packFiles.push({
561 name: path.basename(mod.path),
562 path: mod.path,
563 loaded: true,
564 });
565 }
566
567 // If includeBaseGame is true, add the base game pack from data folder
568 if (includeBaseGame) {
569 const baseGamePackName = gameToPackWithDBTablesName[appData.currentGame];
570 if (baseGamePackName) {
571 const baseGameFolder = appData.gamesToGameFolderPaths[appData.currentGame].dataFolder;
572 if (baseGameFolder) {
573 const baseGamePackPath = path.join(baseGameFolder, baseGamePackName);
574 if (fs.existsSync(baseGamePackPath)) {
575 packFiles.push({
576 name: baseGamePackName,
577 path: baseGamePackPath,
578 loaded: true,
579 });
580 console.log(`AllEnabledMods Node ${nodeId}: Added base game pack from ${baseGamePackPath}`);
581 } else {
582 console.warn(`AllEnabledMods Node ${nodeId}: Base game pack not found at ${baseGamePackPath}`);
583 }
584 }
585 }
586 }
587
588 if (packFiles.length === 0) {
589 console.warn(`AllEnabledMods Node ${nodeId}: No mods found (includeBaseGame: ${includeBaseGame})`);
590 }
591
592 console.log(
593 `AllEnabledMods Node ${nodeId}: Found ${packFiles.length} packs (includeBaseGame: ${includeBaseGame})`,
594 );
595
596 return {
597 success: true,
598 data: {

Callers 1

executeNodeActionFunction · 0.85

Calls 1

getNodeConfigFunction · 0.85

Tested by

no test coverage detected