-
Notifications
You must be signed in to change notification settings - Fork 2
Mod Development
Clone my template mod to get started.
Making Splotch mods is similar to making BepInEx plugins as Splotch uses HarmonyX as well, making it easy to port mods between the two APIs.
The modinfo.yaml
file contains all the information about your mod. It is divided into two sections, entrypoint
and attributes.
Entrypoint contains the dll containing the main class and the name of the main class and attributes contains display information. id
is a unique identifier for your mod, mainly used for identifying Harmony patches.
Example:
entrypoint:
dll: main.dll
className: SplotchModTemplate.SplotchModTemplate
attributes:
id: com.codemob.splotchmodtemplate
name: Splotch Mod Template
description: A template for making Splotch mods for Bopl Battle
version: "1.0"
authors:
- Codemob
className
in your modinfo.yaml
file should point to a class extending Splotch.SplotchMod
and containing the function OnLoad
.
Example:
using HarmonyLib;
using UnityEngine;
using Splotch;
namespace SplotchModTemplate
{
public class SplotchModTemplate : SplotchMod
{
public override void OnLoad()
{
Logger.Log("Hello Bopl Battle!");
Harmony.PatchAll(typeof(BasicPatch));
}
}
}
Contains the attributes
section of your modinfo.yaml
file.
An instance of HarmonyLib.Harmony
pre-instantized with your mod id. Always use this when patching classes.
Splotch comes with an event system to make modding easier. To create an event class you must call EventManager.RegisterEventListener
with a static class as the parameter. Any eventHandler function must be static and have an Event
as their only parameter.
Example:
public override void OnLoad()
{
EventManager.RegisterEventListener(typeof(EventListener));
}
// ...
public static class EventListener
{
[EventHandler]
public static void OnPlayerDeath(PlayerDeathEvent deathEvent)
{
Logger.Log($"Player {deathEvent.GetPlayer().Color.name} died of {deathEvent.GetCauseOfDeath()}!");
}
}
Caution
NEVER use harmony.PatchAll
without any arguments! This could interfere with other mods! Instead, use typeof
to specify the class.
Warning
Patch methods must be static!
Example:
using HarmonyLib;
using UnityEngine;
using Splotch;
namespace SplotchModTemplate
{
[HarmonyPatch(typeof(Ability))]
public static class BasicPatch
{
[HarmonyPatch(nameof(Ability.EnterAbility))]
[HarmonyPrefix]
public static void AbilityEnter()
{
Logger.Log("Entered ability!");
}
[HarmonyPatch(nameof(Ability.ExitAbility))]
[HarmonyPrefix]
public static void AbilityExit()
{
Logger.Log("Exited ability!");
}
}
}
More information on the HarmonyX wiki
Unlike BepInEx, Splotch uses a custom logging system. It will first, if console is enabled in the config YAML, output to the console then uses Debug.Log which has Doorstop automatically redirect the log to output-log.txt
for easy access.
Note
This wiki may not be formatted well or contain all information on Splotch. Feel free to contact me on discord at @Codemob (or @Wackymoder ( or @abstractmelon)) or submit a pull request to edit this wiki if anything is missing.
Enjoy your mods!