UpgradeLib
Library for adding purchasable upgrade trees to Roadside Research's in-game skill webs. Provides a simple API for other mods to register upgrades with automatic persistence.
模組介紹 作者原文
UpgradeLib
A library mod for Roadside Research that lets other mods add purchasable upgrade trees to the game's skill webs. Upgrades appear as clickable nodes alongside vanilla skills, cost either money or research points, and persist across sessions automatically.
For Players
Install this mod if another mod requires it. UpgradeLib does nothing on its own — it provides the framework that other mods use to add upgrade trees.
Save data is stored per save slot in BepInEx/config/UpgradeLib.
For Mod Developers
Quick Start
- Add a reference to UpgradeLib.dll in your.csproj
- Add [BepInDependency("com.upgradelib.roadsideresearch")] to your plugin class
- Register upgrade trees in your Load() method
Minimal Example
using BepInEx;
using BepInEx.Unity.IL2CPP;
using UpgradeLib;
[BepInPlugin("com.example.roadsideresearch", "ExampleUpgrade", "1.0.0")]
[BepInDependency("com.upgradelib.roadsideresearch")]
public class Plugin: BasePlugin
{
public override void Load()
{
var tier2 = new UpgradeDefinition
{
Id = "speed_2",
Name = "Speed II",
Description = "Max speed bonus: 20%.",
CostType = CostType.Money,
Cost = 1000f
};
var root = new UpgradeDefinition
{
Id = "speed_1",
Name = "Speed I",
Description = "Max speed bonus: 10%.",
CostType = CostType.Money,
Cost = 500f,
Title = "Speed Upgrades",
Children = { tier2 }
};
UpgradeAPI.RegisterTree(root);
}
}
API
| Method | Description |
|--------|-------------|
| UpgradeAPI.RegisterTree(root) | Register a new upgrade tree |
| UpgradeAPI.RegisterInTree(title, node) | Add a node to an existing tree |
| UpgradeAPI.IsPurchased(id) | Check if an upgrade is owned |
| UpgradeAPI.CanPurchase(id) | Check if an upgrade is available to buy |
| UpgradeAPI.GetAllNodes() | Get all registered nodes |
Features
- Tree-based upgrades — root nodes with chained children forming prerequisite chains
- Two cost types — Money (economy webs) and Research (alien webs)
- Automatic persistence — purchase state saves/loads per save slot
- Property inheritance — children inherit icons, colors, and cost type from parents
- Vanilla icon matching — borrow icons from vanilla skills by name
- OnPurchased callbacks — fire on purchase and on game load for re-applying effects
- Cross-mod support — mods can add nodes to trees registered by other mods
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: