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

Cleanup and processing improvement

This commit is contained in:
Sense101 2022-02-20 13:38:08 +00:00
parent d3542f826f
commit 55f968ea4a
3 changed files with 15 additions and 22 deletions

View File

@ -186,7 +186,7 @@ export class ItemAcceptorComponent extends Component {
return true;
}
default: {
assertAlways(false, "Input requirement is not recognised: " + slot.filter);
assertAlways(false, "Input requirement is not recognised: " + this.inputRequirement);
break;
}
}

View File

@ -40,25 +40,6 @@ export class StorageComponent extends Component {
this.overlayOpacity = 0;
}
/**
* Returns whether this storage can accept the item
* @param {BaseItem} item
*/
tryAcceptItem(item) {
if (this.storedCount >= this.maximumStorage) {
return false;
}
const itemType = item.getItemType();
if (this.storedCount > 0 && this.storedItem && itemType !== this.storedItem.getItemType()) {
return false;
}
this.storedItem = item;
this.storedCount++;
return true;
}
/**
* Returns whether the storage is full
* @returns {boolean}

View File

@ -106,6 +106,18 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
}
processorComp.currentCharge = null;
// now that the charge is complete, empty the inputs now
let usedSlots = [];
const acceptorComp = entity.components.ItemAcceptor;
for (let i = 0; i < acceptorComp.completedInputs.length; i++) {
const index = acceptorComp.completedInputs[i].slotIndex;
if (!usedSlots.includes(index)) {
usedSlots.push(index);
acceptorComp.completedInputs.splice(i, 1);
i--;
}
}
}
}
@ -256,8 +268,8 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
if (!items.get(input.slotIndex)) {
items.set(input.slotIndex, input.item);
extraProgress = Math.max(extraProgress, input.extraProgress);
inputs.splice(i, 1);
i--;
//inputs.splice(i, 1);
//i--;
}
}