mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-24 02:33:52 -06:00
chore: confirm restart succeded
This commit is contained in:
parent
5b17f0961a
commit
20526e9f65
19
mapvote.js
19
mapvote.js
@ -429,7 +429,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
case "restartsqjs":
|
case "restartsqjs":
|
||||||
if (!isAdmin) return;
|
if (!isAdmin) return;
|
||||||
await this.warn(steamID, "Saving persistent data.\nTerminating SquadJS process.\nIf managed by a process manager it will automatically restart.")
|
await this.warn(steamID, "Saving persistent data.\nTerminating SquadJS process.\nIf managed by a process manager it will automatically restart.")
|
||||||
this.savePersistentData();
|
this.savePersistentData(steamID);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
@ -797,8 +797,17 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
let strMsg = "";
|
let strMsg = "";
|
||||||
for (let choice in this.nominations) {
|
for (let choice in this.nominations) {
|
||||||
choice = Number(choice);
|
choice = Number(choice);
|
||||||
|
|
||||||
|
let vLayer = Layers.layers.find(e => e.layerid == this.nominations[ choice ]);
|
||||||
|
// const allVecs = vLayer.teams[0].vehicles.concat(vLayer.teams[1].vehicles);
|
||||||
|
// const helis = vLayer?.teams[ 0 ].numberOfHelicopters || 0 + vLayer?.teams[ 1 ].numberOfHelicopters || 0
|
||||||
|
// const tanks = vLayer?.teams[ 0 ].numberOfTanks || 0 + vLayer?.teams[ 1 ].numberOfTanks || 0
|
||||||
|
// let assets = [];
|
||||||
|
// if (helis > 0) assets.push('Helis');
|
||||||
|
// if (tanks > 0) assets.push('Tanks');
|
||||||
|
// const vehiclesString = ' ' + assets.join('-');
|
||||||
// await this.msgDirect(steamID, formatChoice(choice, this.nominations[ choice ], this.tallies[ choice ]));
|
// await this.msgDirect(steamID, formatChoice(choice, this.nominations[ choice ], this.tallies[ choice ]));
|
||||||
strMsg += (steamID, formatChoice(choice, this.nominations[ choice ], this.tallies[ choice ])) + "\n";
|
strMsg += (steamID, formatChoice(choice, this.nominations[ choice ], this.tallies[ choice ])) + `H:${helis}-T:${tanks}` + "\n";
|
||||||
}
|
}
|
||||||
strMsg.trim();
|
strMsg.trim();
|
||||||
if (steamID) this.warn(steamID, strMsg)
|
if (steamID) this.warn(steamID, strMsg)
|
||||||
@ -873,7 +882,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.verbose(1, "Error restoring persistent data", e)
|
this.verbose(1, "Error restoring persistent data", e)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (bkData.manualRestartSender && bkData.manualRestartSender != "") this.warn(bkData.manualRestartSender,`SquadJS has completed the restart.\nPersistent data restored.`)
|
||||||
for (let k in bkData.server) this.server[ k ] = bkData.server[ k ];
|
for (let k in bkData.server) this.server[ k ] = bkData.server[ k ];
|
||||||
|
|
||||||
const maxSecondsDiffierence = 60
|
const maxSecondsDiffierence = 60
|
||||||
@ -891,10 +900,9 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
savePersistentData() {
|
savePersistentData(steamID = null) {
|
||||||
if (this.options.persistentDataFile == "") return;
|
if (this.options.persistentDataFile == "") return;
|
||||||
|
|
||||||
|
|
||||||
const saveDt = {
|
const saveDt = {
|
||||||
custom: {
|
custom: {
|
||||||
// layerHistory: this.server.layerHistory.slice(0, this.options.numberRecentMapsToExlude * 2).filter(l => l && l.layerid).map(l => l.layerid),
|
// layerHistory: this.server.layerHistory.slice(0, this.options.numberRecentMapsToExlude * 2).filter(l => l && l.layerid).map(l => l.layerid),
|
||||||
@ -910,6 +918,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
factionStrings: this.factionStrings,
|
factionStrings: this.factionStrings,
|
||||||
firstBroadcast: this.firstBroadcast
|
firstBroadcast: this.firstBroadcast
|
||||||
},
|
},
|
||||||
|
manualRestartSender: steamID,
|
||||||
saveDateTime: new Date()
|
saveDateTime: new Date()
|
||||||
}
|
}
|
||||||
// this.verbose(1, `Saving persistent data to: ${this.options.persistentDataFile}\n`, saveDt.server.layerHistory)
|
// this.verbose(1, `Saving persistent data to: ${this.options.persistentDataFile}\n`, saveDt.server.layerHistory)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user