More aggressive zone filtering for UCs

This commit is contained in:
Emi Matchu 2021-04-29 12:38:31 -07:00
parent d373a7a54f
commit cb104954af

View file

@ -156,27 +156,39 @@ export function getVisibleLayers(petAppearance, itemAppearances) {
return false; return false;
} }
// When a pet appearance restricts or occupies a zone, it makes items // When a pet appearance restricts or occupies a zone, or when the pet is
// that occupy the zone incompatible, but *only* if the item is // Unconverted, it makes body-specific items incompatible. We use this to
// body-specific. We use this to disallow UCs from wearing certain // disallow UCs from wearing certain body-specific Biology Effects,
// body-specific Biology Effects, Statics, etc, while still allowing // Statics, etc, while still allowing non-body-specific items in those
// non-body-specific items in those zones! (I think this happens for some // zones! (I think this happens for some Invisible pet stuff, too?)
// Invisible pet stuff, too?) //
// TODO: We shouldn't be *hiding* these zones, like we do with items; we
// should be doing this way earlier, to prevent the item from even
// showing up even in search results!
// //
// NOTE: This can result in both pet layers and items occupying the same // NOTE: This can result in both pet layers and items occupying the same
// zone, like Static! That's correct, and the item layer should be // zone, like Static, so long as the item isn't body-specific! That's
// on top! (Here, we implement it by placing item layers second in // correct, and the item layer should be on top! (Here, we implement
// the list, and depending on JS sort stability, and *then* depending // it by placing item layers second in the list, and rely on JS sort
// on the UI to respect that ordering when rendering them by depth. // stability, and *then* rely on the UI to respect that ordering when
// Not great! 😅) // rendering them by depth. Not great! 😅)
// //
// TODO: Hiding the layer is the *old* behavior. Move this way deeper in // NOTE: UCs used to implement their restrictions by listing specific
// the code to prevent these items from showing up in the first // zones, but it seems that the logic has changed to just be about
// place! // UC-ness and body-specific-ness, and not necessarily involve the
// set of restricted zones at all. (This matters because e.g. UCs
// shouldn't show _any_ part of the Rainy Day Umbrella, but most UCs
// don't restrict Right-Hand Item (Zone 49).) Still, I'm keeping the
// zone restriction case running too, because I don't think it
// _hurts_ anything, and I'm not confident enough in this conclusion.
//
// TODO: Do Invisibles follow this new rule like UCs, too? Or do they still
// use zone restrictions?
if ( if (
layer.source === "item" && layer.source === "item" &&
layer.bodyId !== "0" && layer.bodyId !== "0" &&
petOccupiedOrRestrictedZoneIds.has(layer.zone.id) (petAppearance.pose === "UNCONVERTED" ||
petOccupiedOrRestrictedZoneIds.has(layer.zone.id))
) { ) {
return false; return false;
} }
@ -257,6 +269,7 @@ export const itemAppearanceFragment = gql`
export const petAppearanceFragmentForGetVisibleLayers = gql` export const petAppearanceFragmentForGetVisibleLayers = gql`
fragment PetAppearanceForGetVisibleLayers on PetAppearance { fragment PetAppearanceForGetVisibleLayers on PetAppearance {
id id
pose
layers { layers {
id id
zone { zone {