Last in mod load order

Place to get help with not working mods / modding interface.
Post Reply
den3107
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jul 08, 2016 1:36 pm
Contact:

Last in mod load order

Post by den3107 »

Alright, I'll probably get the answer I expect, but going to give it a try regardless.

So putting it simply: I need to have my mod run at the very end of the mod loading process, after everybody else.
Obviously, I already know about the data lifecycle (put my functionality in data-final-fixes.lua), mod dependencies, and I also found out about Instrument mode (which is exactly what I want, but not very user-friendly from my perspective).

Now for some context on why I'm 100% sure my mod should always load last:
My mod is simply a JSON exporter of some data.raw prototypes (called "JsonCalculatorExporter"). Hence it needs to make sure it gets the data the game will actually use (and dependencies won't work here since every mod is essentially a dependency).
I ran into this issue once I added AngelsMods in combination with BobsMods. Angels creates some additional fluid subcategories during the final fixes that my exporter didn't catch.
The reason I'm doing this during the data stage, instead of when you're already in-game, is because information such as the icons is only available during that stage.

In case you're still curious and want even more context:
I'm using this export as input into a standalone calculator (much like the old Foreman app).
However, unlike Foreman, I'm working in Javascript/Typescript and I just couldn't figure out how to actually run the LUA scripts themselves (aka, simulate what data.raw would be) in that language, so I opted for this as a decent alternative method.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 624
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Last in mod load order

Post by Xorimuth »

My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

den3107
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jul 08, 2016 1:36 pm
Contact:

Re: Last in mod load order

Post by den3107 »

Love the idea, so thanks for that. Sadly would rather not have such dependencies, mainly since I wouldn't even trust myself with maintaining such a thing. :?
Could probably also automate it, but don't think it's very nice to spam the servers just to spider the mod portal's latest entries :lol:

At the moment thinking my best bet is to just go the "instrument mode" path, but automate that from within my application. ie: pressing a button will start up Factorio in instrument mode (and maybe automatically install the latest version of my mod).
Could also automate it by adding dependencies to the mod depending on all the mods currently installed, but at that point think instrument mode is the better (and easier) choice.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Last in mod load order

Post by Pi-C »

What happens when two active mods use that dependency -- how can you guarantee that both will be loaded last? :-D
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: Last in mod load order

Post by PFQNiet »

Since mods are loaded in alphabetical order (when not referenced by dependency) then you can name your mod accordingly.

This is what happened back when 0.18 changed how shortcut prototypes worked, which was a breaking change for many QoL mods. Rather than wait for all the mod makers to patch it, someone very kindly released a "shortcut fixer" mod, with the filename "zzz-fix-your-shit" and no dependencies. This was basically guaranteed it would load last.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Last in mod load order

Post by Pi-C »

PFQNiet wrote:
Sat Jun 12, 2021 8:40 am
Rather than wait for all the mod makers to patch it, someone very kindly released a "shortcut fixer" mod, with the filename "zzz-fix-your-shit" and no dependencies. This was basically guaranteed it would load last.
If only one mod depends on "Data Final Final, I Swear", sure this will probably work. But if there are several, they will have to compete again. The winning mod will be the only one that is loaded last, the losers will be loaded after all other mods without the dependency, but before the winner. So this mod looks like snake-oil to me. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

den3107
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jul 08, 2016 1:36 pm
Contact:

Re: Last in mod load order

Post by den3107 »

Those issues are exactly why the intrument mode only accepts a single mod.
Personally feel like some mods could put their fixing code in an earlier stage, if all fix-ups are properly split into new mods with appropriate dependencies (although that will create a large list of additional mods the user has to manually add). Eg for angels, instead of adding more info during the final data stage, you could also just make a mod that depends on both angels and bobs and do your fixups duting the data update stage instead.

Might be me, but think that most times people have order issues, it'd be more related to modders not fully utilizing the tools they are given already (in my case instrument mode is the tool I need, in other cases it's incorrect splitting and dependency usage).

Could potentially have a sort of fixup mod category which is automatically added (through references) if the related fixup dependencies are present. Not sure if it'd be worth the time though, so not quite going to actually suggest that part (not to mention the difficulty in managing third-party fixups).

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Last in mod load order

Post by Pi-C »

den3107 wrote:
Sat Jun 12, 2021 11:40 am
Those issues are exactly why the intrument mode only accepts a single mod.
Oh, geez -- I've read "instrument mod" all the time! :oops:
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Last in mod load order

Post by darkfrei »

The mod that named "_modname" will be loaded after "zmodname".

Post Reply

Return to “Modding help”