Alpha
Alpha: A mod for On-Together to provide common utilities and features.
模組介紹 作者原文
Alpha
A shared BepInEx mod for On Together that provides common utilities and a command framework for other mods to build on.
- Author: AndrewLin
- Repository:
Workaround: On-Together GPU VRAM & RAM Usage
On-Together accumulates GPU VRAM and system RAM over time as Unity loads assets during a session. If you experience frame drops or out-of-memory issues, run this command in chat to immediately free unused assets:
/auua
This calls UnityEngine.Resources.UnloadUnusedAssets() and can reclaim significant memory without restarting the game. Run it whenever the game feels sluggish or after leaving a busy lobby.
Configuration
Alpha creates a config file at BepInEx/config/com.andrewlin.ontogether.alpha.cfg.
| Section | Key | Default | Description |
|---------|-----|---------|-------------|
| Logging | TimestampLog | true | Prepend [HH:mm:ss] timestamps to each line in LogOutput.log. |
In-Game Commands
Alpha registers its own /alpha namespace commands. Type them in chat — they are intercepted locally and not sent to other players.
| Command | Short | Description |
|---|---|---|
| /alphaserverinfo | /asi | Show lobby name, code, player count, and host info |
| /alphawhois [player] | /awi | Show info about a player (name, Steam ID, position) |
| /alphamyposition | /amp | Show your current world position |
| /alphaaddnotification | /aan | Post a local notification to your own chat |
| /alphaunloadunusedassets | /auua | Free GPU VRAM & RAM by unloading unused Unity assets |
| /alphahelp | /ah | List all Alpha commands |
Features
Chat Command Framework
Alpha exposes a static AlphaPlugin.CommandManager (ChatCommandManager) that any mod can use to register in-game slash commands.
Implementing a command:
public class MyCommand: IChatCommand
{
public string Name => "mycmd";
public string ShortName => "mc"; // optional short alias
public string Description => "Does something cool.";
public string Namespace => "mymod"; // used for grouping and auto-help
public void Execute(string args) { /... / }
}
Registering in your plugin's Awake():
AlphaPlugin.CommandManager?.Register(new MyCommand());
When the first command for a namespace is registered, a /{namespace}help command (and short form /{ns[0]}h) is automatically created for that namespace.
Built-in help usage:
/{mymod}help
/{mymod}help verbose — includes descriptions
/{mymod}help mycmd — looks up a single command
Chat Utilities (ChatUtils)
| Method | Description |
|--------|-------------|
| AddGlobalNotification(text) | Displays a notification in the in-game global chat. |
| SendMessageAsync(userName, text, isLocal) | Sends a chat message (truncated to 250 chars). |
| SendChunkedMessageAsync(userName, text, isLocal, strategy) | Splits long text into ≤250-char chunks and sends each one. Strategy: "word" (default) or "hard". |
| CleanTMPTags(input) | Strips TextMeshPro formatting tags (e.g. `, `) from a string. |
| CleanCommand() | Hides a slash command from chat after it is processed (clears the input field). |
| UISendMessage(text) | Injects text into the chat input field and submits it programmatically. |
Time Utilities (TimeUtils)
| Method | Description |
|--------|-------------|
| TryParseDuration(input, out TimeSpan result) | Parses ISO 8601 durations (1h30m, 15s, PT1H30M) and hh:mm:ss / TimeSpan strings. Returns false if unparseable. |
Example:
if (TimeUtils.TryParseDuration("10m", out TimeSpan duration))
// duration == TimeSpan.FromMinutes(10)
String Chunking (IStringChunker)
Breaks arbitrary text into segments no longer than a given character limit.
| Implementation | Behaviour |
|----------------|-----------|
| WordBoundaryChunker | Splits on whitespace; avoids cutting words mid-word. |
| HardCutChunker | Hard-cuts at the character limit, no word awareness. |
Player Utilities (PlayerUtils)
| Method | Description |
|--------|-------------|
| GetUserName() | Returns the local player's display name (may contain TMP
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: