improve conflict detection w restricted zones
This commit is contained in:
parent
1ca61215be
commit
e56bc2ec62
1 changed files with 12 additions and 2 deletions
|
@ -194,6 +194,10 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restrictedZones {
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +212,10 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) {
|
||||||
if (!itemToAdd.appearanceOn) {
|
if (!itemToAdd.appearanceOn) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const itemToAddZoneIds = itemToAdd.appearanceOn.layers.map((l) => l.zone.id);
|
const itemToAddZoneIds = [
|
||||||
|
...itemToAdd.appearanceOn.layers.map((l) => l.zone.id),
|
||||||
|
...itemToAdd.appearanceOn.restrictedZones.map((z) => z.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)
|
||||||
);
|
);
|
||||||
|
@ -218,7 +225,10 @@ function findItemConflicts(itemIdToAdd, state, apolloClient) {
|
||||||
if (!wornItem.appearanceOn) {
|
if (!wornItem.appearanceOn) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const wornItemZoneIds = wornItem.appearanceOn.layers.map((l) => l.zone.id);
|
const wornItemZoneIds = [
|
||||||
|
...wornItem.appearanceOn.layers.map((l) => l.zone.id),
|
||||||
|
...wornItem.appearanceOn.restrictedZones.map((z) => z.id),
|
||||||
|
];
|
||||||
|
|
||||||
const hasConflict = wornItemZoneIds.some((zid) =>
|
const hasConflict = wornItemZoneIds.some((zid) =>
|
||||||
itemToAddZoneIds.includes(zid)
|
itemToAddZoneIds.includes(zid)
|
||||||
|
|
Loading…
Reference in a new issue