You are viewing a potentially older version of this package. View all versions.
Deja-UpgradeLib-1.0.1 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
Date uploaded 3 weeks ago
Version 1.0.1
Download link Deja-UpgradeLib-1.0.1.zip
Downloads 13
Dependency string Deja-UpgradeLib-1.0.1

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

CHANGELOG

Changelog

1.0.0

  • Initial release
  • Register upgrade trees with UpgradeAPI.RegisterTree()
  • Add nodes to existing trees with UpgradeAPI.RegisterInTree()
  • Query purchase state with UpgradeAPI.IsPurchased() and UpgradeAPI.CanPurchase()
  • Support for Money and Research cost types
  • Automatic per-slot save/load persistence
  • Property inheritance (icons, colors, cost type) from parent to child nodes
  • Vanilla icon matching via VanillaIconMatch
  • OnPurchased callbacks fire on purchase and on game load