Git Product home page Git Product logo

commonapi's Introduction

CommonAPI

A modding library for Dyson Sphere Program. Provides multiple features to make adding custom content to DSP easier.

List of features

  • Easily register new items, recipes and more using ProtoRegistry system
  • Create new buildings with custom behavior and custom UI using ComponentSystem
  • Register new recipe types. This allows to create new machine types without writing almost any code.
  • Register and use custom tabs.
  • Register new KeyBinds that players can rebind
  • Easily create new systems that exist in each Planet or Star. An example of such system is ComponentSystem
  • Picker Extension tool allows to extend behavior of Item and Recipe pickers. For example use any filter defined by a function.
  • Support translation for at least for English, Chinese and Franch by using String Protos

Full list of modules and other utilities can be found here. More will come in the future. If want write your own module and add it to the list you can open a Pull Request. Contrubitions are welcome.

Installation

With Mod Manager

Simply open the mod manager (if you don't have it install it here), select CommonAPI by CommonAPI, then Download.

If prompted to download with dependencies, select Yes. Then just click Start modded, and the game will run with the mod installed.

Manually

Install BepInEx from here
Install LDBTool from here
Install DSPModSave from here

Unzip folder patchers into Dyson Sphere Program/BepInEx/patchers/CommonAPI/ (Create folder named CommonAPI)
Unzip folder plugins into Dyson Sphere Program/BepInEx/plugins/CommonAPI/. (Create folder named CommonAPI)

Feedback and Bug Report

Feel free to contact me via Discord (Kremnev8#3756) for any feedback, bug-reports or suggestions.

How develop mods using CommonAPI

All features are written as self-contained modules (Inspired by R2API). By default NO modules are loaded. To use a module at the top of your BepInEx plugin class add an attribute CommonAPISubmoduleDependency. That will ensure that specified modules are loaded. Make sure you don't ask to load modules that you are not using.

How to setup development environment

  1. Download and install CommonAPI and its dependencies
  2. Create development environment. You can find how to do that here
  3. Add LDBTool, DSPModSave and CommonAPI assemblies to your references. You can use NuGet to get them. You can find them by typing DysonSphereProgram.Modding into nuget package search.
  4. You also likely will need a Unity Project. You can find instructions on setting that up here

Usage Example

[BepInPlugin(GUID, NAME, VERSION)]

[BepInDependency(CommonAPIPlugin.GUID)]
[CommonAPISubmoduleDependency(nameof(ProtoRegistry), nameof(CustomDescSystem))]
public class MyPlugin : BaseUnityPlugin
{
    public const string MODID = "myplugin";
    public const string GUID = "org.myname.plugin." + MODID;
    public const string NAME = "My Plugin";
    
    void Awake()
    {
        //Make use of modules here
    }
}

This library is still under development. Used by many of my mods.

commonapi's People

Contributors

limoka avatar phantomgamers avatar velociraptor115 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

commonapi's Issues

RegisterTech crashed if there are multiple techs having the same preTech

foreach (int tech in preTechs)
{
    //Do not do LDB.techs.Select here, proto could be not added yet.
    techUpdateList.Add(tech, proto);
}

If there are multiple newly added techs that has the same preTech, then techUpdateList as a Dictionary will crash with
ArgumentException: An item with the same key has already been added. Key: 1001

filterItem

I want to get a filter for all the items. What should I do?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.