Oops, actually Static hides UCs!

This commit is contained in:
Emi Matchu 2021-03-13 01:08:48 -08:00
parent 56dd2bbdd7
commit d44315de2c

View file

@ -118,15 +118,17 @@ export function getVisibleLayers(petAppearance, itemAppearances) {
const validItemAppearances = itemAppearances.filter((a) => a);
const petLayers = petAppearance.layers.map((l) => ({ ...l, source: "pet" }));
const petOccupiedZoneIds = new Set(petLayers.map((l) => l.zone.id));
const itemLayers = validItemAppearances
.map((a) => a.layers)
.flat()
.map((l) => ({ ...l, source: "item" }))
// Don't let items occupy the same zones as the pet, e.g. Static on UCs.
.filter((l) => !petOccupiedZoneIds.has(l.zone.id));
.map((l) => ({ ...l, source: "item" }));
const itemOccupiedZoneIds = new Set(itemLayers.map((l) => l.zone.id));
const petLayers = petAppearance.layers
.map((l) => ({ ...l, source: "pet" }))
// Copying weird Neopets.com behavior: if an item occupies a zone that the
// pet also occupies, the pet's corresponding zone is hidden.
.filter((l) => !itemOccupiedZoneIds.has(l.zone.id));
let allLayers = [...petLayers, ...itemLayers];