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

Mod Development

codemob edited this page Jan 21, 2024 · 6 revisions

Basics

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.

modinfo.yaml

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

Main Class

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()
        {
            Debug.Log("Hello Bopl Battle!");
            harmony.PatchAll(typeof(BasicPatch));
        }
    }
}

SplotchMod.modInfo

Contains the attributes section of your modinfo.yaml file.

SplotchMod.harmony

An instance of HarmonyLib.Harmony pre-instantized with your mod id. Always use this when patching classes.

Harmony Patches

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()
        {
            Debug.Log("Entered ability!");
        }

        [HarmonyPatch(nameof(Ability.ExitAbility))]
        [HarmonyPrefix]
        public static void AbilityExit()
        {
            Debug.Log("Exited ability!");
        }
    }
}

More information on the HarmonyX wiki

Debug.Log

Unlike BepInEx, Splotch uses Unity's built-in logging system. Doorstop automatically redirects the log files 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 submit a pull request to edit this wiki if anything is missing.

Clone this wiki locally