Eepy_Nico_Stuff-CheatsAPI icon

CheatsAPI

Library for adding cheats to the sandbox menu.

Last updated 10 hours ago
Total downloads 36
Total rating 0 
Categories Tools Libraries Utility
Dependency string Eepy_Nico_Stuff-CheatsAPI-0.1.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

Ultrakill Cheats.

Ya love em. i mean, seriously. they cool af. i bring you an API designed to make adding cheats easier. (This is my first API feedback would be appreciated) it does basically what you expect. it makes adding cheats easier.

How it works

To use this API, Simply use this line to register a cheat.

CheatInjector.RegisterCheat(new CheatName(), "cheat tab");

This runs some code that basically hands the cheat to the manager and rebuilds the menu at the start of each scene.

To make a cheat work, you need a seperate script like this.

using System.Collections;
using CheatsAPI;
using ULTRAKILL.Cheats;

public class CheatName : ICheat
{
    public string LongName => "Cool Cheat";
    public string Identifier => "yourmod.coolcheat";
    public string ButtonEnabledOverride => null;
    public string ButtonDisabledOverride => null;
    public string Icon => null;
    public bool IsActive { get; private set; }
    public bool DefaultState => false;
    public StatePersistenceMode PersistenceMode => StatePersistenceMode.NotPersistent;

    public IEnumerator Coroutine(CheatsManager manager) { yield break; }

    public void Enable(CheatsManager manager)
    {
        IsActive = true;
        ExampleCheatMod.Plugin.Log.LogInfo("Cool cheat = " + IsActive);
    }

    public void Disable()
    {
        IsActive = false;
        ExampleCheatMod.Plugin.Log.LogInfo("Cool cheat = " + IsActive);
    }
}

The properties at the top just tell the menu how to display your cheat:

  • LongName — the name shown in the menu
  • Identifier — a unique internal ID, always "yourmodname.cheatname" so it doesn't clash with anyone else's
  • ButtonEnabledOverride / ButtonDisabledOverride — custom button text instead of the default "ENABLED"/"DISABLED"
  • Icon — optional icon key, null for none
  • DefaultState — whether the cheat starts ON when the menu loads
  • PersistenceMode — whether the game remembers this cheat's state between sessions

The methods do the actual work:

  • Enable() runs once when the player turns the cheat on — put your effect here
  • Disable() runs once when they turn it off — undo it here
  • Coroutine() is for anything that needs to run continuously while active; most cheats just yield break;

You can repeat this process for each cheat you have. a mod with many cheats might have a Plugin.cs like this:

using BepInEx;
using BepInEx.Logging;
using CheatsAPI;

namespace ExampleCheatMod
{
    [BepInPlugin("com.nico.example", "Example Cheat", "1.0.0")]
    public class Plugin : BaseUnityPlugin
    {
        internal static ManualLogSource Log;

        private void Awake()
        {
            Log = Logger;
            CheatInjector.RegisterCheat(new FlyingCheat(), "silly cheats");
            CheatInjector.RegisterCheat(new InstaKillCheat(), "debug cheats");
            CheatInjector.RegisterCheat(new FullestAutoCheat(), "silly cheats");
            CheatInjector.RegisterCheat(new HakitaIsCoolCheat(), "silly cheats");
            CheatInjector.RegisterCheat(new FnafTwoOnDeathCheat(), "silly cheats");
            CheatInjector.RegisterCheat(new KnockKnockCheat(), "funny cheats");
            CheatInjector.RegisterCheat(new WhosThereCheat(), "funny cheats");
            CheatInjector.RegisterCheat(new JoeCheat(), "funny cheats");
            CheatInjector.RegisterCheat(new JoeWhoCheat(), "funny cheats");
            CheatInjector.RegisterCheat(new JoeMamaCheat(), "funny cheats");
        }
    }
}