0.1.14 • Published 3 years ago

starblast-browser-mod-runner v0.1.14

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

starblast-browser-mod-runner

A npm package to run mod codes from browser (featuring the starblast-modding npm itself)

Warning

  • This package doesn't support undocumented features like accessing through game.modding, etc.
  • Since this package is dependent on the starblast-modding npm, some of its latest features (which may doesn't work in browsers) will be available

Installation

> npm i starblast-browser-mod-runner

Using the library

Require the library

const StarblastBrowserModRunner = require("starblast-browser-mod-runner");

Create a container

let container = new BrowserModRunner({
  cacheECPKey: true,
  cacheOptions: true
});
// options from the original starblast-modding npm, note that `cacheEvents` will always be true

This container will act as your browser, which has methods described below:

Method nameDescription
setRegion(region)set the region the mod will be run on, must be Asia, America or Europe
setECPKey(ECPKey)set the ECP Key this npm will be used for sending mod creation requests
start()start the mod, returns a promise
stop()stop the mod, returns a promise
loadCodeFromString(script)load the mod code from a script string
loadCodeFromLocal(path)load the mod code from a local file (File on your device)
loadCodeFromExternal(URL)load the mod code from an external URL file
getNode()returns the original game object called from the starblast-modding npm)
getGame()returns the game object, which acts the same as it is in browser

Example

Here is an example for running SDC code pulled from Neuronality's site:

const BrowserModRunner = require("starblast-browser-mod-runner");

let container = new BrowserModRunner({
  cacheECPKey: true,
  cacheOptions: true
});

container.setRegion("Asia");

container.setECPKey("12345-6789");

container.loadCodeFromExternal("https://starblast.data.neuronality.com/mods/sdc.js");

container.start();

let game = container.getGame();

let node = container.getNode();
0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago