mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Fix multiple issues regarding saving / restoring games
This commit is contained in:
parent
0b9b35b79e
commit
34ef26b289
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:c35f217cbc3c687e3ee7c25a410ce953b38637e106b8ea348caeca55bfeac394
|
oid sha256:f2b3fec64e5d005a31c0a5876507c881b6b7f0e59d4f03bc97f594f33943b4ce
|
||||||
size 70555
|
size 70541
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@ -52,7 +52,8 @@ export class Blueprint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
averagePosition.divideScalarInplace(uids.length);
|
averagePosition.divideScalarInplace(uids.length);
|
||||||
const blueprintOrigin = averagePosition.floor();
|
const blueprintOrigin = averagePosition.subScalars(0.5, 0.5).floor();
|
||||||
|
|
||||||
for (let i = 0; i < uids.length; ++i) {
|
for (let i = 0; i < uids.length; ++i) {
|
||||||
newEntities[i].components.StaticMapEntity.origin.subInplace(blueprintOrigin);
|
newEntities[i].components.StaticMapEntity.origin.subInplace(blueprintOrigin);
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ export class MetaEnergyGenerator extends MetaBuilding {
|
|||||||
layer: enumLayer.wires,
|
layer: enumLayer.wires,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
instantEject: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ export class MetaEnergyGenerator extends MetaBuilding {
|
|||||||
new EnergyGeneratorComponent({
|
new EnergyGeneratorComponent({
|
||||||
// Set by the energy generator system later
|
// Set by the energy generator system later
|
||||||
requiredKey: null,
|
requiredKey: null,
|
||||||
acceptorSlotIndex: 2,
|
wasteAcceptorSlotIndex: 2,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -12,16 +12,27 @@ export class EnergyConsumerComponent extends Component {
|
|||||||
return {
|
return {
|
||||||
bufferSize: types.float,
|
bufferSize: types.float,
|
||||||
perCharge: types.float,
|
perCharge: types.float,
|
||||||
stored: types.float,
|
|
||||||
piledOutput: types.float,
|
|
||||||
batteryPosition: types.vector,
|
batteryPosition: types.vector,
|
||||||
energyType: types.enum(enumItemType),
|
energyType: types.enum(enumItemType),
|
||||||
wasteType: types.enum(enumItemType),
|
wasteType: types.enum(enumItemType),
|
||||||
acceptorSlotIndex: types.uint,
|
acceptorSlotIndex: types.uint,
|
||||||
ejectorSlotIndex: types.uint,
|
ejectorSlotIndex: types.uint,
|
||||||
|
|
||||||
|
stored: types.float,
|
||||||
|
piledOutput: types.float,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duplicateWithoutContents() {
|
||||||
|
return new EnergyConsumerComponent({
|
||||||
|
bufferSize: this.bufferSize,
|
||||||
|
perCharge: this.perCharge,
|
||||||
|
batteryPosition: this.batteryPosition.copy(),
|
||||||
|
acceptorSlotIndex: this.acceptorSlotIndex,
|
||||||
|
ejectorSlotIndex: this.ejectorSlotIndex,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {object} param0
|
* @param {object} param0
|
||||||
|
@ -3,7 +3,7 @@ import { BaseItem } from "../base_item";
|
|||||||
import { Component } from "../component";
|
import { Component } from "../component";
|
||||||
import { ShapeItem } from "../items/shape_item";
|
import { ShapeItem } from "../items/shape_item";
|
||||||
|
|
||||||
const maxQueueSize = 20;
|
const maxQueueSize = 4;
|
||||||
|
|
||||||
export class EnergyGeneratorComponent extends Component {
|
export class EnergyGeneratorComponent extends Component {
|
||||||
static getId() {
|
static getId() {
|
||||||
@ -14,16 +14,24 @@ export class EnergyGeneratorComponent extends Component {
|
|||||||
return {
|
return {
|
||||||
requiredKey: types.nullable(types.string),
|
requiredKey: types.nullable(types.string),
|
||||||
itemsInQueue: types.uint,
|
itemsInQueue: types.uint,
|
||||||
|
wasteAcceptorSlotIndex: types.uint,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duplicateWithoutContents() {
|
||||||
|
return new EnergyGeneratorComponent({
|
||||||
|
requiredKey: null,
|
||||||
|
wasteAcceptorSlotIndex: this.wasteAcceptorSlotIndex,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {object} param0
|
* @param {object} param0
|
||||||
* @param {string} param0.requiredKey Which shape this generator needs, can be null if not computed yet
|
* @param {string=} param0.requiredKey Which shape this generator needs, can be null if not computed yet
|
||||||
* @param {number} param0.acceptorSlotIndex
|
* @param {number} param0.wasteAcceptorSlotIndex Which slot accepts the waste
|
||||||
*/
|
*/
|
||||||
constructor({ requiredKey, acceptorSlotIndex = 0 }) {
|
constructor({ requiredKey, wasteAcceptorSlotIndex = 0 }) {
|
||||||
super();
|
super();
|
||||||
this.requiredKey = requiredKey;
|
this.requiredKey = requiredKey;
|
||||||
|
|
||||||
@ -37,7 +45,7 @@ export class EnergyGeneratorComponent extends Component {
|
|||||||
* Stores which slot accepts the waste
|
* Stores which slot accepts the waste
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.acceptorSlotIndex = acceptorSlotIndex;
|
this.wasteAcceptorSlotIndex = wasteAcceptorSlotIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,7 +54,7 @@ export class EnergyGeneratorComponent extends Component {
|
|||||||
* @param {number} slot
|
* @param {number} slot
|
||||||
*/
|
*/
|
||||||
tryTakeItem(item, slot) {
|
tryTakeItem(item, slot) {
|
||||||
if (slot === this.acceptorSlotIndex) {
|
if (slot === this.wasteAcceptorSlotIndex) {
|
||||||
// this is the acceptor slot on the wires layer
|
// this is the acceptor slot on the wires layer
|
||||||
// just destroy it
|
// just destroy it
|
||||||
return true;
|
return true;
|
||||||
|
@ -48,6 +48,20 @@ export class WiredPinsComponent extends Component {
|
|||||||
this.setSlots(slots);
|
this.setSlots(slots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duplicateWithoutContents() {
|
||||||
|
const slots = [];
|
||||||
|
for (let i = 0; i < this.slots.length; ++i) {
|
||||||
|
const slot = this.slots[i];
|
||||||
|
slots.push({
|
||||||
|
pos: slot.pos.copy(),
|
||||||
|
type: slot.type,
|
||||||
|
direction: slot.direction,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WiredPinsComponent({ slots });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the slots of this building
|
* Sets the slots of this building
|
||||||
* @param {Array<WirePinSlotDefinition>} slots
|
* @param {Array<WirePinSlotDefinition>} slots
|
||||||
|
@ -82,7 +82,7 @@ export class PlatformWrapperImplBrowser extends PlatformWrapperInterface {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
logger.log("Detecting storage");
|
logger.log("Detecting storage");
|
||||||
|
|
||||||
if (!window.indexedDB) {
|
if (!window.indexedDB || G_IS_DEV) {
|
||||||
logger.log("Indexed DB not supported");
|
logger.log("Indexed DB not supported");
|
||||||
this.app.storage = new StorageImplBrowser(this.app);
|
this.app.storage = new StorageImplBrowser(this.app);
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -26,10 +26,6 @@ export class SavegameSerializer {
|
|||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
generateDumpFromGameRoot(root, sanityChecks = true) {
|
generateDumpFromGameRoot(root, sanityChecks = true) {
|
||||||
// Finalize particles before saving (Like granting destroy indicator rewards)
|
|
||||||
// root.particleMgr.finalizeBeforeSave();
|
|
||||||
// root.uiParticleMgr.finalizeBeforeSave();
|
|
||||||
|
|
||||||
// Now store generic savegame payload
|
// Now store generic savegame payload
|
||||||
const data = {
|
const data = {
|
||||||
camera: root.camera.serialize(),
|
camera: root.camera.serialize(),
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
/* typehints:start */
|
|
||||||
import { GameRoot } from "../game/root";
|
|
||||||
/* typehints:end */
|
|
||||||
|
|
||||||
import { gComponentRegistry } from "../core/global_registries";
|
import { gComponentRegistry } from "../core/global_registries";
|
||||||
import { createLogger } from "../core/logging";
|
|
||||||
import { Entity } from "../game/entity";
|
import { Entity } from "../game/entity";
|
||||||
|
import { enumLayer, GameRoot } from "../game/root";
|
||||||
|
|
||||||
// Internal serializer methods
|
// Internal serializer methods
|
||||||
export class SerializerInternal {
|
export class SerializerInternal {
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes an array of entities
|
* Serializes an array of entities
|
||||||
* @param {Array<Entity>} array
|
* @param {Array<Entity>} array
|
||||||
@ -45,6 +39,11 @@ export class SerializerInternal {
|
|||||||
deserializeEntity(root, payload) {
|
deserializeEntity(root, payload) {
|
||||||
const entity = new Entity(root);
|
const entity = new Entity(root);
|
||||||
this.deserializeComponents(entity, payload.components);
|
this.deserializeComponents(entity, payload.components);
|
||||||
|
entity.layer = payload.layer;
|
||||||
|
|
||||||
|
if (!enumLayer[payload.layer]) {
|
||||||
|
assert(false, "Invalid layer: " + payload.layer);
|
||||||
|
}
|
||||||
|
|
||||||
root.entityMgr.registerEntity(entity, payload.uid);
|
root.entityMgr.registerEntity(entity, payload.uid);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
steamPage:
|
steamPage:
|
||||||
# This is the short text appearing on the steam page
|
# This is the short text appearing on the steam page
|
||||||
shortText: shapez.io is a game about building factories to automate the creation and combination of increasingly complex shapes within an infinite map.
|
shortText: shapez.io is a game about building factories to automate the creation and processing of increasingly complex shapes across an infinitely expanding map.
|
||||||
|
|
||||||
# This is the text shown above the discord link
|
# This is the text shown above the discord link
|
||||||
discordLink: Official Discord - Chat with me!
|
discordLink: Official Discord - Chat with me!
|
||||||
@ -33,36 +33,40 @@ steamPage:
|
|||||||
longText: >-
|
longText: >-
|
||||||
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
||||||
|
|
||||||
shapez.io is a game about building factories to automate the creation and combination of shapes. Deliver the increasingly complex shapes to progress within the game and unlock upgrades to speed up your factory.
|
shapez.io is a game about building factories to automate the creation and processing of increasingly complex shapes across an infinitely expanding map.
|
||||||
|
Upon delivering the requested shapes you will progress within the game and unlock upgrades to speed up your factory.
|
||||||
|
|
||||||
Since the demand rises, you will have to scale up your factory to fit the needs - Don't forget about resources though, you will have to expand in the [b]infinite map[/b]!
|
As the demand for shapes increases, you will have to scale up your factory to meet the demand - Don't forget about resources though, you will have to expand across the [b]infinite map[/b]!
|
||||||
|
|
||||||
Obviously shapes can get boring, so you need to mix colors and paint your shapes with it - Combine red, green and blue color resources to produce different colors and paint shapes with it to satisfy the demand.
|
Obviously shapes can get boring, so you need to mix colors and paint your shapes with it - Combine red, green and blue color resources to produce different colors and paint shapes with it to satisfy the demand.
|
||||||
|
|
||||||
This game features 18 levels (Which should keep you busy for hours already!) but I'm constantly adding new content - There is a lot planned!
|
This game features 18 progressive levels (Which should keep you busy for hours already!) but I'm constantly adding new content - There is a lot planned!
|
||||||
|
|
||||||
|
Purchasing the game gives you access to the standalone version which has additional features and you'll also receive access to newly developed features.
|
||||||
|
|
||||||
[img]{STEAM_APP_IMAGE}/extras/header_standalone_advantages.png[/img]
|
[img]{STEAM_APP_IMAGE}/extras/header_standalone_advantages.png[/img]
|
||||||
|
|
||||||
[list]
|
[list]
|
||||||
[*] Coming soon: Wires & Energy! Roughly end of July 2020.
|
|
||||||
[*] Coming soon: More Levels
|
|
||||||
[*] Dark Mode
|
[*] Dark Mode
|
||||||
[*] Unlimited Waypoints
|
[*] Unlimited Waypoints
|
||||||
[*] Unlimited Savegames
|
[*] Unlimited Savegames
|
||||||
[*] More settings
|
[*] Additional settings
|
||||||
[*] Allow me to further develop shapez.io ❤️
|
[*] Coming soon: Wires & Energy! Aiming for (roughly) end of July 2020.
|
||||||
|
[*] Coming soon: More Levels
|
||||||
|
[*] Allows me to further develop shapez.io ❤️
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
[img]{STEAM_APP_IMAGE}/extras/header_future_updates.png[/img]
|
[img]{STEAM_APP_IMAGE}/extras/header_future_updates.png[/img]
|
||||||
|
|
||||||
I am updating the game very often and try to push an update at least every week!
|
I am updating the game very often and trying to push an update at least every week!
|
||||||
|
|
||||||
[list]
|
[list]
|
||||||
[*] Different maps, and maybe map obstacles
|
[*] Different maps and challenges (e.g. maps with obstacles)
|
||||||
[*] Story mode where buildings cost shapes
|
[*] Puzzles (Deliver the requested shape with a restricted area / set of buildings)
|
||||||
[*] Configurable map creation (Edit number and size of patches, seed, and more)
|
[*] A story mode where buildings have a cost
|
||||||
[*] More types of shapes
|
[*] Configurable map generator (Configure resource/shape size/density, seed and more)
|
||||||
[*] More performance improvements (Although the game already runs pretty good!)
|
[*] Additional types of shapes
|
||||||
|
[*] Performance improvements (The game already runs pretty good!)
|
||||||
[*] And much more!
|
[*] And much more!
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user