From 1785a832a665408b63949d222d377ae417bc59bf Mon Sep 17 00:00:00 2001 From: maskedmonkyman Date: Tue, 22 Mar 2022 12:54:19 -0700 Subject: [PATCH] moved some things around in populate nominations function to make it more clear --- mapvote.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mapvote.js b/mapvote.js index a25f3ee..7b84026 100644 --- a/mapvote.js +++ b/mapvote.js @@ -239,22 +239,24 @@ export default class MapVote extends BasePlugin //TODO: right now if version is set to "Any" no caf layers will be selected populateNominations() //gets nomination strings from layer options { + //helpers + const splitName = name => name.substring(0, name.lastIndexOf("_")); + const removeCAF = name => name.replace("CAF_", ""); + const matchLayers = builtString => Layers.layers.filter((element) => element.layerid.startsWith(builtString)); + if (!this.server.currentLayer) { this.verbose(1, "Error: unknown currentLayer"); endVoting(); return; } - const splitName = name => name.substring(0, name.lastIndexOf("_")); - const removeCAF = name => name.replace("CAF_", ""); this.nominations = []; const rulesList = this.voteRules.rules; let layerString = this.server.currentLayer.layerid; let nominationsList = rulesList.default; - - const matchLayers = builtString => Layers.layers.filter((element) => element.layerid.startsWith(builtString)); + //chomp string until we find a match while(layerString.length > 0) { if(layerString in rulesList)