screepsmod-admin-utils
Version:
## This is a Collection of utilities for Screeps Private Server admins
23 lines (20 loc) • 528 B
JavaScript
module.exports = config => {
return (listen, emit) => {
listen(/^roomsDone$/, async gameTime => {
const battles = await config.utils.warpath.getCurrentBattles(gameTime, 1)
for (const battle of battles) {
emit('warpath:battle', battle)
}
if (battles.length) {
emit('warpath:battles', battles)
}
})
return {
onSubscribe (channel, user, conn) {
return channel.startsWith('warpath')
},
onUnsubscribe (channel, user, conn) {
}
}
}
}