From f8c07d4efdfad820e72bf2016c2a8d3d1cb2553f Mon Sep 17 00:00:00 2001 From: AbstractMelon <129030233+AbstractMelon@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:42:37 -0600 Subject: [PATCH] Updated and added dependencies --- SplotchModTemplate.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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; + } }