SimpleCommandAPI
C# API plugin for Lethal Company
模組介紹 作者原文
SimpleCommand.API
[!NOTE]
This README file might be outdated. Always check out the original GitHub Page.
This plugin is designed to help developers. So if certain features are missing, please do not hesitate to contact me.
This plugin currently features:
- Mod Command List with all available mod commands
- Nested Command Structure
Oversimplified
Introduction
To create new commands for the Terminal, this plugin uses a nested structure of a class called SimpleCommandModule. This allows the user to create complex command structures with ease. Every command will get added to the SimpleCommandList, if not specified otherwise.
[!IMPORTANT]
This documentation does not explain how to create a plugin in general. Please look up how to create a plugin first.
Getting Started
Start by downloading this plugin and referencing it inside of your IDE of choice. For Visual Studio 2022, you can check out this documentation.
Reference as BepInDependency
For the plugin to work best, add it as BepInDependency above your initial plugin class.
[BepInDependency(SimpleCommand.API.MyPluginInfo.PLUGIN_GUID)]
public class MyPlugin: BaseUnityPlugin
SimpleCommandModule
The SimpleCommandModule class has the following properties:
SimpleCommandModule reviveModule = new SimpleCommandModule()
{
DisplayName (string)
What the player needs to type for the command to trigger, e.g. "revive"
DisplayName: "revive",
Method (Func)
This method will get called if the player enters the command.
Method: ReviveDeadPlayer,
[!WARNING]
Your initial method needs to have Terminal as a parameter and a TerminalNode as a return. The TerminalNode will be your text on the terminal after your method was invoked. You can see how to create a TerminalNode here.
Description (string) (optional)
This text will appear in the command list. Tell the player what this command does.
Description: "Revive a dead player"
Abbreviations (string) (optional)
Shorter form of the word, which also works. This value can also contain several abbreviations.
Abbreviations: ["rev", "reviv"],
Arguments (string) (optional)
If the command has dynamic input, you can list what values the player has to type (shows in list later).
Arguments: ["number"],
HasDynamicInput (bool) (optional)
If the command awaits dynamic input like numbers, otherwise it will check for the children names.
HasDynamicInput: false,
HideFromCommandList (bool) (optional)
If this command is allowed to appear on on the command list. Useful, if you have a command structure like "buy coffee", but you don't actually want to display "buy" as extra.
HideFromCommandList: false,
IgnoreModule (bool) (optional)
Useful for plugins that already have their own system and just want to appear on the command list.
IgnoreModule: false,
ChildrenModules (SimpleCommandModule) (optional)
SimpleCommandModules that come after the current module, e.g. revive "player"
ChildrenModules: [newModule]
All methods
AddSimpleCommand(SimpleCommandModule)
Adds the SimpleCommandModule to the command list.
[!IMPORTANT]
Please pay attention to duplicates. If your command name already exists in other plugins, it will usually load first, but errors may still occur.
AddSimpleCommands(SimpleCommandModule)
Just an additional way of adding commands to the list via array.
GetInputValue(Terminal terminal)
Returns the complete string of what was written and submitted on the terminal. Terminal reference needed.
GetInputValue(Terminal terminal, int index)
Returns a string array of the last wordsa depending on what index will be. (Counts backwards) Terminal reference needed aswell.
RemovePunctuation(string s)
Removes every punctuation character in the given string and converts it to lowercase.
TerminalNode
TerminalNodes are a default class defined by the Lethal Company developer. It will look something like this:
public class TerminalNode: ScriptableObject
{
[TextArea(2, 20)]
public string displayText;
public string terminalEvent;
[Space(5f)]
public bool clearPreviousTe
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: