LethalOS

v1.0.8·Updated 2023-12-04

An in-game terminal library, which allows you to easily create menus, categories, and programmable modules. Allows for a clean and easy way to implement your mods.

About this mod Author’s original text

Creating Menus, Categories, and Modules in LethalOS.API

Introduction

LethalOS.API provides a flexible system for managing modules within Lethal Company's terminal environment. This guide demonstrates how to create menus, categories, and modules using the API.

Creating a Menu

-

// Creating a menu instance

Menu mainMenu = new Menu("Main Menu", "Description of the main menu", "main", "John Doe");

// Finalizing and adding the menu to the terminal, do this after adding categories and their respective modules

mainMenu.Finished();

Adding Categories to the Menu

-

// Creating a category instance

Category moonCategory = new Category("Moon", "Moon-related modules", "moon");

// Adding the category to the main menu, do this after adding the modules to the category

mainMenu.AddCategory(moonCategory);

Adding Modules to Categories

-

Creating a Custom Module Class

using LethalOS.API;

public class CustomModule: ModuleBase

{

public CustomModule(string displayName, string displayDescription, string keyword, bool requiresHost, bool toggled): base(displayName, displayDescription, keyword, requiresHost, toggled)

{

// Custom initialization code

}

public override void OnAdded()

{

// Custom Logic when the module is first added to the terminal

}

public override void OnEnabled()

{

// Custom logic when the module is enabled

//Change the current text on the terminal, does not effect the existing terminal node

ChangeScreenText("New Text", true);

//Updates the current node with a new one, this will effect the existing terminal node

UpdateNode(newNode: );

}

// Other overrideable lifecycle methods can be implemented here

}

Adding Custom Modules to Categories

// Creating a custom module instance

CustomModule moonInfo = new CustomModule("MoonInfo", "Display moon information", "MoonInfo", false, false);

// Adding the module to the 'moon' category

moonCategory.AddModule(moonInfo);

Retrieving Modules from Categories

-

// Retrieving a module by its name from the 'moon' category

ModuleBase retrievedModule = moonCategory.GetModuleByName("MoonInfo");

// Retrieving a module by its class from the 'moon' category

CustomModule moonModule = moonCategory.GetModule();

Example Code

-

// Creating a menu instance

Menu mainMenu = new Menu("Main Menu", "Description of the main menu", "main", "John Doe");

// Creating a category instance

Category moonCategory = new Category("Moon", "Moon-related modules", "moon");

// Creating a custom module instance

CustomModule moonInfo = new CustomModule("MoonInfo", "Display moon information", "MoonInfo", false, false);

// Adding the module to the 'moon' category

moonCategory.AddModule(moonInfo);

// Adding the category to the main menu

mainMenu.AddCategory(moonCategory);

// Finalizing and adding the menu to the terminal

mainMenu.Finished();

// Retrieving a module by its name from the 'moon' category

ModuleBase retrievedModule = moonCategory.GetModuleByName("MoonInfo");

if (retrievedModule!= null)

{

Console.WriteLine("Module Found: " + retrievedModule.DisplayName);

}

else

{

Console.WriteLine("Module Not Found.");

}

// Retrieving a module by its class from the 'moon' category

CustomModule moonModule = moonCategory.GetModule();

if (moonModule!= null)

{

Console.WriteLine("Custom Module Found: " + moonModule.DisplayName);

}

else

{

Console.WriteLine("Custom Module Not Found.");

}

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.

File & checksum

Filename
LethalOS-1.0.8.zip
File size
78.1 KiB