mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-26 12:17:23 +00:00
Remove color override redundency
This commit is contained in:
BIN
dist/extension.zip
vendored
BIN
dist/extension.zip
vendored
Binary file not shown.
2
dist/extension/birb.js
vendored
2
dist/extension/birb.js
vendored
@@ -599,9 +599,7 @@
|
|||||||
"#373737": PALETTE.FEATHER_SPINE,
|
"#373737": PALETTE.FEATHER_SPINE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bird species rarit
|
|
||||||
* @type {Record<string, string>}
|
* @type {Record<string, string>}
|
||||||
*/
|
*/
|
||||||
const RARITY = {
|
const RARITY = {
|
||||||
|
|||||||
2
dist/obsidian/main.js
vendored
2
dist/obsidian/main.js
vendored
@@ -604,9 +604,7 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
"#373737": PALETTE.FEATHER_SPINE,
|
"#373737": PALETTE.FEATHER_SPINE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bird species rarit
|
|
||||||
* @type {Record<string, string>}
|
* @type {Record<string, string>}
|
||||||
*/
|
*/
|
||||||
const RARITY = {
|
const RARITY = {
|
||||||
|
|||||||
2
dist/userscript/birb.user.js
vendored
2
dist/userscript/birb.user.js
vendored
@@ -613,9 +613,7 @@
|
|||||||
"#373737": PALETTE.FEATHER_SPINE,
|
"#373737": PALETTE.FEATHER_SPINE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bird species rarit
|
|
||||||
* @type {Record<string, string>}
|
* @type {Record<string, string>}
|
||||||
*/
|
*/
|
||||||
const RARITY = {
|
const RARITY = {
|
||||||
|
|||||||
2
dist/web/birb.embed.js
vendored
2
dist/web/birb.embed.js
vendored
@@ -599,9 +599,7 @@
|
|||||||
"#373737": PALETTE.FEATHER_SPINE,
|
"#373737": PALETTE.FEATHER_SPINE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bird species rarit
|
|
||||||
* @type {Record<string, string>}
|
* @type {Record<string, string>}
|
||||||
*/
|
*/
|
||||||
const RARITY = {
|
const RARITY = {
|
||||||
|
|||||||
2
dist/web/birb.js
vendored
2
dist/web/birb.js
vendored
@@ -599,9 +599,7 @@
|
|||||||
"#373737": PALETTE.FEATHER_SPINE,
|
"#373737": PALETTE.FEATHER_SPINE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bird species rarit
|
|
||||||
* @type {Record<string, string>}
|
* @type {Record<string, string>}
|
||||||
*/
|
*/
|
||||||
const RARITY = {
|
const RARITY = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// @ts-check
|
// @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 Layer, { TAG } from '../src/animation/layer.js';
|
||||||
import Frame from '../src/animation/frame.js';
|
import Frame from '../src/animation/frame.js';
|
||||||
import { Directions, getLayerPixels } from '../src/shared.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 COLOR_MAP = SPRITE_SHEET_COLOR_MAP;
|
||||||
const SPRITE_PATH = "../sprites/birb.png";
|
const SPRITE_PATH = "../sprites/birb.png";
|
||||||
const SPRITE_SIZE = 32;
|
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(
|
const IGNORED_PARTS = new Set(
|
||||||
["transparent", "border", "heart", "heart-border", "heart-shine", "feather-spine"]
|
["transparent", "border", "heart", "heart-border", "heart-shine", "feather-spine"]
|
||||||
);
|
);
|
||||||
@@ -169,8 +152,8 @@ function getColor(part) {
|
|||||||
if (currentSpecies.colors[part]) {
|
if (currentSpecies.colors[part]) {
|
||||||
return currentSpecies.colors[part];
|
return currentSpecies.colors[part];
|
||||||
}
|
}
|
||||||
if (DEFAULT_OVERRIDES[part]) {
|
if (DEFAULT_COLOR_OVERRIDES[part]) {
|
||||||
return getColor(DEFAULT_OVERRIDES[part]);
|
return getColor(DEFAULT_COLOR_OVERRIDES[part]);
|
||||||
}
|
}
|
||||||
for (const [color, partName] of Object.entries(COLOR_MAP)) {
|
for (const [color, partName] of Object.entries(COLOR_MAP)) {
|
||||||
if (partName === part) {
|
if (partName === part) {
|
||||||
|
|||||||
@@ -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>}
|
* @type {Record<string, string>}
|
||||||
*/
|
*/
|
||||||
export const RARITY = {
|
export const RARITY = {
|
||||||
|
|||||||
Reference in New Issue
Block a user