mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
fixing serializer changes
This commit is contained in:
parent
5ee113f4dd
commit
6a19a94435
@ -9,7 +9,7 @@ export default {
|
|||||||
// noArtificialDelays: true,
|
// noArtificialDelays: true,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables writing of savegames, useful for testing the same savegame over and over
|
// Disables writing of savegames, useful for testing the same savegame over and over
|
||||||
// disableSavegameWrite: true,
|
disableSavegameWrite: true,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Shows bounds of all entities
|
// Shows bounds of all entities
|
||||||
// showEntityBounds: true,
|
// showEntityBounds: true,
|
||||||
@ -33,7 +33,7 @@ export default {
|
|||||||
// allBuildingsUnlocked: true,
|
// allBuildingsUnlocked: true,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables cost of blueprints
|
// Disables cost of blueprints
|
||||||
// blueprintsNoCost: true,
|
blueprintsNoCost: true,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables cost of upgrades
|
// Disables cost of upgrades
|
||||||
// upgradesNoCost: true,
|
// upgradesNoCost: true,
|
||||||
@ -75,7 +75,7 @@ export default {
|
|||||||
// instantMiners: true,
|
// instantMiners: true,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// When using fastGameEnter, controls whether a new game is started or the last one is resumed
|
// When using fastGameEnter, controls whether a new game is started or the last one is resumed
|
||||||
// resumeGameOnFastEnter: true,
|
resumeGameOnFastEnter: true,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Special option used to render the trailer
|
// Special option used to render the trailer
|
||||||
// renderForTrailer: true,
|
// renderForTrailer: true,
|
||||||
|
@ -417,7 +417,7 @@ export class GameCore {
|
|||||||
this.overlayAlpha = lerp(this.overlayAlpha, desiredOverlayAlpha, 0.25);
|
this.overlayAlpha = lerp(this.overlayAlpha, desiredOverlayAlpha, 0.25);
|
||||||
|
|
||||||
// On low performance, skip the fade
|
// On low performance, skip the fade
|
||||||
if (this.root.entityMgr.entities.length > 5000 || this.root.dynamicTickrate.averageFps < 50) {
|
if (this.root.entityMgr.entities.size > 5000 || this.root.dynamicTickrate.averageFps < 50) {
|
||||||
this.overlayAlpha = desiredOverlayAlpha;
|
this.overlayAlpha = desiredOverlayAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +253,15 @@ export class SavegameInterface_V1006 extends SavegameInterface_V1005 {
|
|||||||
newStaticComp.originalRotation = staticComp.originalRotation;
|
newStaticComp.originalRotation = staticComp.originalRotation;
|
||||||
newStaticComp.rotation = staticComp.rotation;
|
newStaticComp.rotation = staticComp.rotation;
|
||||||
|
|
||||||
// @ts-ignore
|
/**
|
||||||
|
* in one of our files:
|
||||||
|
* we dont seem to actually have a blueprintspritekey
|
||||||
|
* but we do have this attribute called code
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (staticComp.blueprintSpriteKey) {
|
||||||
newStaticComp.code = spriteMapping[staticComp.blueprintSpriteKey];
|
newStaticComp.code = spriteMapping[staticComp.blueprintSpriteKey];
|
||||||
|
} else newStaticComp.code = staticComp.code;
|
||||||
|
|
||||||
// Hub special case
|
// Hub special case
|
||||||
if (entity.components.Hub) {
|
if (entity.components.Hub) {
|
||||||
@ -277,9 +284,11 @@ export class SavegameInterface_V1006 extends SavegameInterface_V1005 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!newStaticComp.code) {
|
if (!newStaticComp.code) {
|
||||||
|
console.dir(entity);
|
||||||
|
console.dir(staticComp);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
"1006 Migration: Could not reconstruct code for " + staticComp.blueprintSpriteKey
|
"1006 Migration: Could not reconstruct code for " + code
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,12 +11,15 @@ const logger = createLogger("serializer_internal");
|
|||||||
export class SerializerInternal {
|
export class SerializerInternal {
|
||||||
/**
|
/**
|
||||||
* Serializes an array of entities
|
* Serializes an array of entities
|
||||||
* @param {Array<Entity>} array
|
* @param {Array<Entity>|Set<Entity>} array
|
||||||
*/
|
*/
|
||||||
serializeEntityArray(array) {
|
serializeEntityArray(array) {
|
||||||
const serialized = [];
|
const serialized = [];
|
||||||
for (let i = 0; i < array.length; ++i) {
|
|
||||||
const entity = array[i];
|
const arr = Array.isArray(array) ? array : [...array.values()];
|
||||||
|
|
||||||
|
for (let i = 0; i < arr.length; ++i) {
|
||||||
|
const entity = arr[i];
|
||||||
if (!entity.queuedForDestroy && !entity.destroyed) {
|
if (!entity.queuedForDestroy && !entity.destroyed) {
|
||||||
serialized.push(entity.serialize());
|
serialized.push(entity.serialize());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user