mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-10 07:11:53 +00:00
Added logging for admin removal
This commit is contained in:
parent
2531d82221
commit
efaa7ae94f
1 changed files with 11 additions and 8 deletions
|
@ -32,7 +32,7 @@ const emitGather = (socket, gather) => {
|
|||
type: gather ? gather.type : null,
|
||||
maps: Map.list,
|
||||
servers: Server.list
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function (namespace) {
|
||||
|
@ -99,12 +99,12 @@ module.exports = function (namespace) {
|
|||
let helper = require("./helper");
|
||||
|
||||
GatherPool.forEach(gatherManager => {
|
||||
helper.createTestUsers({
|
||||
gather: gatherManager.current
|
||||
}, refreshGather());
|
||||
helper.createTestUsers({
|
||||
gather: gatherManager.current
|
||||
}, refreshGather());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
namespace.on("connection", function (socket) {
|
||||
ArchivedGather.recent((error, recentGathers) => {
|
||||
if (error) return winston.error(error);
|
||||
|
@ -165,7 +165,10 @@ module.exports = function (namespace) {
|
|||
if (data.gatherer) {
|
||||
// Remove gatherer defined by ID (admins only)
|
||||
if (!socket._user.isGatherAdmin()) return;
|
||||
removeGatherer(gather, { id: data.gatherer, cooldown: true });
|
||||
removeGatherer(gather, { id: data.gatherer, cooldown: true });
|
||||
let adminName = socket._user.username;
|
||||
let playerName = data.gatherer.user.username;
|
||||
winston.info(`Admin removal: ${adminName} removed ${playerName} from the gather.`);
|
||||
} else {
|
||||
// Remove gatherer attached to socket
|
||||
removeGatherer(gather, socket._user);
|
||||
|
@ -201,7 +204,7 @@ module.exports = function (namespace) {
|
|||
|
||||
// Check if last player and add to last team
|
||||
if (gather.lobby().length === 1) {
|
||||
let assignLast = (gather.marines().length === 6) ?
|
||||
let assignLast = (gather.marines().length === 6) ?
|
||||
gather.moveToAlien : gather.moveToMarine;
|
||||
assignLast.call(gather, gather.lobby().pop());
|
||||
}
|
||||
|
@ -216,7 +219,7 @@ module.exports = function (namespace) {
|
|||
});
|
||||
|
||||
socket.on("disconnect", function () {
|
||||
|
||||
|
||||
});
|
||||
|
||||
socket.on("gather:vote", function (data) {
|
||||
|
|
Loading…
Reference in a new issue