1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Fix commented issues

This commit is contained in:
Jasper Meggitt 2020-05-24 17:47:11 -07:00
parent c3c59cc6fc
commit 6320372e73
3 changed files with 19 additions and 30 deletions

View File

@ -470,31 +470,13 @@ export class ShapeDefinition extends BasicSerializableObject {
*/ */
cloneAndUnstack() { cloneAndUnstack() {
const lowerLayers = this.internalCloneLayers(); const lowerLayers = this.internalCloneLayers();
const upperLayers = [];
if (this.isEntirelyEmpty()) { if (this.isEntirelyEmpty()) {
assert(false, "Can not stack entirely empty definition"); assert(false, "Can not stack entirely empty definition");
} }
// Check if there is only one layer upperLayers.push(lowerLayers.pop());
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;
}
}
}
return [ return [
new ShapeDefinition({ layers: lowerLayers }), new ShapeDefinition({ layers: lowerLayers }),

View File

@ -23,7 +23,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
// First of all, process the current recipe // First of all, process the current recipe
processorComp.secondsUntilEject = Math_max( processorComp.secondsUntilEject = Math_max(
0, 0,
processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds, processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds
); );
// Check if we have any finished items we can eject // 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( const stackedDefinition = this.root.shapeDefinitionMgr.shapeActionStack(
lowerItem.definition, lowerItem.definition,
upperItem.definition, upperItem.definition
); );
outItems.push({ outItems.push({
item: new ShapeItem(stackedDefinition), item: new ShapeItem(stackedDefinition),
@ -213,10 +213,13 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const unstackedDefinitions = this.root.shapeDefinitionMgr.shapeActionUnstack(item.definition); const unstackedDefinitions = this.root.shapeDefinitionMgr.shapeActionUnstack(item.definition);
for (let i = 0; i < unstackedDefinitions.length; ++i) { for (let i = 0; i < unstackedDefinitions.length; ++i) {
outItems.push({ const definition = unstackedDefinitions[i];
item: new ShapeItem(unstackedDefinitions[i]), if (!definition.isEntirelyEmpty()) {
requiredSlot: i, outItems.push({
}); item: new ShapeItem(definition),
requiredSlot: i,
});
}
} }
break; break;
} }
@ -261,7 +264,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const colorizedDefinition = this.root.shapeDefinitionMgr.shapeActionPaintWith( const colorizedDefinition = this.root.shapeDefinitionMgr.shapeActionPaintWith(
shapeItem.definition, shapeItem.definition,
colorItem.color, colorItem.color
); );
outItems.push({ outItems.push({
@ -284,12 +287,12 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const colorizedDefinition1 = this.root.shapeDefinitionMgr.shapeActionPaintWith( const colorizedDefinition1 = this.root.shapeDefinitionMgr.shapeActionPaintWith(
shapeItem1.definition, shapeItem1.definition,
colorItem.color, colorItem.color
); );
const colorizedDefinition2 = this.root.shapeDefinitionMgr.shapeActionPaintWith( const colorizedDefinition2 = this.root.shapeDefinitionMgr.shapeActionPaintWith(
shapeItem2.definition, shapeItem2.definition,
colorItem.color, colorItem.color
); );
outItems.push({ outItems.push({
item: new ShapeItem(colorizedDefinition1), item: new ShapeItem(colorizedDefinition1),
@ -319,7 +322,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const colorizedDefinition = this.root.shapeDefinitionMgr.shapeActionPaintWith4Colors( const colorizedDefinition = this.root.shapeDefinitionMgr.shapeActionPaintWith4Colors(
shapeItem.definition, shapeItem.definition,
[colorItem2.color, colorItem3.color, colorItem4.color, colorItem1.color], [colorItem2.color, colorItem3.color, colorItem4.color, colorItem1.color]
); );
outItems.push({ outItems.push({

View File

@ -434,6 +434,10 @@ storyRewards:
title: Storage Buffer title: Storage Buffer
desc: You have unlocked a variant of the <strong>trash</strong> - It allows to store items up to a given capacity! desc: You have unlocked a variant of the <strong>trash</strong> - It allows to store items up to a given capacity!
reward_unstacker:
title: Unstacker
desc: You can now unstack shapes with the <strong>unstacker</strong>! The top shape is taken off the input and comes out the right output.
reward_freeplay: reward_freeplay:
title: Freeplay title: Freeplay
desc: You did it! You unlocked the <strong>free-play mode</strong>! This means that shapes are now randomly generated! (No worries, more content is planned for the standalone!) desc: You did it! You unlocked the <strong>free-play mode</strong>! This means that shapes are now randomly generated! (No worries, more content is planned for the standalone!)