From 6320372e739da7edc82e537c88243a50d1b1cd82 Mon Sep 17 00:00:00 2001 From: Jasper Meggitt Date: Sun, 24 May 2020 17:47:11 -0700 Subject: [PATCH] Fix commented issues --- src/js/game/shape_definition.js | 22 ++-------------------- src/js/game/systems/item_processor.js | 23 +++++++++++++---------- translations/base-en.yaml | 4 ++++ 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/js/game/shape_definition.js b/src/js/game/shape_definition.js index 4473c182..9dc40042 100644 --- a/src/js/game/shape_definition.js +++ b/src/js/game/shape_definition.js @@ -470,31 +470,13 @@ export class ShapeDefinition extends BasicSerializableObject { */ cloneAndUnstack() { const lowerLayers = this.internalCloneLayers(); + const upperLayers = []; if (this.isEntirelyEmpty()) { assert(false, "Can not stack entirely empty definition"); } - // Check if there is only one layer - if (this.layers.length === 1) { - return [new ShapeDefinition({ layers: lowerLayers })]; - } - - let upperLayers = []; - - layerCheck: - for (let i = lowerLayers.length - 1; i >= 0; --i) { - const layerToCheck = lowerLayers[i]; - - for (let quadrantIndex = 0; quadrantIndex < 4; ++quadrantIndex) { - // Check for a layer with items on it to remove - if (layerToCheck[quadrantIndex]) { - upperLayers.push(layerToCheck); - lowerLayers[i] = [null, null, null, null]; - break layerCheck; - } - } - } + upperLayers.push(lowerLayers.pop()); return [ new ShapeDefinition({ layers: lowerLayers }), diff --git a/src/js/game/systems/item_processor.js b/src/js/game/systems/item_processor.js index be229dae..94d8a238 100644 --- a/src/js/game/systems/item_processor.js +++ b/src/js/game/systems/item_processor.js @@ -23,7 +23,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter { // First of all, process the current recipe processorComp.secondsUntilEject = Math_max( 0, - processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds, + processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds ); // Check if we have any finished items we can eject @@ -196,7 +196,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter { const stackedDefinition = this.root.shapeDefinitionMgr.shapeActionStack( lowerItem.definition, - upperItem.definition, + upperItem.definition ); outItems.push({ item: new ShapeItem(stackedDefinition), @@ -213,10 +213,13 @@ export class ItemProcessorSystem extends GameSystemWithFilter { const unstackedDefinitions = this.root.shapeDefinitionMgr.shapeActionUnstack(item.definition); for (let i = 0; i < unstackedDefinitions.length; ++i) { - outItems.push({ - item: new ShapeItem(unstackedDefinitions[i]), - requiredSlot: i, - }); + const definition = unstackedDefinitions[i]; + if (!definition.isEntirelyEmpty()) { + outItems.push({ + item: new ShapeItem(definition), + requiredSlot: i, + }); + } } break; } @@ -261,7 +264,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter { const colorizedDefinition = this.root.shapeDefinitionMgr.shapeActionPaintWith( shapeItem.definition, - colorItem.color, + colorItem.color ); outItems.push({ @@ -284,12 +287,12 @@ export class ItemProcessorSystem extends GameSystemWithFilter { const colorizedDefinition1 = this.root.shapeDefinitionMgr.shapeActionPaintWith( shapeItem1.definition, - colorItem.color, + colorItem.color ); const colorizedDefinition2 = this.root.shapeDefinitionMgr.shapeActionPaintWith( shapeItem2.definition, - colorItem.color, + colorItem.color ); outItems.push({ item: new ShapeItem(colorizedDefinition1), @@ -319,7 +322,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter { const colorizedDefinition = this.root.shapeDefinitionMgr.shapeActionPaintWith4Colors( shapeItem.definition, - [colorItem2.color, colorItem3.color, colorItem4.color, colorItem1.color], + [colorItem2.color, colorItem3.color, colorItem4.color, colorItem1.color] ); outItems.push({ diff --git a/translations/base-en.yaml b/translations/base-en.yaml index 2a822991..356c41b0 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -434,6 +434,10 @@ storyRewards: title: Storage Buffer desc: You have unlocked a variant of the trash - It allows to store items up to a given capacity! + reward_unstacker: + title: Unstacker + desc: You can now unstack shapes with the unstacker! The top shape is taken off the input and comes out the right output. + reward_freeplay: title: Freeplay desc: You did it! You unlocked the free-play mode! This means that shapes are now randomly generated! (No worries, more content is planned for the standalone!)