1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 10:11:50 +00:00

Fixed different resolutions

This commit is contained in:
DJ1TJOO 2022-02-01 17:17:38 +01:00
parent 3ad502c5a7
commit 2e5c6eed36

View File

@ -127,9 +127,16 @@ export class ModInterface {
for (const spriteName in sourceData) {
const { frame, sourceSize, spriteSourceSize } = sourceData[spriteName];
const sprite = new AtlasSprite(spriteName);
Loader.sprites.set(spriteName, sprite);
sprite.frozen = true;
let sprite = /** @type {AtlasSprite} */ (Loader.sprites.get(spriteName));
if (!sprite) {
sprite = new AtlasSprite(spriteName);
Loader.sprites.set(spriteName, sprite);
}
if (sprite.frozen) {
continue;
}
const link = new SpriteAtlasLink({
packedX: frame.x,
@ -142,9 +149,14 @@ export class ModInterface {
w: sourceSize.w,
h: sourceSize.h,
});
sprite.linksByResolution["0.25"] = link;
sprite.linksByResolution["0.5"] = link;
sprite.linksByResolution["0.75"] = link;
if (atlasData.meta && atlasData.meta.scale) {
sprite.linksByResolution[atlasData.meta.scale] = link;
} else {
sprite.linksByResolution["0.25"] = link;
sprite.linksByResolution["0.5"] = link;
sprite.linksByResolution["0.75"] = link;
}
}
}