CitiesSkylinesMods / HarmonyLifecycle

Mod dependency
MIT License
0 stars 0 forks source link

Management of Paradox Launcher last save auto-load #1

Open originalfoo opened 4 years ago

originalfoo commented 4 years ago

The Paradox Launcher has an auto-continue feature which is a PITA for any mods that need to present users with UI at the main menu when Cities.exe first loads.

While it is relatively easy for a single mod to stop and later resume (if necessary/applicable) the auto-continue, it will be a PITA if multiple mods want to do that - one mod wanting to display UI would be thwarted by another mod deciding it's ok to auto-continue.

Seems perfect situatoin for HarmonyLifecycle mod (HLM) to help with :)

The external mod would simply define an OnCompatibilityCheck() method on its ILifecycle class:

public class Lifecycle : ILifecycle {

    // ... stuff ...

    public bool OnCompatibilityCheck() {
        // do stuff
        return success; // true or false
    }

}

If the method exists in any external mod, the auto-continue of last save is prevented by default.

When suitable time arises to perform compatibility checks (eg. same approach we use in TMPE) the OnCompatibilityCheck() methods of external mods are called.

Only if all of those methods return true will the auto-continue proceed, if applicable. Otherwise the app will remain at main menu allowing mods to display their UI or whatever else it is they need to do.

originalfoo commented 4 years ago

updated to be much simpler