npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

starblast-modding

v1.4.27-alpha6

Published

A powerful library for interacting with the Starblast Modding API

Downloads

1,268

Readme

A Brief Profile

starblast-modding is the JavaScript library for hosting modded Starblast games on NodeJS.

  • Introducing OOP (Object-Oriented Programming) into Starblast Modding
  • Provides a new way to approach Starblast Modding rather than the old format used in the browser
  • Includes new features and events that doesn't exist in the original Modding
  • Regularly updates to catch up with latest Starblast server updates and bugs fixes

Credits

  • Thanks Caramel#8789 for making the banner for this npm.

Installation

Node.js >= 16.6.0 and NPM >= 6.0.0 are required.

npm install starblast-modding
yarn add starblast-modding
pnpm add starblast-modding

Documentation

Please see this link

Changelog

Please see here

Example

ModdingClient usage

This is an example on how to run a team-mode modded game:

(along with available events to listen on)

const StarblastModding = require("starblast-modding");

const game = new StarblastModding.Client({
  cacheECPKey: true,
  cacheEvents: false,
  cacheOptions: true
});

game.setRegion("Asia");

game.setECPKey("12345-67890");

game.setOptions({
  map_name: "Test"
});

game.aliens.add();
game.start({
  region: "Asia",
  ECPKey: "09876-54321",
  options: {
    //map_size: 20,
    custom_map: "",
    root_mode: "team",
    friendly_colors: 5,
    radar_zoom: 1,
    station_size: 3
  }
}).then(function (link, options) {
  console.log("Promise fulfilled: " + link);
  game.log(link);
}).catch(function (error) {
  console.log("Promise rejected: " + error.message)
});

game.on('error', function(error) {
  console.log("In-game error: " + error.message);
  // Invalid laser rate....
});

game.on('log', function(...args) {
  console.log("In-game log:", ...args);
  // Custom game log goes here
})

game.on('start', function(link, options) {
  console.log("Mod started with link: "+ link);
});

game.on('tick', function (step) {
  if (step % 30 == 0) for (let ship of game.ships) {
    ship.set({invulnerable: 120});
    ship.setCrystals(120).setGenerator(300).setHealing(true)
  }
});

game.on('shipRespawn', function(ship) {
  ship.setX(0).setY(0);
  console.log("Ship respawn: " + ship.name);
  console.log("Event: " + game.timer.step);
});
game.on('shipSpawn', function(ship) {
  ship.setX(0).setY(0);
  console.log("Ship spawn: "+ship.name);
});
game.on('shipDestroy', function(ship, killer) {

});
game.on('shipDisconnect', function(ship) {

});

game.on('alienCreate', function(alien) {
  console.log("Alien created")
});
game.on('alienDestroy', function(alien, killer) {

});

game.on('asteroidCreate', function(asteroid) {

});
game.on('asteroidDestroy', function(asteroid, killer) {

});

game.on('collectibleCreate', function(collectible) {

});

game.on('collectiblePick', function(collectible, ship) {

});

game.on('stationDestroy', function(station) {
  console.log("Destroyed:", station)
});

game.on('stationModuleDestroy', function(station_module) {
  console.log("Destroyed:", station_module)
});

game.on('stationModuleRepair', function(station_module) {
  console.log("Repaired:", station_module)
});

game.on('UIComponentClick', function (component, ship) {

});

game.on('stop', function() {
  console.log("Mod stopped");
})

BrowserClient usage

From command line

npx starblast-modding [options] [mod_code]

To view list of options use npx starblast-modding --help

For example:

npx starblast-modding -r Asia -k 12345-67890 'echo("Hello World!")'

You can also load from configuration file:

npx starblast-modding -c ./config.json

Example configuration JSON file:

{
	"key": "12345-67890",
	"region": "Asia",

	"sourcemode": "local",
	"sourcepath": "./modcode.js",

	"watch": true,
	"interval": 5000,
	"timeout": 5000,

	"compression": false,
	"strict": false,
	"silent": false,
	"extended": false
}

Using NodeJS

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

const StarblastModding = require("starblast-modding");

let container = new StarblastModding.BrowserClient({
  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();

Support