mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 20:43:52 -06:00
feat: main assets in voting list
This commit is contained in:
parent
8b73967b96
commit
5b17f0961a
24
mapvote.js
24
mapvote.js
@ -151,6 +151,11 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
description: "Timezone relative to UTC time. 0 for UTC, 2 for CEST (UTC+2), -1 (UTC-1) ",
|
description: "Timezone relative to UTC time. 0 for UTC, 2 for CEST (UTC+2), -1 (UTC-1) ",
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
|
includeMainAssetsInBroadcast: {
|
||||||
|
required: false,
|
||||||
|
description: "Shows/Hides Helis and Tanks in the broadcast if they are included in the voting layer",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
timeFrames: {
|
timeFrames: {
|
||||||
required: false,
|
required: false,
|
||||||
description: 'Array of timeframes to override options',
|
description: 'Array of timeframes to override options',
|
||||||
@ -196,8 +201,8 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.restorePersistentData = this.restorePersistentData.bind(this)
|
this.restorePersistentData = this.restorePersistentData.bind(this)
|
||||||
this.endVotingGently = this.endVotingGently.bind(this)
|
this.endVotingGently = this.endVotingGently.bind(this)
|
||||||
|
|
||||||
this.broadcast = (msg) => { this.server.rcon.broadcast(msg); };
|
this.broadcast = async (msg) => { await this.server.rcon.broadcast(msg); };
|
||||||
this.warn = (steamid, msg) => { this.server.rcon.warn(steamid, msg); };
|
this.warn = async (steamid, msg) => { await this.server.rcon.warn(steamid, msg); };
|
||||||
|
|
||||||
process.on('uncaughtException', this.savePersistentData);
|
process.on('uncaughtException', this.savePersistentData);
|
||||||
}
|
}
|
||||||
@ -726,11 +731,24 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
if (this.nominations.length > 0 && this.votingEnabled) {
|
if (this.nominations.length > 0 && this.votingEnabled) {
|
||||||
await this.broadcast(this.options.voteBroadcastMessage);
|
await this.broadcast(this.options.voteBroadcastMessage);
|
||||||
let nominationStrings = [];
|
let nominationStrings = [];
|
||||||
|
|
||||||
for (let choice = 1; choice < this.nominations.length; choice++) {
|
for (let choice = 1; choice < this.nominations.length; choice++) {
|
||||||
choice = Number(choice);
|
choice = Number(choice);
|
||||||
let vLayer = Layers.layers.find(e => e.layerid == this.nominations[ choice ]);
|
let vLayer = Layers.layers.find(e => e.layerid == this.nominations[ choice ]);
|
||||||
nominationStrings.push(formatChoice(choice, vLayer.map.name + ' ' + vLayer.gamemode + ' ' + this.factionStrings[ choice ], this.tallies[ choice ], (this.options.hideVotesCount || this.firstBroadcast)));
|
// const allVecs = vLayer.teams[0].vehicles.concat(vLayer.teams[1].vehicles);
|
||||||
|
const helis = vLayer.teams[ 0 ].numberOfHelicopters + vLayer.teams[ 1 ].numberOfHelicopters
|
||||||
|
const tanks = vLayer.teams[ 0 ].numberOfTanks + vLayer.teams[ 1 ].numberOfTanks
|
||||||
|
let assets = [];
|
||||||
|
if (helis > 0) assets.push('Helis');
|
||||||
|
if (tanks > 0) assets.push('Tanks');
|
||||||
|
const vehiclesString = this.options.includeMainAssetsInBroadcast ? ' ' + assets.join('-') : '';
|
||||||
|
nominationStrings.push(formatChoice(choice, vLayer.map.name + ' ' + vLayer.gamemode + ' ' + this.factionStrings[ choice ] + vehiclesString, this.tallies[ choice ], (this.options.hideVotesCount || this.firstBroadcast)));
|
||||||
|
if (nominationStrings.length == 3) {
|
||||||
|
await this.broadcast(nominationStrings.join("\n"));
|
||||||
|
nominationStrings = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.nominations[ 0 ]) nominationStrings.push(formatChoice(0, this.nominations[ 0 ], this.tallies[ 0 ], (this.options.hideVotesCount || this.firstBroadcast)))
|
if (this.nominations[ 0 ]) nominationStrings.push(formatChoice(0, this.nominations[ 0 ], this.tallies[ 0 ], (this.options.hideVotesCount || this.firstBroadcast)))
|
||||||
await this.broadcast(nominationStrings.join("\n"));
|
await this.broadcast(nominationStrings.join("\n"));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user