Skip to content

Conversation

@VAVASgit
Copy link

@VAVASgit VAVASgit commented Dec 3, 2025

Skærmbillede 2025-12-03 172203

This PR introduces a prototype Mod Manager workflow to Olympus Manager, aimed at making user-downloaded custom DCS mods simpler and more intuitive to integrate, without requiring manual setup.

What does this do?

  • Adds a Mod Manager flow to manager.js:

    • Scans Saved Games\DCS\Mods\aircraft and ...\tech for installed mods
    • Shows a “Custom mods detected” dialog in the Manager UI
    • Lets the user import mods in a non-destructive way (backups before writing configs)
  • Replaces modinventory.js with a real scanner:

    • Parses entry.lua and any UnitPayloads/*.lua it finds
    • Builds a normalized list of units and loadouts that the UI and generator can use
  • Updates modgenerator.js:

    • Generates mods.json entries for detected units
    • Writes a mods_generated.lua file with modsList entries and payloadFiles
    • Keeps the original Olympus configs intact by creating backups first
  • Extends mods.lua:

    • Loads the generated data at runtime
    • Uses the payloadFiles table to load native UnitPayload definitions for each mod

Testing.

  • Install one or more mods under Saved Games\DCS\Mods
  • Start the Olympus Manager and open the Mod Manager
  • Import the detected mods
  • Verify that mods.json and mods_generated.lua are created/updated correctly and that the units can be spawned with their payloads

This is just a prototype and I’m happy to adjust structure, naming or behavior to better match your preferred design. If this is too big for a single PR I can also break it into smaller pieces (inventory, generator, UI) whatever works best for you.

Additional notes.

Tested on:

  • DCS 2.9.x
  • Olympus release-candidate branch

Mods used in my tests:

  • F-22A
  • F-23A
  • Su-57
  • S-70
  • Civil Aircraft Mod (CAM)
  • Military Aircraft Mod (MAM)

I was able to:

  • See the “Custom mods detected” dialog on Manager startup
  • Import the detected mods
  • Confirm that mods.json and mods_generated.lua were updated
  • Spawn the imported units with their loadouts from the Olympus UI

Tutorial

  1. Setup
    Install a DCS mod into Saved Games\DCS\Mods\aircraft (or \tech this includes for the mods like CAM and MAM)
    Launch the Olympus Manager from your desktop.
  2. Detection
    Click the “Mod Manager” menu tile (or start the Manager fresh).
    Confirm the new mod appears with status “Pending import.” (THIS ONLY WORKS IN BASIC MODE AS OF NOW)
    Toggle “Review before enabling” to expand the list.
  3. Import
    Click “Import detected mods.”
    If some mods were already imported, confirm the dialog “X of Y already imported—import the remaining Z?”
    On success, expect a toast like “Import completed. 1 mod added. All 3 detected mods are now marked as
    imported.” (If nothing happens click "Skip / do later" button and then it should work
  4. Validation
    Check Saved Games\DCS\Mods\Services\Olympus\scripts\mods_generated.lua and …\databases\units\mods.json;
    each should have a fresh timestamped .bak and the new mod entry present.
    Launch Olympus → DCS and verify the mod shows up with correct loadouts and within the Olympus UI
  5. Repeat
    Add another mod, rerun the process to ensure multiple imports and CAM/MAM-style packs behave correctly.

NOTE

If the Olympus client loses connection during a session, you can usually recover by restarting the client and reloading the mission from the DCS Mission Editor.
In my tests this has restored normal behavior.

Adds the mod manager UI hook

  - Added imports for ModInventoryService and generateConfigs, plus state fields like modImportState/modImportStateFile.
  - On startup the Manager now calls promptModImportIfNeeded, resolving the Saved Games root and scanning available mods
    via scanMods().
  - showModsPrompt() renders the existing mods.ejs dialog, populating it with the discovered inventory and summary
    counts (total/imported/pending).
  - Added handlers onModsImportClicked, onModsReviewClicked, onModsSkipClicked, and onModsMenuClicked. Import now
    funnels through applyModImport() which:
      - Ensures there are pending mods.
      - Confirms when some were already imported.
      - Marks pending IDs as imported, runs generateConfigs, re-scans, and shows a success toast.
  - Added persistence helpers (loadModImportState, saveModImportState, getImportedMods, markModsImported) and a
    canonicalization step ensureCanonicalImportedMods to reconcile old folder-based IDs with the new per-unit IDs/
    aliases.
  - scanMods() caches the inventory, tracks availability for the menu button, and updates currentModSummary used by the
    prompt/UI.
- Introduced ModInventoryService that resolves %USERPROFILE%\Saved Games\DCS\Mods (both aircraft and tech).
  - For each aircraft mod, it now:
      - Reads entry.lua for display names, short names, type IDs, lengths, descriptions.
      - Searches UnitPayloads/*.lua, parses the payload table (name, displayName, tasks) and converts tasks into Olympus
        roles.
      - Stores metadata like payload file paths, aliases, issues (e.g., “Payload file not found”), coalition, category,
        etc.
  - For tech mods (CAM/MAM), it iterates through each unit .lua file to expose every aircraft individually, handling
    their IDs/lengths and marking them as “Tech” category units so Olympus can spawn them.
  - Adds helpers for sanitizing labels, stripping localization wrappers, deduping aliases, and saving the discovery
    results to manager/mods-inventory.json as a cache.
  - The discover() method now sorts inventory entries by displayName and returns the decorated descriptors used by the
    UI and generator.
  - Adds internal parsers (_parsePayloadFile, _extractTableBlock, _matchString, _matchTasks, _mapTasksToRoles) robust
    enough to handle localized strings (_("F-22A")) and table keys like ["payloads"].

  In short, modinventory.js now produces a rich per-unit descriptor list the rest of the Mod Manager depends on.
  - Builds the JSON entries for each unit (names, loadouts, lengths, etc.) and merges them into Saved Games\…\mods.json,
    backing up the old file first.
  - Writes mods_generated.lua with the mod list plus a payloadFiles table pointing at each mod’s UnitPayloads/*.lua, so
    Olympus can load the real payload definitions.
  - Exposes a single generateConfigs function that manager.js calls to do both writes safely.
 - Maintains Olympus.modsList/modsUnitPayloads so Olympus knows each modded unit’s category and available loadouts.
  - Provides helper functions (registerPayload, loadPayloadFile, etc.) so mods can either define custom payloads inline
    or let Olympus load the mod’s own UnitPayloads/*.lua.
  - On startup it loads mods_generated.lua (written by the Mod Manager) and merges the generated data, including the new
    payloadFiles table. That means any mod payload script found during import will be executed automatically, so Olympus
    uses the mod’s authentic loadouts instead of hard-coded stubs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant