mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-24 00:13:52 -06:00
made it so that setting version to Any should now also include caf layers
This commit is contained in:
parent
6e33aa7552
commit
7d0ac0db40
20
mapvote.js
20
mapvote.js
@ -204,7 +204,7 @@ export default class MapVote extends BasePlugin
|
|||||||
|
|
||||||
if(!this.votingEnabled)
|
if(!this.votingEnabled)
|
||||||
{
|
{
|
||||||
await this.msgDirect(steamID, "Voting is already disabled");
|
await this.msgDirect(steamID, "Voting is already disabled, emotional damage!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.endVoting();
|
this.endVoting();
|
||||||
@ -238,11 +238,13 @@ export default class MapVote extends BasePlugin
|
|||||||
|
|
||||||
matchLayers(builtString)
|
matchLayers(builtString)
|
||||||
{
|
{
|
||||||
return Layers.layers.filter(element => element.layerid.startsWith(builtString));
|
return Layers.layers.filter(element => element.layerid.includes(builtString));
|
||||||
}
|
}
|
||||||
|
|
||||||
getMode(modes, currentMode)
|
getMode(nomination, currentMode)
|
||||||
{
|
{
|
||||||
|
const mapName = nomination.map;
|
||||||
|
let modes = nomination.modes;
|
||||||
let mode = modes[0];
|
let mode = modes[0];
|
||||||
|
|
||||||
if (mode === "Any")
|
if (mode === "Any")
|
||||||
@ -257,7 +259,7 @@ export default class MapVote extends BasePlugin
|
|||||||
{
|
{
|
||||||
mode = randomElement(this.modes);
|
mode = randomElement(this.modes);
|
||||||
modes = modes.filter(elem => elem !== mode);
|
modes = modes.filter(elem => elem !== mode);
|
||||||
if (matchLayers(`${cafPrefix}${mapName}_${mode}`).length > 0)
|
if (matchLayers(`${mapName}_${mode}`).length > 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,16 +313,14 @@ export default class MapVote extends BasePlugin
|
|||||||
let builtLayerString = `${cafPrefix}${mapName}_${mode}_${version}`;
|
let builtLayerString = `${cafPrefix}${mapName}_${mode}_${version}`;
|
||||||
if (version === "Any")
|
if (version === "Any")
|
||||||
{
|
{
|
||||||
let versions = matchLayers(`${cafPrefix}${mapName}_${mode}`);
|
let maps = matchLayers(`${mapName}_${mode}`);
|
||||||
if (versions.length == 0)
|
if (maps.length == 0)
|
||||||
{
|
{
|
||||||
this.verbose(1, `error: could not find layer for ${builtLayerString} from vote rule \"${layerString}\"`);
|
this.verbose(1, `error: could not find layer for ${builtLayerString} from vote rule \"${layerString}\"`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
versions = versions.map(l => l.layerid);
|
maps = maps.map(l => l.layerid);
|
||||||
version = randomElement(versions);
|
builtLayerString = randomElement(maps);
|
||||||
version = version.substring(version.lastIndexOf("_") + 1, version.length);
|
|
||||||
builtLayerString = `${cafPrefix}${mapName}_${mode}_${version}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Layers.getLayerByCondition((layer) => layer.layerid === builtLayerString))
|
if (!Layers.getLayerByCondition((layer) => layer.layerid === builtLayerString))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user