Deja-UpgradeLib icon

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.

By Deja
Last updated 3 weeks ago
Total downloads 218
Total rating 0 
Categories Mods Libraries
Dependency string Deja-UpgradeLib-1.0.2
Dependants 2 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack_IL2CPP-6.0.755 icon
BepInEx-BepInExPack_IL2CPP

BepInEx pack for IL2CPP x64 Unity games. Preconfigured and ready to use.

Preferred version: 6.0.755

README

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

  1. Add a reference to UpgradeLib.dll in your .csproj
  2. Add [BepInDependency("com.upgradelib.roadsideresearch")] to your plugin class
  3. 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