Skip to content

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

License

Notifications You must be signed in to change notification settings

ScreepsMods/screepsmod-features

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>);

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published