Skip to main content

Haxball web module.

Project description

Haxball.py


Uses

Index

import haxball.py
import asyncio

loop = asyncio.get_event_loop()
asyncio.ensure_future(Haxball("./bot.js").openroom())
loop.run_forever()

bot.js

window.onHBLoaded = function () {

      const room = window.HBInit({
        roomName: "My room",
        maxPlayers: 16,
        public: true,
        noPlayer: true,
        token: "TOKEN"// Token: https://www.haxball.com/headlesstoken
      })
      room.setDefaultStadium("Big");
      room.setScoreLimit(5);
      room.setTimeLimit(0);
      function updateAdmins() {
        var players = room.getPlayerList();
        if ( players.length == 0 ) return; 
        if ( players.find((player) => player.admin) != null ) return; 
        room.setPlayerAdmin(players[0].id, true);
      };
      room.onPlayerJoin = function(player) {
        updateAdmins();
      };
      room.onPlayerLeave = function(player) {
        updateAdmins();
      }

/**END CODE */

if (typeof window.HBInit === 'function')
      window.onHBLoaded()

}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haxball.py-1.0.3.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

haxball.py-1.0.3-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file haxball.py-1.0.3.tar.gz.

File metadata

  • Download URL: haxball.py-1.0.3.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for haxball.py-1.0.3.tar.gz
Algorithm Hash digest
SHA256 9cdecb91e0885eb2aeadd1ffb706bb26a0d25475d1b8a1489aaa4c353607ed61
MD5 aca2fefdd9d0ce2aabeb2307cad8e061
BLAKE2b-256 f64779e6d754a0d90b8e699f5de79edb34f9ddffaf128221e1b4f1f9800faab2

See more details on using hashes here.

File details

Details for the file haxball.py-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: haxball.py-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for haxball.py-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 31468fb0c6e1139ce569ecffbc73deacd3b3b7af2589de4cdbb694ad3b25a41e
MD5 dd8c26897b5667912d34bc61be4ffb2f
BLAKE2b-256 5c58c84bddeca9e26f6cbac6c3d78028ac96d5d194ecace82c7b0817d43b9e57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page