"use strict"; // Layer: persistence/schema // Owns stable save identifiers shared by snapshot_system.js and save_codec.js. // Current-format save identifiers only. (function (global) { const SNAPSHOT_VERSION = 18; const BINARY_SCHEMA_VERSION = 23; const FIELD_IDS = Object.freeze(["garden", "cage", "park"]); const GROUND_IDS = Object.freeze(["soil", "dirt", "concrete", "blanket", "foot_massage", "ice", "laboratory"]); const WEATHER_IDS = Object.freeze(["sunny", "cloudy", "light_rain"]); const MOOD_IDS = Object.freeze(["relaxed", "devastation", "crisis", "confusion", "fearful", "disease_spread", "weakened", "breeding", "happy", "overcrowded", "isolated"]); const STATE_IDS = Object.freeze(["idle", "sleep"]); const POWER_MODE_IDS = Object.freeze(["", "protein", "niteropu"]); const SIZE_MODE_IDS = Object.freeze(["", "giant_drug", "dwarf_drug"]); const LIFE_MODE_IDS = Object.freeze(["", "mercury"]); const PIN_STATE_IDS = Object.freeze(["loose", "lodged", "falling", "stuck"]); const STAGE_IDS = Object.freeze(["fresh", "aging", "old", "dry"]); const ITEM_TYPE_IDS = Object.freeze([ "grass", "zunchi", "water", "grass_bed", "plushie", "nest_box", "duplicator", "sweet", "love_mochi", "fight_mochi", "sleep_drug", "laxative", "protein", "niteropu", "ammo", "mystery_drug", "mercury", "giant_drug", "dwarf_drug", "zunda_juice", "stone", "ball", "signboard", "ant_nest", "ant_corpse", "firecracker", "pushpin", "oshibyo", "fence_v", "fence_h", "splat", "food", "bed", "genkotsu", "bounce_fence", "bounce_fence_v", "gate_fence", "rotator", "reciprocator", "rope", "rod", "poison_block", "robot_cleaner", "dry_ice", "stove", "glass_wall", "slave_chain", "golden_crown", "fire", "flame_firecracker" ]); function typeIds(names) { return Object.freeze(new Set((names || []).map(name => ITEM_TYPE_IDS.indexOf(name)).filter(id => id >= 0))); } const STRUCTURE_TYPE_IDS = typeIds(["grass_bed", "plushie"]); const SERVING_FOOD_TYPE_IDS = typeIds(["sweet", "love_mochi", "fight_mochi", "sleep_drug", "laxative", "protein", "niteropu", "mystery_drug", "mercury", "giant_drug", "dwarf_drug", "zunda_juice", "food"]); const PIN_TYPE_IDS = typeIds(["pushpin", "oshibyo"]); const JSON_EXTRA_ITEM_TYPE_IDS = typeIds(["rotator", "poison_block", "reciprocator", "rope", "rod"]); const ROTATABLE_ITEM_TYPE_IDS = typeIds(["fence_v", "fence_h", "glass_wall", "bounce_fence", "bounce_fence_v", "gate_fence", "rotator", "poison_block", "reciprocator"]); function enumIndex(list, value, fallback = 0) { const i = list.indexOf(String(value ?? "")); return i >= 0 ? i : fallback; } function canonicalMoodId(value = "relaxed") { const id = String(value || "relaxed"); return MOOD_IDS.includes(id) ? id : "relaxed"; } function enumValue(list, index, fallback = "") { const i = Number(index) | 0; return list[i] ?? fallback ?? list[0] ?? ""; } function moodValue(index, fallback = "relaxed") { const i = Number(index) | 0; return canonicalMoodId(MOOD_IDS[i] ?? fallback); } global.TarinaiSaveSchema = Object.freeze({ SNAPSHOT_VERSION, BINARY_SCHEMA_VERSION, FIELD_IDS, GROUND_IDS, WEATHER_IDS, MOOD_IDS, canonicalMoodId, moodValue, STATE_IDS, POWER_MODE_IDS, SIZE_MODE_IDS, LIFE_MODE_IDS, PIN_STATE_IDS, STAGE_IDS, ITEM_TYPE_IDS, STRUCTURE_TYPE_IDS, SERVING_FOOD_TYPE_IDS, PIN_TYPE_IDS, JSON_EXTRA_ITEM_TYPE_IDS, ROTATABLE_ITEM_TYPE_IDS, enumIndex, enumValue, }); })(typeof window !== "undefined" ? window : globalThis);