1
0
forked from noxious/server

Removed check that prevented overwriting existing spritesheets

This commit is contained in:
Dennis Postma 2024-12-22 23:33:25 +01:00
parent b520acc2db
commit ce90d6f7a9

View File

@ -83,21 +83,8 @@ export default class SpriteUpdateEvent {
include: { spriteActions: true } include: { spriteActions: true }
}) })
// Process only actions with changed sprites // Process sprites
const processedActions = await Promise.all(parsedActions.map(async (action) => { const processedActions = await Promise.all(parsedActions.map(async (action) => {
const existing = existingSprite?.spriteActions.find(sa => sa.action === action.action)
// If sprites array matches existing, return existing data
if (existing && JSON.stringify(existing.sprites) === JSON.stringify(action.sprites)) {
return {
...action,
frameWidth: existing.frameWidth,
frameHeight: existing.frameHeight,
buffersWithDimensions: [] // No need to process frames
}
}
// Otherwise process the new sprites
const spriteBuffers = await this.convertBase64ToBuffers(action.sprites) const spriteBuffers = await this.convertBase64ToBuffers(action.sprites)
const frameWidth = ISOMETRIC_CONFIG.tileWidth const frameWidth = ISOMETRIC_CONFIG.tileWidth
const frameHeight = await this.calculateOptimalHeight(spriteBuffers) const frameHeight = await this.calculateOptimalHeight(spriteBuffers)