6 Commits
Author SHA1 Message Date
soarqin 66ecebaca7 fix(UXAssist): start late-discovered mod features 2026-07-11 14:25:46 +08:00
soarqin ab1d20683d fix(UXAssist): centralize mod-feature lifecycle to prevent duplicate execution
ModFeatureRegistry is a static class with shared collections accumulating
features from all mods. Dependent mods (CheatEnabler, UniverseGenTweaks)
each independently called InitAll/StartAll/OnInputUpdateAll/OnUpdateAll/
UninitAll, re-running lifecycle for ALL accumulated features including
other mods' — per-frame Update ran 2-3x (breaking CheatEnabler key toggles
to net no-ops), Init/Start/Uninit ran 2-3x (double RegisterExporter causing
save corruption, double SettingChanged subscriptions, double keybind
registration).

Fix:
- Init now runs eagerly at Discover/Register time (Awake-phase), preserving
  the original timing that keybind registration depends on (game's
  UIOptionWindow._OnCreate copies keybinds only after all plugins load)
- InitAll removed entirely
- StartAll/UninitAll/OnInputUpdateAll/OnUpdateAll made internal so only
  UXAssist (host, same assembly, no InternalsVisibleTo) can drive them
- Start deferred to UXAssist.Start (after all dependents' Awake complete;
  BepInEx runs all Awakes before any Start)
- Per-feature Started idempotency + per-frame Time.frameCount guards as
  defense-in-depth
- Dependent mods reduced to Discover-only in Awake

Document the Init/Start timing contract on IModFeature and
ModFeatureAttribute so future mods can rely on it.
2026-06-29 02:56:54 +08:00
soarqin 06015d51d0 docs(UXAssist): update ModFeature docs for non-static feature classes 2026-06-23 03:38:04 +08:00
soarqin 099f3ee35a refactor(CheatEnabler): adopt ModFeatureRegistry from UXAssist 2026-06-23 03:33:19 +08:00
soarqin 91259bbd17 refactor(UXAssist): harden ModFeatureRegistry 2026-06-23 02:23:20 +08:00
soarqin cb7a965d12 feat(UXAssist): public ModFeature lifecycle registry 2026-06-23 02:18:32 +08:00