diff --git a/SplotchModTemplate.cs b/SplotchModTemplate.cs index 81d34d7..506947d 100644 --- a/SplotchModTemplate.cs +++ b/SplotchModTemplate.cs @@ -9,8 +9,14 @@ namespace SplotchModTemplate { public class SplotchModTemplate : SplotchMod { + public override void OnLoad() { + if (!CheckDependencies()) + { + Logger.Warning("Dependency check failed. Modname will not load."); + return; + } Logger.Log("Hello Bopl Battle!"); EventManager.RegisterEventListener(typeof(EventListener)); Harmony.PatchAll(typeof(HarmonyPatches)); @@ -38,4 +44,21 @@ public static void PatchAccel(ref PlayerPhysics __instance) PlatformSlipperyness01.SetValue(__instance, (Fix) 1.01); } } + private bool CheckDependencies() + { + // Get the dependencies + string[] dependencies = ModInfo.dependencies; + + // Check if all dependencies are loaded + foreach (string dependency in dependencies) + { + if (!ModManager.loadedMods.Any(mod => mod.id == dependency)) + { + Logger.Warning($"Dependency '{dependency}' not found."); + return false; + } + } + + return true; + } }