From eaf50c3a26fa7432c8d23a7dc1b28ff1df13e9e1 Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 15 Oct 2019 11:36:15 +1100 Subject: [PATCH] combiner fixes --- client/src/components/vbox.component.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index 47c15f6c..7b43931e 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -248,15 +248,24 @@ function Vbox(args) { function onClick(e) { if (vboxSelecting) clearVboxSelected(); if (reclaiming) return sendVboxReclaim(i); + + // 4 things selected if (combiner.length > 2) return combinerChange([i]); + // removing const combinerIndex = combiner.indexOf(i); if (combinerIndex > -1) { return combinerChange(without(combiner, i)); } - combiner.push(i); + + // invalid combo + const combinerItems = combiner.map(j => vbox.bound[j]); + if (!itemInfo.combos.some(combo => combinerItems.every(c => combo.components.includes(c)))) { + return combinerChange([i]); + } + return combinerChange(combiner); }