Skip to content

CapuchinModding/CapuchinModTemplate

Repository files navigation

Capuchin Modding Template

This repository holds the template and instructions for creating up your own Capuchin mod.

Table of Contents

Foreword

Prerequisites

You need all of these to set up the template correctly:

Mods in Gorilla Tag vs Mods in Capuchin

If you are already familiar with mod development for Gorilla Tag, this section is for you.

Gorilla Tag is built using the Mono framework, an open-source project that allows projects built on the .NET framework to run on other operating systems. Mono is not significantly easier or harder to mod (for the mod developer) than IL2CPP.

However, Capuchin is built using IL2CPP, a project lead by Unity to convert C# scripts into C++ during compilation. It is much more performant than Mono.

It's important to know which build mode is being used for the game you are modding because these two have different setup steps.

Template

Setup

This page assumes that Capuchin has already been installed and that you have already installed MelonLoader. You must run the game once to gather the required assemblies.

Now that you have the game modded, you will now clone (create your own copy of) the Capuchin modding template. The template handles setting up the plugin and patching the game via. Harmony (allowing you to override code for selective parts of the game).

You can clone the repository (with Git) by running this command in your terminal:

git clone https://github.com/CapuchinModding/CapuchinModTemplate.git

The Template

In these guides, / is the root (start) of the template's folder (eg. /Plugin.cs is the Plugin.cs file of the template.)

Open the in your editor. Open /Plugin.cs and you should see code that looks like this:

using UnityEngine;

namespace CapuchinTemplate
{
    public static class ModInfo
    {
        public const string UUID = "yourname.yourmod";
        public const string Name = "Mod";
        public const string Author = "Your Name";
        public const string Version = "1.0.0";
    }
    
    public class Plugin : MonoBehaviour
    {
        void Start()
        {
            // Add your startup code here, initialize assets, check configurations, etc.
            Debug.Log("Hello world");
        }
    }
}

This is the class created by Init.cs for your plugin's code to run without requiring any manual setup.

Fill in the appropriate details in the ModInfo class. The recommended UUID (universally unique identifier) layout is as follows:

<name>.<mod_name> (with no spaces or special characters)

You should now have a fully functioning Capuchin mod that prints Hello world to the console. Congratulations!

Expansion

Gathering Input

Method 1: Do it yourself

Unity contains a simple system for grabbing input in the UnityEngine.XR namespace.

You can use it like this:

using UnityEngine.XR;
// Don't forget this at the top of the file.

public static InputDevice LeftHand => InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
public static InputDevice RightHand => InputDevices.GetDeviceAtXRNode(XRNode.RightHand);

public static bool LeftPrimary => LeftHand.TryGetFeatureValue(CommonUsages.primaryButton, out var primary) && primary;

Method 2: Caputilla

See Integration with Caputilla for more information on what Caputilla does.

Caputilla contains a class called ControllerInputManager that will handle gathering input for you.

Caputilla/Utils/ControllerInputManager.cs

if (ControllerInputManager.Instance.leftGrip)
    Debug.Log("grip");

Integration with Caputilla

Caputilla is a modding library that implements a modded queue into Capuchin. When creating mods that alter your gameplay (such as mod menus, "emote wheel" mods, any mod that alters movement, etc.), you are required to implement Caputilla support. Not doing so will result in a ban from Capuchin moderators, who do not take kindly to cheaters.

Thankfully, Caputilla is very easy to implement in your own mods. Let's take the Plugin class from earlier:

public class Plugin : MonoBehaviour
{
    void Start()
    {
        // Here is where we can add Caputilla support!
    }
}

For this example, we will add two new methods: OnModdedJoin and OnModdedLeave. We "connect" these to Caputilla with the CaputillaManager class, as shown below:

using Caputilla; // Don't forget this!

public class Plugin : MonoBehaviour
{
    bool IsModded = false;

    void Start()
    {
        // Here is where we connect them together
        CaputillaManager.Instance.OnModdedJoin += OnModdedJoin;
        CaputillaManager.Instance.OnModdedLeave += OnModdedLeave;
    }

    void OnModdedJoin() => IsModded = true;
    void OnModdedLeave() => IsModded = false;
}

Help & Support

There are many places you can get help with modding Capuchin.

About

Jumpstart for writing your own Capuchin mods with MelonLoader

Topics

Resources

License

Stars

Watchers

Forks

Languages