screepsmod-features

1.0.4 • Public • Published

screepsmod-features

Provides feature-management functionality to server and exposes info to clients+sandbox

NPM info

Installation

  1. npm install screepsmod-features in your server folder.
  2. Enjoy!

Usage

Other mods:
config.engine.on('init', function (processType) {
    if (config.features && processType === "main") {
        config.features.defineFeature(<feature name>, <feature source, e.g. mod name>, <feature version>); // features are enabled by default when defined
    }
});
...
config.features.getFeatureEnabled("my-feature").then((enabled) => {
    if (enabled) {
        // run code
    }
});
User code:
if (Game.features['my-feature'].enabled) {
    // run code
}
External tools/clients:
connection.get("api/features/list").then((features) => {
    if (features['my-features'].enabled) {
        // run code
    }
})
Server CLI:
setFeatureEnabled('my-feature', <boolean>);

Readme

Keywords

none

Package Sidebar

Install

npm i screepsmod-features

Weekly Downloads

4

Version

1.0.4

License

ISC

Last publish

Collaborators

  • esryok