Skip to content

Commit 720f7d7

Browse files
justjuanguiclaude
andcommitted
fix(export): Flip relic Y coordinate for correct import positioning
Export relic Y in bottom-up convention (like save files) so that import's Y-flip produces correct placement in the UI grid. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9eb1860 commit 720f7d7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lib/export/collectors.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,24 @@ export function collectRelics(api: RelicInventoryAPI): SerializableRelicInventor
149149
relics: [],
150150
};
151151

152+
// Get grid height for Y coordinate flipping
153+
// Export uses bottom-up Y (like save files), UI uses top-down
154+
const gridShape = api.getCurrentShape();
155+
const gridHeight = gridShape?.height || 6;
156+
152157
// Get unique relics (not duplicated across grid cells)
153158
const uniqueRelics = api.getUniqueRelics();
154159

155160
for (const relic of uniqueRelics) {
156161
const rarityValue = RARITY_MAP[relic.rarity] ?? 0;
157162

163+
// Flip Y coordinate to match save file convention (bottom-up)
164+
const flippedY = gridHeight - relic.position.y - relic.height;
165+
158166
const serializedRelic: SerializableRelic = {
159167
baseId: parseInt(relic.id.split("-")[1]) || 0, // Extract base ID from generated ID
160168
x: relic.position.x,
161-
y: relic.position.y,
169+
y: flippedY,
162170
tier: relic.tier,
163171
rank: relic.rank,
164172
rarity: rarityValue,

0 commit comments

Comments
 (0)