Add hat to save data

This commit is contained in:
Idrees Hassan
2026-01-19 20:38:00 -05:00
parent 3227167cb5
commit 7628ee2c87
7 changed files with 48 additions and 18 deletions

BIN
dist/extension.zip vendored

Binary file not shown.

View File

@@ -1513,6 +1513,7 @@
* @typedef {Object} BirbSaveData
* @property {string[]} unlockedSpecies
* @property {string} currentSpecies
* @property {string} currentHat
* @property {Partial<Settings>} settings
* @property {SavedStickyNote[]} [stickyNotes]
*/
@@ -1927,6 +1928,7 @@
const WARDROBE_ID = "birb-wardrobe";
const DEFAULT_BIRD = "bluebird";
const DEFAULT_HAT = HAT.NONE;
// Birb movement
const HOP_SPEED = 0.07;
@@ -2079,7 +2081,7 @@
let petStack = [];
let currentSpecies = DEFAULT_BIRD;
let unlockedSpecies = [DEFAULT_BIRD];
let currentHat = HAT.TOP_HAT;
let currentHat = DEFAULT_HAT;
// let visible = true;
let lastPetTimestamp = 0;
/** @type {StickyNote[]} */
@@ -2098,6 +2100,7 @@
userSettings = saveData.settings ?? {};
unlockedSpecies = saveData.unlockedSpecies ?? [DEFAULT_BIRD];
currentSpecies = saveData.currentSpecies ?? DEFAULT_BIRD;
currentHat = saveData.currentHat ?? DEFAULT_HAT;
stickyNotes = [];
if (saveData.stickyNotes) {
@@ -2110,13 +2113,15 @@
log(stickyNotes.length + " sticky notes loaded");
switchSpecies(currentSpecies);
switchHat(currentHat);
}
function save() {
/** @type {BirbSaveData} */
const saveData = {
unlockedSpecies,
currentSpecies,
unlockedSpecies: unlockedSpecies,
currentSpecies: currentSpecies,
currentHat: currentHat,
settings: userSettings
};

11
dist/obsidian/main.js vendored
View File

@@ -1556,6 +1556,7 @@ module.exports = class PocketBird extends Plugin {
* @typedef {Object} BirbSaveData
* @property {string[]} unlockedSpecies
* @property {string} currentSpecies
* @property {string} currentHat
* @property {Partial<Settings>} settings
* @property {SavedStickyNote[]} [stickyNotes]
*/
@@ -1970,6 +1971,7 @@ module.exports = class PocketBird extends Plugin {
const WARDROBE_ID = "birb-wardrobe";
const DEFAULT_BIRD = "bluebird";
const DEFAULT_HAT = HAT.NONE;
// Birb movement
const HOP_SPEED = 0.07;
@@ -2122,7 +2124,7 @@ module.exports = class PocketBird extends Plugin {
let petStack = [];
let currentSpecies = DEFAULT_BIRD;
let unlockedSpecies = [DEFAULT_BIRD];
let currentHat = HAT.TOP_HAT;
let currentHat = DEFAULT_HAT;
// let visible = true;
let lastPetTimestamp = 0;
/** @type {StickyNote[]} */
@@ -2141,6 +2143,7 @@ module.exports = class PocketBird extends Plugin {
userSettings = saveData.settings ?? {};
unlockedSpecies = saveData.unlockedSpecies ?? [DEFAULT_BIRD];
currentSpecies = saveData.currentSpecies ?? DEFAULT_BIRD;
currentHat = saveData.currentHat ?? DEFAULT_HAT;
stickyNotes = [];
if (saveData.stickyNotes) {
@@ -2153,13 +2156,15 @@ module.exports = class PocketBird extends Plugin {
log(stickyNotes.length + " sticky notes loaded");
switchSpecies(currentSpecies);
switchHat(currentHat);
}
function save() {
/** @type {BirbSaveData} */
const saveData = {
unlockedSpecies,
currentSpecies,
unlockedSpecies: unlockedSpecies,
currentSpecies: currentSpecies,
currentHat: currentHat,
settings: userSettings
};

View File

@@ -1518,6 +1518,7 @@
* @typedef {Object} BirbSaveData
* @property {string[]} unlockedSpecies
* @property {string} currentSpecies
* @property {string} currentHat
* @property {Partial<Settings>} settings
* @property {SavedStickyNote[]} [stickyNotes]
*/
@@ -1932,6 +1933,7 @@
const WARDROBE_ID = "birb-wardrobe";
const DEFAULT_BIRD = "bluebird";
const DEFAULT_HAT = HAT.NONE;
// Birb movement
const HOP_SPEED = 0.07;
@@ -2084,7 +2086,7 @@
let petStack = [];
let currentSpecies = DEFAULT_BIRD;
let unlockedSpecies = [DEFAULT_BIRD];
let currentHat = HAT.TOP_HAT;
let currentHat = DEFAULT_HAT;
// let visible = true;
let lastPetTimestamp = 0;
/** @type {StickyNote[]} */
@@ -2103,6 +2105,7 @@
userSettings = saveData.settings ?? {};
unlockedSpecies = saveData.unlockedSpecies ?? [DEFAULT_BIRD];
currentSpecies = saveData.currentSpecies ?? DEFAULT_BIRD;
currentHat = saveData.currentHat ?? DEFAULT_HAT;
stickyNotes = [];
if (saveData.stickyNotes) {
@@ -2115,13 +2118,15 @@
log(stickyNotes.length + " sticky notes loaded");
switchSpecies(currentSpecies);
switchHat(currentHat);
}
function save() {
/** @type {BirbSaveData} */
const saveData = {
unlockedSpecies,
currentSpecies,
unlockedSpecies: unlockedSpecies,
currentSpecies: currentSpecies,
currentHat: currentHat,
settings: userSettings
};

View File

@@ -1498,6 +1498,7 @@
* @typedef {Object} BirbSaveData
* @property {string[]} unlockedSpecies
* @property {string} currentSpecies
* @property {string} currentHat
* @property {Partial<Settings>} settings
* @property {SavedStickyNote[]} [stickyNotes]
*/
@@ -1912,6 +1913,7 @@
const WARDROBE_ID = "birb-wardrobe";
const DEFAULT_BIRD = "bluebird";
const DEFAULT_HAT = HAT.NONE;
// Birb movement
const HOP_SPEED = 0.07;
@@ -2064,7 +2066,7 @@
let petStack = [];
let currentSpecies = DEFAULT_BIRD;
let unlockedSpecies = [DEFAULT_BIRD];
let currentHat = HAT.TOP_HAT;
let currentHat = DEFAULT_HAT;
// let visible = true;
let lastPetTimestamp = 0;
/** @type {StickyNote[]} */
@@ -2083,6 +2085,7 @@
userSettings = saveData.settings ?? {};
unlockedSpecies = saveData.unlockedSpecies ?? [DEFAULT_BIRD];
currentSpecies = saveData.currentSpecies ?? DEFAULT_BIRD;
currentHat = saveData.currentHat ?? DEFAULT_HAT;
stickyNotes = [];
if (saveData.stickyNotes) {
@@ -2095,13 +2098,15 @@
log(stickyNotes.length + " sticky notes loaded");
switchSpecies(currentSpecies);
switchHat(currentHat);
}
function save() {
/** @type {BirbSaveData} */
const saveData = {
unlockedSpecies,
currentSpecies,
unlockedSpecies: unlockedSpecies,
currentSpecies: currentSpecies,
currentHat: currentHat,
settings: userSettings
};

11
dist/web/birb.js vendored
View File

@@ -1498,6 +1498,7 @@
* @typedef {Object} BirbSaveData
* @property {string[]} unlockedSpecies
* @property {string} currentSpecies
* @property {string} currentHat
* @property {Partial<Settings>} settings
* @property {SavedStickyNote[]} [stickyNotes]
*/
@@ -1912,6 +1913,7 @@
const WARDROBE_ID = "birb-wardrobe";
const DEFAULT_BIRD = "bluebird";
const DEFAULT_HAT = HAT.NONE;
// Birb movement
const HOP_SPEED = 0.07;
@@ -2064,7 +2066,7 @@
let petStack = [];
let currentSpecies = DEFAULT_BIRD;
let unlockedSpecies = [DEFAULT_BIRD];
let currentHat = HAT.TOP_HAT;
let currentHat = DEFAULT_HAT;
// let visible = true;
let lastPetTimestamp = 0;
/** @type {StickyNote[]} */
@@ -2083,6 +2085,7 @@
userSettings = saveData.settings ?? {};
unlockedSpecies = saveData.unlockedSpecies ?? [DEFAULT_BIRD];
currentSpecies = saveData.currentSpecies ?? DEFAULT_BIRD;
currentHat = saveData.currentHat ?? DEFAULT_HAT;
stickyNotes = [];
if (saveData.stickyNotes) {
@@ -2095,13 +2098,15 @@
log(stickyNotes.length + " sticky notes loaded");
switchSpecies(currentSpecies);
switchHat(currentHat);
}
function save() {
/** @type {BirbSaveData} */
const saveData = {
unlockedSpecies,
currentSpecies,
unlockedSpecies: unlockedSpecies,
currentSpecies: currentSpecies,
currentHat: currentHat,
settings: userSettings
};

View File

@@ -54,6 +54,7 @@ import { HAT, HAT_METADATA } from './hats.js';
* @typedef {Object} BirbSaveData
* @property {string[]} unlockedSpecies
* @property {string} currentSpecies
* @property {string} currentHat
* @property {Partial<Settings>} settings
* @property {SavedStickyNote[]} [stickyNotes]
*/
@@ -87,6 +88,7 @@ const FEATHER_ID = "birb-feather";
const WARDROBE_ID = "birb-wardrobe";
const DEFAULT_BIRD = "bluebird";
const DEFAULT_HAT = HAT.NONE;
// Birb movement
const HOP_SPEED = 0.07;
@@ -239,7 +241,7 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
let petStack = [];
let currentSpecies = DEFAULT_BIRD;
let unlockedSpecies = [DEFAULT_BIRD];
let currentHat = HAT.TOP_HAT;
let currentHat = DEFAULT_HAT;
// let visible = true;
let lastPetTimestamp = 0;
/** @type {StickyNote[]} */
@@ -258,6 +260,7 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
userSettings = saveData.settings ?? {};
unlockedSpecies = saveData.unlockedSpecies ?? [DEFAULT_BIRD];
currentSpecies = saveData.currentSpecies ?? DEFAULT_BIRD;
currentHat = saveData.currentHat ?? DEFAULT_HAT;
stickyNotes = [];
if (saveData.stickyNotes) {
@@ -270,13 +273,15 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
log(stickyNotes.length + " sticky notes loaded");
switchSpecies(currentSpecies);
switchHat(currentHat);
}
function save() {
/** @type {BirbSaveData} */
const saveData = {
unlockedSpecies,
currentSpecies,
unlockedSpecies: unlockedSpecies,
currentSpecies: currentSpecies,
currentHat: currentHat,
settings: userSettings
};