GitHub | NexusMods | CUCoreLib
A mod utility library for Casualties Unknown, built on top of CUCoreLib.
Evolved from Moss Lib.
- Overview
- Documentation
- Installation
- Quick Start
- Localization
- Setting Options (BetterOptions)
- Update Checking (UpdateUtil)
- Tools Reference
- Constants Reference
- License
Bark is a BepInEx plugin utility library for Casualties Unknown, extending CUCoreLib (CCL) with enhanced localization, settings, and game utility tools.
| Module | Description |
|---|---|
BetterLocale |
Localization system built on CCL's LocaleRegistry |
BetterOptions |
CCL settings registration wrapper (Float/Int/Bool/Dropdown/Keybind) |
ModLangGenBase |
Language generator base class |
UpdateUtil |
GitHub-based mod update checker |
PlayerUtil |
Player: status/vitals/movement/drugs/inventory/recovery/alert/thresholds |
SkillUtil |
Skill level/XP manipulation |
LimbUtil |
Limb operations: healing, damage, status checks |
WorldUtil |
World manipulation: tiles, items |
InventoryUtil |
Inventory operations |
ItemUtil |
Item utilities: FindNearby, Repair, SetCondition |
InputUtil |
Input handling: mouse position, click waiting |
StorageUtil |
Persisted values via PlayerPrefs |
CompressUtil |
GZip / Deflate data compression |
LogUtil |
Console logging + validation helpers |
TextUtil |
Rich text formatting: color, alpha, bold, italic, size |
ToolsUtil |
Argument validation, float/int parsing |
Tiles |
Strongly-typed tile definitions |
Items |
Strongly-typed item definitions |
Backgrounds |
Background ID string constants |
Keys |
Key action constants |
Slots |
Inventory slot definitions |
Full documentation at docs/en-US/ (and 简体中文):
- Getting Started — Installation, environment, choosing your path
- Script Development — JS/Lua mods, lifecycle hooks, console commands
Note: Puerts supports Python, but the Python runtime (~22 MB) currently bundled with the package is too large and has been put on hold. Python support will be considered in a future major release if there is user demand. See
TodoPython/for archived implementation. - C# Mod Development — Event subscription, Harmony patches, API registration
- Configuration & Localization — Options registration, multi-language
- Script Event Hooks — All listenable event hooks
- C# Event System — Event subscription / trigger / custom events
- Script API Reference — BodyUtil, PlayerUtil, LimbUtil, etc.
- C# API Reference — EventUtil, UpdateUtil
- Install BepInEx 5.x for Casualties Unknown.
- Install CUCoreLib ≥ 1.0.6 — place
CUCoreLib.dllintoBepInEx/plugins/CUCoreLib/. - Install Bark Extract it and place it in the
BepInEx/plugins/folder.
Optional: This mod supports WMITF (What Mod Is This From). When installed, script mod items, tiles, and recipes will display their authoring script mod's name in the item inspection UI.
For mod developers: Reference
Bark.dllin your project, and add[BepInDependency("org.cucnmc.bark")]to your plugin class.
[BepInPlugin(Guid, Name, Version)]
[BepInDependency("net.cucorelib")] // CCL is required
[BepInDependency("org.cucnmc.bark")] // Bark extends CCL
public class MyPlugin : BaseUnityPlugin
{
// ...
}Bark provides BetterLocale on top of CCL's LocaleRegistry:
using Bark.BetterCCL;
// Get localized text (CCL → Bark defaults → key fallback)
string text = BetterLocale.GetOther("bark.feature.enabled");
// Define fallback translations via language generators:
// EnLangGenerator.cs
Other("feature.enabled", "Enable Feature");
// ZhCnLangGenerator.cs
Other("eature.enabled", "启用功能");See Lang for sample generators.
using Bark.BetterCCL;
BetterOptions.Bool("bark", "feature_enabled", Setting.SettingCategory.Game, true);
// With custom category tab
BetterOptions.Bool("bark", "advanced_mode", "Bark", false);using Bark.Tool;
// Call in Awake() — async, results output to logger + game console
UpdateUtil.Check("YourName/YourRepo", "YourMod", "1.0.0", Logger);public class EnLangGenerator : ModLangGenBase
{
protected override string LanguageCode => "EN";
protected override void BuildLocaleData()
{
Other("bark.tooltip.heat", "Hot enough to warp.");
Option("bark.game.test", "Test Mode", "Turns on the test mode");
}
}| Method | Category |
|---|---|
Item(key, value, description) |
item |
Building(key, value, description) |
build |
Moodle(key, value, description) |
moodle |
Other(key, value) |
other |
Option(key, label, description) |
option (settings labels) |
Log(key, value) |
log |
Command(key, value, description) |
command |
Liquid(key, value, description) |
liquid |
Title(key, value, description) |
title |
| Method | Category |
|---|---|
GetItem(key, args?) |
item |
GetBuilding(key, args?) |
build |
GetMoodle(key, args?) |
moodle |
GetOther(key, args?) |
other |
GetLog(key, args?) |
log |
GetCommand(key, args?) |
command |
GetOption(key, args?) |
option |
GetLiquid(key, args?) |
liquid |
GetTitle(key, args?) |
title |
Note:
argsreplace{0},{1}, etc. in the resolved locale value. For example,BetterLocale.GetLog("update.available", "Bark", "1.0", "2.0")returns"Bark update available! 1.0 -> 2.0".
| Method | Category |
|---|---|
HasKey(category, key) |
Any category |
HasKeyItem(key) |
item |
HasKeyBuilding(key) |
build |
HasKeyMoodle(key) |
moodle |
HasKeyOther(key) |
other |
HasKeyLog(key) |
log |
HasKeyCommand(key) |
command |
HasKeyOption(key) |
option |
HasKeyLiquid(key) |
liquid |
HasKeyTitle(key) |
title |
| Method | Description |
|---|---|
SetDefault(lang, cat, key, val) |
Register fallback value |
Flush() |
Write all defaults to CCL locale directory |
ToRichText(md) |
Convert Markdown to Unity Rich Text |
StripMarkdown(md) |
Strip markdown to plain text |
BetterOptions.Bool("ns", "key", Setting.SettingCategory.Game, true);
BetterOptions.Int("ns", "level", Setting.SettingCategory.Game, 5, 1, 10);
BetterOptions.Float("ns", "volume", Setting.SettingCategory.Audio, 0.8f, 0f, 1f);
BetterOptions.Dropdown("ns", "mode", Setting.SettingCategory.Game, 0, choices);
BetterOptions.Keybind("ns", "hotkey", Setting.SettingCategory.Input, KeyCode.F5);
// Custom category tab
BetterOptions.Bool("ns", "key", "My Mod Tab", false);using Bark.Tool;
// Async check via GitHub Releases API — localizable messages
UpdateUtil.Check("CNCUMC/Bark", "MyMod", "1.0.0", Logger);| Parameter | Description |
|---|---|
githubRepo |
GitHub repo path, e.g. "CNCUMC/Bark" |
modName |
Display name used in log/console messages |
currentVersion |
Current version, supports "1.0.0" or "v1.0.0" |
logger |
Mod's BepInEx ManualLogSource |
Results are output to both the BepInEx log and the game console. Messages are localized via BetterLocale
(update.no_repo, update.failed, update.no_version, update.available, update.uptodate).
Full API docs at Script API Reference and C# API Reference. Overview below.
| Class | Description | Detailed Docs |
|---|---|---|
LogUtil |
Logging + validation helpers | Log |
PlayerUtil |
Player operations | Player |
BodyUtil |
Body vitals system | Body System |
LimbUtil |
Limb operations | Limbs |
WorldUtil |
World editing | World |
SkillUtil |
Skill level/XP | Skills |
InventoryUtil |
Inventory queries | Inventory & Items |
ItemUtil |
Item search, repair, durability | Inventory & Items |
InputUtil |
Input handling | Input |
StorageUtil |
Persisted values via PlayerPrefs | Storage |
CompressUtil |
GZip / Deflate data compression | Compress |
TextUtil |
Rich text formatting | — |
ToolsUtil |
Argument validation, float/int parse | — |
EventUtil |
Event trigger / manual registration | EventUtil |
UpdateUtil |
GitHub release version check | UpdateUtil |
ushort tileId = Tiles.SteelTile; // implicit conversion
Tiles tile = Tiles.FromId(6);string itemId = Items.Medkit; // implicit conversion
Items item = Items.FromId("medkit");string bgId = Backgrounds.Rock;
KeyCode key = Keys.Jump;
int slotId = Slots.MainHand;Copyright © 2020 Tencent
This software is distributed under the terms of the BSD 3-Clause License.
For full license text, please see the LICENSE.
