GithubHelp home page GithubHelp logo

gamerules's Introduction

Add and use gamerules that can be modified in real-time through a configuration file.

Users: Reading and modifying gamerules

You can use a few hotkeys while Rain World is in focus to control your gamerules.

  • Ctrl F1: Prints all gamerules in the console. You can find your console in Rain World/BepInEx/LogOutput.log .
  • Ctrl F2: Reads all gamerules from the file Rain World/UserData/Gamerules.json. The input can be formatted or not.
  • Ctrl F3: Writes all gamerules into the file Rain World/UserData/Gamerules.json. The output is unformatted, but you can format it with jsonlint.com or a good text editor.

Your Rain World folder will be with the rest of your Steam apps (e.g. C:/Program Files (x86)/Steam/steamapps/common/Rain World).

Modders: Adding as a dependency

Just add the mod as a reference in your project. See GameruleSet/Rules.cs for an example.

Making the dependency optional

To make the dependency optional, keep all references to Gamerules.dll in a dedicated method and call that method within a try-catch.

Code example
// In a plugin class...
    
public int ExampleRule;

public void OnEnable() {
    try { 
        LoadGamerules(); 
    }
    catch { 
    }
}

private void LoadGamerules() {
    new IntRuleBuilder()
        .Default(0)
        .Min(0)
        .Max(10)
        .Description("This is an example rule.")
        .OnUpdate(x => ExampleRule = x)
        .Register("my_mod/example_rule");
}

Planned

  • In-game UI for reading/writing gamerules in the pause menu and in the main menu
  • Option to lock a set of gamerules for a save file permanently
  • Maybe a ListRule

gamerules's People

Contributors

dual-iron avatar

Watchers

 avatar

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.