even more robust handling of unfitting items
This commit is contained in:
parent
bed3cf7227
commit
aded259f1b
1 changed files with 6 additions and 0 deletions
|
@ -176,6 +176,9 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const itemToAdd = items.find((i) => i.id === itemIdToAdd);
|
const itemToAdd = items.find((i) => i.id === itemIdToAdd);
|
||||||
|
if (!itemToAdd.appearanceOn) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
const itemToAddZoneIds = itemToAdd.appearanceOn.layers.map((l) => l.zone.id);
|
const itemToAddZoneIds = itemToAdd.appearanceOn.layers.map((l) => l.zone.id);
|
||||||
const wornItems = Array.from(wornItemIds).map((id) =>
|
const wornItems = Array.from(wornItemIds).map((id) =>
|
||||||
items.find((i) => i.id === id)
|
items.find((i) => i.id === id)
|
||||||
|
@ -183,6 +186,9 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) {
|
||||||
|
|
||||||
const conflictingIds = [];
|
const conflictingIds = [];
|
||||||
for (const wornItem of wornItems) {
|
for (const wornItem of wornItems) {
|
||||||
|
if (!wornItem.appearanceOn) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const wornItemZoneIds = wornItem.appearanceOn.layers.map((l) => l.zone.id);
|
const wornItemZoneIds = wornItem.appearanceOn.layers.map((l) => l.zone.id);
|
||||||
|
|
||||||
const hasConflict = wornItemZoneIds.some((zid) =>
|
const hasConflict = wornItemZoneIds.some((zid) =>
|
||||||
|
|
Loading…
Reference in a new issue