mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-10 07:11:53 +00:00
can't kick when election or selection is started
This commit is contained in:
parent
3a2abd76c9
commit
fb39108c53
3 changed files with 13 additions and 12 deletions
|
@ -29,7 +29,7 @@ npm run watch # Compile and watch frontend assets
|
||||||
|
|
||||||
RANDOM_USER=true npm run dev # Run dev server, loading yourself as a random user
|
RANDOM_USER=true npm run dev # Run dev server, loading yourself as a random user
|
||||||
# or
|
# or
|
||||||
Fixed_USER=989 npm run dev # Run dev server, loading yourself as any user with the specified id
|
FIXED_USER=989 npm run dev # Run dev server, loading yourself as any user with the specified id
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run in production
|
## Run in production
|
||||||
|
|
|
@ -25,7 +25,7 @@ const ArchivedGather = mongoose.model("ArchivedGather");
|
||||||
const Event = mongoose.model("Event");
|
const Event = mongoose.model("Event");
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
const winston = require("winston");
|
const winston = require("winston");
|
||||||
const kickTimeout = 300 // sec
|
const kickTimeout = 600 // sec
|
||||||
|
|
||||||
module.exports = function (namespace) {
|
module.exports = function (namespace) {
|
||||||
const emitGather = (socket, gather) => {
|
const emitGather = (socket, gather) => {
|
||||||
|
@ -33,7 +33,7 @@ module.exports = function (namespace) {
|
||||||
gather: gather ? gather.toJson() : null,
|
gather: gather ? gather.toJson() : null,
|
||||||
type: gather ? gather.type : null,
|
type: gather ? gather.type : null,
|
||||||
maps: Map.list,
|
maps: Map.list,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeGatherer = (gather, user) => {
|
const removeGatherer = (gather, user) => {
|
||||||
|
@ -53,10 +53,10 @@ module.exports = function (namespace) {
|
||||||
refreshGather(gather.type);
|
refreshGather(gather.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const removeAfkGathererTimer = (gather, user) => {
|
const removeAfkGathererTimer = (gather, user) => {
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
if (gather.getGatherer(user).user.online) {
|
console.log(gather.current)
|
||||||
|
if (gather.getGatherer(user).user.online || gather.current !== "gathering") {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
}
|
}
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
@ -87,7 +87,7 @@ module.exports = function (namespace) {
|
||||||
} else {
|
} else {
|
||||||
const refresh = gatherRefreshers[type];
|
const refresh = gatherRefreshers[type];
|
||||||
if (refresh) refresh();
|
if (refresh) refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateUserAsOnlineInGather = (userId) => {
|
const updateUserAsOnlineInGather = (userId) => {
|
||||||
|
@ -105,7 +105,7 @@ module.exports = function (namespace) {
|
||||||
for (var gatherer of gatherManager.current.gatherers) {
|
for (var gatherer of gatherManager.current.gatherers) {
|
||||||
if (gatherer.user.id == userId && gatherer.user.online) {
|
if (gatherer.user.id == userId && gatherer.user.online) {
|
||||||
gatherer.user.online = false;
|
gatherer.user.online = false;
|
||||||
gatherer.user.lastSeen = Date.now();
|
gatherer.user.lastSeen = Date.now();
|
||||||
removeAfkGathererTimer(gatherManager.current, { ...gatherer.user, cooldown: false });
|
removeAfkGathererTimer(gatherManager.current, { ...gatherer.user, cooldown: false });
|
||||||
refreshGather(type);
|
refreshGather(type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,20 +257,21 @@ Gather.prototype.modifyGatherer = function (user, callback){
|
||||||
.forEach(callback);
|
.forEach(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 08/04/20 : 1-1-1-1-1
|
||||||
Gather.prototype.getPickingPattern = function () {
|
Gather.prototype.getPickingPattern = function () {
|
||||||
const pickingPattern = [ // 1-2-2-2-2-2-1
|
const pickingPattern = [
|
||||||
"marine",
|
"marine",
|
||||||
"alien",
|
"alien",
|
||||||
"alien",
|
|
||||||
"marine",
|
|
||||||
"marine",
|
"marine",
|
||||||
"alien",
|
"alien",
|
||||||
"alien",
|
|
||||||
"marine",
|
|
||||||
"marine",
|
"marine",
|
||||||
"alien",
|
"alien",
|
||||||
|
"marine",
|
||||||
"alien",
|
"alien",
|
||||||
"marine",
|
"marine",
|
||||||
|
"alien",
|
||||||
|
"marine",
|
||||||
|
"alien",
|
||||||
];
|
];
|
||||||
|
|
||||||
return pickingPattern;
|
return pickingPattern;
|
||||||
|
|
Loading…
Reference in a new issue