saviola777 / haxball-headless-manager

Suite of management scripts for headless haxball hosts, including plugins with dependency management
MIT License
7 stars 3 forks source link

Haxball Headless Manager

Suite of management scripts for headless haxball hosts, including plugins with dependency management. Changelog. License.

Quick start

Here's how to get started using HHM in a graphical environment:

More details below.

Overview

Useful links:

This README shows how to add repositories and plugins to your HHM / haxroomie configuration.

Configuration overview

This section will show the HHM configuration directives you will be using when running haxroomie, which is what most people will want to do.

These configuration directives are available in both HHM and haxroomie:

Adding repositories

A repository generally looks like this:

repositories = [{
    type: `github`,
    repository: `XHerna/fm-publicbot`,
    path: `plugins`, // optional, defaults to `src`
    version: `master`, // optional, this is the default value
    suffix: `.js`, // optional, this is the default value
  }
];

or

repositories = [{
    type: `local`,
    path: `/path/to/local/directory`,
    plugins: { pluginName: pluginSource },
  }
];

Note that the path is needed when specifying the repository in haxroomie, while the plugins is necessary when specifying the repository in HHM directly.

See the example configs to get a feeling for different ways of adding repositories into your config.

Adding plugins

Adding plugins can be done in several places:

Configuration file

To add a plugin in your configuration file, it has to be available in a repository (e.g., on GitHub or locally). You first have to add the repository and then add the plugin you want to use.

In this example, we will add the plugin sav/plugin-control, which we will need later on.

The plugin is available in the GitHub repository saviola777/hhm-plugins, so we add the following entry in our config:

HHM.config.repositories = [
  // […]
  {
    type: `github`,
    repository: `saviola777/hhm-plugins`
  },
];

This repository is already part of the default configuration file. To add the plugin, you have to add a line in the HHM.config.plugins variable:

HHM.config.plugins = {
  // […]
  'sav/plugin-control': {},
};

And that's it!

For Haxroomie you can add plugins in the configuration file in a similar way, see its README.

Developer console

If you just want to load your own plugin or native headless script into a running HHM system, paste your script into the following command:

HHM.manager.addPlugin({ pluginCode: `<paste your code here>`,
  pluginName: `_user/my-plugin` })

You can repeat this for any number of scripts / plugins, just make sure to change the plugin name at the end (and make sure the scripts don't interfere with each other).

In the room

To load a plugin from within the room, you have to first enable the plugin sav/plugin-control as described above. Then, you have to add a password for the host role in your config, like this:

HHM.config.plugins = {
  // […]
  'sav/roles': {
    roles: {
      'host': `add your host password here`,
      'admin': `add your admin password here`
    },
  },
};

Then, you have to authenticate for the host role in the room using the following command:

!auth host add your host password here

Now you can load plugins from configured repositories:

!plugin load fm/fill-teams

If some plugin causes problems you can enable and disable plugins as well:

!plugin disable fm/full-teams
!plugin enable _user/my-plugin

For more information on available plugins see the hhm-plugins repository.

Feedback and Contributing

Feel free to create pull requests for plugins or other changes, or create issues for bugs, questions or anything you want to discuss. You can find me in the official Haxball IRC channel #haxball at freenode and on the Haxroomie discord.