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
Release history Release notifications | RSS feed
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.2.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for haxball.py-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c8d08a1142f64256fb8a3c1ff501478734de3e61adc3142c5bfd6f75fc06f1c |
|
MD5 | c04903a4849d81dce93f86c5f6a14cbb |
|
BLAKE2b-256 | 6a33805d3192b69fa7728c4e7627346656f3a27c080aa1b389bfab4a463fac72 |