Remove color override redundency

This commit is contained in:
Idrees Hassan
2026-03-28 10:38:19 -07:00
parent 3765713fd0
commit 30b9c86cca
8 changed files with 23 additions and 31 deletions

BIN
dist/extension.zip vendored

Binary file not shown.

View File

@@ -599,9 +599,7 @@
"#373737": PALETTE.FEATHER_SPINE,
};
/**
* Bird species rarit
* @type {Record<string, string>}
*/
const RARITY = {

View File

@@ -604,9 +604,7 @@ module.exports = class PocketBird extends Plugin {
"#373737": PALETTE.FEATHER_SPINE,
};
/**
* Bird species rarit
* @type {Record<string, string>}
*/
const RARITY = {

View File

@@ -613,9 +613,7 @@
"#373737": PALETTE.FEATHER_SPINE,
};
/**
* Bird species rarit
* @type {Record<string, string>}
*/
const RARITY = {

View File

@@ -599,9 +599,7 @@
"#373737": PALETTE.FEATHER_SPINE,
};
/**
* Bird species rarit
* @type {Record<string, string>}
*/
const RARITY = {

2
dist/web/birb.js vendored
View File

@@ -599,9 +599,7 @@
"#373737": PALETTE.FEATHER_SPINE,
};
/**
* Bird species rarit
* @type {Record<string, string>}
*/
const RARITY = {

View File

@@ -1,5 +1,5 @@
// @ts-check
import { SPRITE_SHEET_COLOR_MAP, PALETTE, loadSpriteSheetPixels } from '../src/animation/sprites.js';
import { SPRITE_SHEET_COLOR_MAP, PALETTE, DEFAULT_COLOR_OVERRIDES, loadSpriteSheetPixels } from '../src/animation/sprites.js';
import Layer, { TAG } from '../src/animation/layer.js';
import Frame from '../src/animation/frame.js';
import { Directions, getLayerPixels } from '../src/shared.js';
@@ -10,23 +10,6 @@ import species from '../src/species.js';
const COLOR_MAP = SPRITE_SHEET_COLOR_MAP;
const SPRITE_PATH = "../sprites/birb.png";
const SPRITE_SIZE = 32;
/** @type {Record<string, string>} */
const DEFAULT_OVERRIDES = {
"hood": "face",
"eyebrow": "face",
"upper-eyelid": "eyebrow",
"upper-corner-eye": "eyebrow",
"behind-eye": "face",
"corner-eye": "face",
"temple": "face",
"lower-eyelid": "face",
"nose": "face",
"nose-tip": "nose",
"cheek": "face",
"scruff": "face",
"collar": "face",
"collar-scruff": "collar"
};
const IGNORED_PARTS = new Set(
["transparent", "border", "heart", "heart-border", "heart-shine", "feather-spine"]
);
@@ -169,8 +152,8 @@ function getColor(part) {
if (currentSpecies.colors[part]) {
return currentSpecies.colors[part];
}
if (DEFAULT_OVERRIDES[part]) {
return getColor(DEFAULT_OVERRIDES[part]);
if (DEFAULT_COLOR_OVERRIDES[part]) {
return getColor(DEFAULT_COLOR_OVERRIDES[part]);
}
for (const [color, partName] of Object.entries(COLOR_MAP)) {
if (partName === part) {

View File

@@ -76,7 +76,26 @@ export const SPRITE_SHEET_COLOR_MAP = {
/**
* Bird species rarit
* @type {Record<string, string>}
*/
export const DEFAULT_COLOR_OVERRIDES = {
[PALETTE.HOOD]: PALETTE.FACE,
[PALETTE.EYEBROW]: PALETTE.FACE,
[PALETTE.UPPER_EYELID]: PALETTE.EYEBROW,
[PALETTE.UPPER_CORNER_EYE]: PALETTE.EYEBROW,
[PALETTE.BEHIND_EYE]: PALETTE.FACE,
[PALETTE.CORNER_EYE]: PALETTE.FACE,
[PALETTE.TEMPLE]: PALETTE.FACE,
[PALETTE.LOWER_EYELID]: PALETTE.FACE,
[PALETTE.NOSE]: PALETTE.FACE,
[PALETTE.NOSE_TIP]: PALETTE.NOSE,
[PALETTE.CHEEK]: PALETTE.FACE,
[PALETTE.SCRUFF]: PALETTE.FACE,
[PALETTE.COLLAR]: PALETTE.FACE,
[PALETTE.COLLAR_SCRUFF]: PALETTE.COLLAR,
};
/**
* @type {Record<string, string>}
*/
export const RARITY = {