Skip to content
This repository was archived by the owner on Apr 21, 2024. It is now read-only.

Updated and added dependencies #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions SplotchModTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
}