You are viewing a potentially older version of this package. View all versions.
XuXiaolan-CodeRebirthLib-0.0.1 icon

CodeRebirthLib

Library for managing large Lethal Company mods.

Date uploaded 3 days ago
Version 0.0.1
Download link XuXiaolan-CodeRebirthLib-0.0.1.zip
Downloads 163
Dependency string XuXiaolan-CodeRebirthLib-0.0.1

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
Evaisa-FixPluginTypesSerialization-1.1.2 icon
Evaisa-FixPluginTypesSerialization

Fix custom Serializable structs and such not properly getting deserialized by Unity.

Preferred version: 1.1.2
Hamunii-AutoHookGenPatcher-1.0.6 icon
Hamunii-AutoHookGenPatcher

Automatically generates MonoMod.RuntimeDetour.HookGen's MMHOOK files during the BepInEx preloader phase.

Preferred version: 1.0.6
Zaggy1024-PathfindingLib-0.1.1 icon
Zaggy1024-PathfindingLib

Provides functionality for mod authors to run pathfinding off of the main thread.

Preferred version: 0.1.1
Evaisa-LethalLib-1.1.1 icon
Evaisa-LethalLib

Personal modding tools for Lethal Company

Preferred version: 1.1.1

README

CodeRebirthLib

A Library to help manage large Lethal Company Mods. Makes registering with LethalLib/WeatherRegistry/etc easier and contains other useful scripts and utilities.

Setup

You should have a Main AssetBundle that contains a ContentContainer ScriptableObject. This contains definitions to all the types of content that will be registered in your mod.

[!NOTE] Currently your packaged mod structure needs to be:

com.example.yourmod.dll
assets/
-> main_bundle
-> my_item_bundle

Each content bundle like my_item_bundle will contain an AssetBundleData ScriptableObject and as many content definitions as needed.

// In your plugin
public static CRMod Mod { get; private set; }

void Awake() {
    AssetBundle mainBundle = CodeRebirthLib.LoadBundle(Assembly.GetExecutingAssembly(), "main_bundle");
    Mod = CodeRebirthLib.RegisterMod(this, mainBundle);
    Mod.Logger = Logger; // optional

    // Load Content
    Mod.RegisterContentHandlers();
}

Then to divide up your content use the ContentHandler class to register. The specifics here might change slightly.

public class DuckContentHandler : ContentHandler<DuckContentHandler> {
	public class DuckBundle : AssetBundleLoader<DuckBundle> {
		public DuckBundle([NotNull] CRMod mod, [NotNull] string filePath) : base(mod, filePath) {
		}
	}
	
	public DuckContentHandler([NotNull] CRMod mod) : base(mod) {
		if(TryLoadContentBundle("ducksongassets2", out DuckBundle assets)) {
			LoadAllContent(assets!);
		}
	}
}

After running Mod.RegisterContentHandlers(); the registries in your CRMod will be populated. You can then get access to your content by running

if(mod.Weathers.TryGetFromWeatherName("Meteor Shower", out CRWeatherDefinition? definition)) {
    // do something with the Meteor Shower definition.
}

CHANGELOG

v0.1.1

  • Finished adding Progressive Unlockables support.
  • Fixed netcode patcher basically not working lol.
  • Improved logging a lot.
  • Added PathFindingLib as dependency because I forgot last version.
  • Added LLL soft dependency for item and enemy ContentTag support.

v0.1.0

  • Added support for BoundedRange and AnimationCurve editor configs.
  • Almost finished adding support for Progressive Unlockables.
  • A lot of other things in preparation for usage by coderebirth (mod is currently able to be used by anyone it's just missing full progressive unlockable support and a nuget package).

V0.0.1

  • Initial Release.