
You are viewing a potentially older version of this package. View Latest Version

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.
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 menuIdentifier — a unique internal ID, always "yourmodname.cheatname" so it doesn't clash with anyone else'sButtonEnabledOverride / ButtonDisabledOverride — custom button text instead of the default "ENABLED"/"DISABLED"Icon — optional icon key, null for noneDefaultState — whether the cheat starts ON when the menu loadsPersistenceMode — whether the game remembers this cheat's state between sessionsThe methods do the actual work:
Enable() runs once when the player turns the cheat on — put your effect hereDisable() runs once when they turn it off — undo it hereCoroutine() 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");
}
}
}