Add REQUIRES_OTHER_BODY_SPECIFIC_ASSETS glitch
This helps with items like "Living in Watermelon Foreground and Background", which has a species-specific foreground and bodyId=0 background. With this flag set on the background, it won't appear for pets that don't _also_ have something else that fits. In this case, it hides it from Standard Vandas, and all non-standard colors. There's some hacky limitations here: the item page still highlights the Vanda, even though clicking gives nothing; and the zone info for it is messy too, with the Background claiming to fit all species, and the LFI claiming to fit 54 specific species. But those don't seem important enough to code for!
This commit is contained in:
parent
4e9805af60
commit
92db11b995
4 changed files with 58 additions and 3 deletions
|
@ -309,6 +309,10 @@ function AllItemLayersSupportModalContent({
|
||||||
{mutationError.message}
|
{mutationError.message}
|
||||||
</ErrorMessage>
|
</ErrorMessage>
|
||||||
)}
|
)}
|
||||||
|
<Button flex="0 0 auto" size="sm" onClick={onBulkAddComplete}>
|
||||||
|
Clear
|
||||||
|
</Button>
|
||||||
|
<Box width="2" />
|
||||||
<Button
|
<Button
|
||||||
flex="0 0 auto"
|
flex="0 0 auto"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|
|
@ -436,6 +436,12 @@ function ItemLayerSupportKnownGlitchesFields({
|
||||||
(Will use the PNG instead)
|
(Will use the PNG instead)
|
||||||
</Box>
|
</Box>
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
|
<Checkbox value="REQUIRES_OTHER_BODY_SPECIFIC_ASSETS">
|
||||||
|
Only fits pets with other body-specific assets{" "}
|
||||||
|
<Box display="inline" color="gray.400" fontSize="sm">
|
||||||
|
(DTI's fault: bodyId=0 is a lie!)
|
||||||
|
</Box>
|
||||||
|
</Checkbox>
|
||||||
</VStack>
|
</VStack>
|
||||||
</CheckboxGroup>
|
</CheckboxGroup>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
|
@ -89,6 +89,15 @@ const typeDefs = gql`
|
||||||
#
|
#
|
||||||
# For affected layers, svgUrl will be null, regardless of the manifest.
|
# For affected layers, svgUrl will be null, regardless of the manifest.
|
||||||
OFFICIAL_SVG_IS_INCORRECT
|
OFFICIAL_SVG_IS_INCORRECT
|
||||||
|
|
||||||
|
# This glitch is a hack for a bug in DTI: some items, like "Living in
|
||||||
|
# Watermelon Foreground and Background", have a background layer that's
|
||||||
|
# shared across all bodies - but it should NOT fit pets that don't have a
|
||||||
|
# corresponding body-specific foreground!
|
||||||
|
#
|
||||||
|
# The long-term fix here is to refactor our data to not use bodyId=0, and
|
||||||
|
# instead have a more robust concept of item appearance across bodies.
|
||||||
|
REQUIRES_OTHER_BODY_SPECIFIC_ASSETS
|
||||||
}
|
}
|
||||||
|
|
||||||
extend type Query {
|
extend type Query {
|
||||||
|
@ -109,6 +118,13 @@ const typeDefs = gql`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
// Extract the AppearanceLayerKnownGlitch values, to filter on later.
|
||||||
|
const ALL_KNOWN_GLITCH_VALUES = new Set(
|
||||||
|
typeDefs.definitions
|
||||||
|
.find((d) => d.name.value === "AppearanceLayerKnownGlitch")
|
||||||
|
.values.map((v) => v.name.value)
|
||||||
|
);
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
AppearanceLayer: {
|
AppearanceLayer: {
|
||||||
remoteId: async ({ id }, _, { swfAssetLoader }) => {
|
remoteId: async ({ id }, _, { swfAssetLoader }) => {
|
||||||
|
@ -253,7 +269,22 @@ const resolvers = {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return layer.knownGlitches.split(",");
|
let knownGlitches = layer.knownGlitches.split(",");
|
||||||
|
|
||||||
|
// Skip glitches that our GraphQL definition doesn't recognize. This
|
||||||
|
// helps old clients avoid crashing (or even the latest prod client from
|
||||||
|
// crashing when we're developing new glitch flags!).
|
||||||
|
knownGlitches = knownGlitches.filter((knownGlitch) => {
|
||||||
|
if (!ALL_KNOWN_GLITCH_VALUES.has(knownGlitch)) {
|
||||||
|
console.warn(
|
||||||
|
`Layer ${id}: Skipping unexpected knownGlitches value: ${knownGlitch}`
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
return knownGlitches;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ const resolvers = {
|
||||||
compatibleBodiesAndTheirZones: async ({ id }, _, { db }) => {
|
compatibleBodiesAndTheirZones: async ({ id }, _, { db }) => {
|
||||||
const [rows, __] = await db.query(
|
const [rows, __] = await db.query(
|
||||||
`
|
`
|
||||||
SELECT
|
SELECT
|
||||||
swf_assets.body_id AS bodyId,
|
swf_assets.body_id AS bodyId,
|
||||||
(SELECT species_id FROM pet_types WHERE body_id = bodyId LIMIT 1)
|
(SELECT species_id FROM pet_types WHERE body_id = bodyId LIMIT 1)
|
||||||
AS speciesId,
|
AS speciesId,
|
||||||
|
@ -498,7 +498,21 @@ const resolvers = {
|
||||||
bodyId,
|
bodyId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return allSwfAssets.filter((sa) => sa.url.endsWith(".swf"));
|
let assets = allSwfAssets.filter((sa) => sa.url.endsWith(".swf"));
|
||||||
|
|
||||||
|
// If there are no body-specific assets in this appearance, then remove
|
||||||
|
// assets with the glitch flag REQUIRES_OTHER_BODY_SPECIFIC_ASSETS: the
|
||||||
|
// requirement isn't met!
|
||||||
|
const hasBodySpecificAssets = assets.some((sa) => sa.bodyId !== "0");
|
||||||
|
if (!hasBodySpecificAssets) {
|
||||||
|
assets = assets.filter((sa) => {
|
||||||
|
return !sa.knownGlitches
|
||||||
|
.split(",")
|
||||||
|
.includes("REQUIRES_OTHER_BODY_SPECIFIC_ASSETS");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return assets.map(({ id }) => ({ id }));
|
||||||
},
|
},
|
||||||
restrictedZones: async (
|
restrictedZones: async (
|
||||||
{ item: { id: itemId }, bodyId },
|
{ item: { id: itemId }, bodyId },
|
||||||
|
|
Loading…
Reference in a new issue