From aa796e5aae9b05e9a844de1be87ef82886ea36e5 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:48:51 +0200 Subject: [PATCH] #1649 Fix deactivation of singular group entry per recursion step --- public/scripts/world-info.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 42ca983fb..4a7f8ac6a 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -2004,11 +2004,6 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) { for (const [key, group] of Object.entries(grouped)) { console.debug(`Checking inclusion group '${key}' with ${group.length} entries`, group); - if (!Array.isArray(group) || group.length <= 1) { - console.debug('Skipping inclusion group check, only one entry'); - continue; - } - if (Array.from(allActivatedEntries).some(x => x.group === key)) { console.debug(`Skipping inclusion group check, group already activated '${key}'`); // We need to forcefully deactivate all other entries in the group @@ -2018,6 +2013,11 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) { continue; } + if (!Array.isArray(group) || group.length <= 1) { + console.debug('Skipping inclusion group check, only one entry'); + continue; + } + // Do weighted random using probability of entry as weight const totalWeight = group.reduce((acc, item) => acc + item.probability, 0); const rollValue = Math.random() * totalWeight;