using Cthangover.Core.Mods; namespace Cthangover.Validator { /// /// Lifecycle entry point of the validator mod. /// is the earliest moment when every mod has been discovered, compiled and /// registered, so it is the only reliable trigger for a global pass — the mod /// list cannot be assembled from , /// because asset-only mods (JSON/PNG without code) never produce an assembly /// and therefore never raise ModLoadedEvent. /// /// The hook runs on the main thread; all Godot-bound work (settings load, /// user:// path resolution) happens inside , /// and the validation itself continues on a background task so the game start /// is never blocked. On unload (or re-registration during an in-process /// reload) the pass in flight is stopped, see . /// public class ValidatorInitializer : IModInitializer, IModUnloadAware { /// /// Intentionally empty: asset-only mods are invisible to this callback, so /// the validator always works from the complete ModRegistry snapshot /// taken in instead of accumulating /// mods here. /// public void OnModLoaded(string modId) { } /// /// Starts the background validation pass once all mods and their JSON /// resources are available. /// public void OnModResourcesReady() { ValidatorService.Start(); } /// Stops the background pass while the validator's types are still alive. public void OnModUnloading() { ValidatorService.Stop(); } /// Nothing to drop: the validator keeps no references to other mods between passes. public void OnModUnloaded(string modId) { } } }