ZortLib

v1.0.0·Updated 2025-03-08

A Basic Library For Zort

About this mod Author’s original text

ABOUT

A basic library for Zort

Made by Erne

USAGE

Reference ZortLib.dll to your project

Add ZortLib as a dependency to your plugin class

[BepInPlugin(pluginGuid, pluginName, pluginVersion)]

[BepInDependency(ZortLib.libGuid, BepInDependency.DependencyFlags.HardDependency)]

public class MyClass: BaseUnityPlugin

{

}

Actions

sceneDelay: Invokes the actions after delay

scene: Byte for numbering scenes

OnMenu(): Calls frame per second on menu

OnLobby(): Calls frame per second on lobby

OnGame(): Calls frame per second on game

OnceMenu(): Calls once start on menu

OnceLobby(): Calls once start on lobby

OnceGame(): CCalls once start on game

public void Awake()

{

OnLobby += () => Debug.Log("Im at lobby");

OnceLobby += LobbyOnce;

}

public void LobbyOnce => Debug.Log("Im joined to lobby");

Output:

"Im at lobby"

"Im joined to lobby"

"Im at lobby"...

ZortUtils

InvokeIn(MonoBehaviour, float, Action): Invokes the action

this.InvokeIn(3.5f, () =>

{

Debug.Log("3,5 Seconds passed");

});

GetPrivateVariable(object, string): Gets private variable from instance

SetPrivateVariable(object, string, T): Gets private variable from instance

public void Awake()

{

string scene = ZortUtils.GetPrivateVariable(MyClass.instance, "scene");

Debug.Log(scene);

ZortUtils.SetPrivateVariable(MyClass.instance, "scene", "haha I changed it");

scene = ZortUtils.GetPrivateVariable(MyClass.instance, "scene");

Debug.Log(scene);

}... // Another class

private string scene = "nothing";...

Output:

"nothing"

"haha I changed it"

InvokePrivateVoid(object, string, params object): Invokes private method from instance

public override void OnceGame()

{

ZortUtils.InvokePrivateVoid(MyClass.instance, "Noclip");

}... // Another class

private void Noclip => Debug.Log("Noclip Open:)");...

Output:

"Noclip Open:)"

ReplaceMethod(Type, string, Type, string): Replaces first method to second method

public void Awake()

{

ZortUtils.ReplaceMethod(typeof(MyClass), "Awake", typeof(MyClass), "Method2");

Method1();

Method2();

}

private void Method1() => Debug.Log("First Method");

private void Method2() => Debug.Log("Second Method");

Output:

"First Method"

"First Method"

PatchUtils

RegisterCallback(Type, string, Action, bool = false): Registers a action calling after from method

UnRegisterCallback(Type, string): UnRegisters a callback

public override void OnceGame()

{

// If its private -> RegisterCallback("Myclass", "StartGame",...);

RegisterCallback(typeof(MyClass), nameof(MyClass.StartGame), ()=> {

Debug.Log("Noo I'm after the game starts");

}, false);

}

public void StartGame() => Debug.Log("Game Is Started");

Output:

"Game Is Started"

"Noo I'm after the game starts"

Mono

Just use Mono.Instance if you need MonoBehaviour on anywhere

Mono.Instance.InvokeIn(1f, () => Debug.Log("Hi"));

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide.

Dependencies

Install these first, or the mod will not work:

BepInEx-BepInExPack

File & checksum

Filename
ZortLib-1.0.0.zip
File size
108.6 KiB