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,
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Disables writing of savegames, useful for testing the same savegame over and over
|
||||
// disableSavegameWrite: true,
|
||||
disableSavegameWrite: true,
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Shows bounds of all entities
|
||||
// showEntityBounds: true,
|
||||
@ -33,7 +33,7 @@ export default {
|
||||
// allBuildingsUnlocked: true,
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Disables cost of blueprints
|
||||
// blueprintsNoCost: true,
|
||||
blueprintsNoCost: true,
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Disables cost of upgrades
|
||||
// upgradesNoCost: true,
|
||||
@ -75,7 +75,7 @@ export default {
|
||||
// instantMiners: true,
|
||||
// -----------------------------------------------------------------------------------
|
||||
// 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
|
||||
// renderForTrailer: true,
|
||||
|
@ -417,7 +417,7 @@ export class GameCore {
|
||||
this.overlayAlpha = lerp(this.overlayAlpha, desiredOverlayAlpha, 0.25);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,15 @@ export class SavegameInterface_V1006 extends SavegameInterface_V1005 {
|
||||
newStaticComp.originalRotation = staticComp.originalRotation;
|
||||
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];
|
||||
} else newStaticComp.code = staticComp.code;
|
||||
|
||||
// Hub special case
|
||||
if (entity.components.Hub) {
|
||||
@ -277,9 +284,11 @@ export class SavegameInterface_V1006 extends SavegameInterface_V1005 {
|
||||
}
|
||||
|
||||
if (!newStaticComp.code) {
|
||||
console.dir(entity);
|
||||
console.dir(staticComp);
|
||||
throw new Error(
|
||||
// @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 {
|
||||
/**
|
||||
* Serializes an array of entities
|
||||
* @param {Array<Entity>} array
|
||||
* @param {Array<Entity>|Set<Entity>} array
|
||||
*/
|
||||
serializeEntityArray(array) {
|
||||
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) {
|
||||
serialized.push(entity.serialize());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user