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:
parent
d3542f826f
commit
55f968ea4a
@ -186,7 +186,7 @@ export class ItemAcceptorComponent extends Component {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
assertAlways(false, "Input requirement is not recognised: " + slot.filter);
|
assertAlways(false, "Input requirement is not recognised: " + this.inputRequirement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,25 +40,6 @@ export class StorageComponent extends Component {
|
|||||||
this.overlayOpacity = 0;
|
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 whether the storage is full
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
@ -106,6 +106,18 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
processorComp.currentCharge = null;
|
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)) {
|
if (!items.get(input.slotIndex)) {
|
||||||
items.set(input.slotIndex, input.item);
|
items.set(input.slotIndex, input.item);
|
||||||
extraProgress = Math.max(extraProgress, input.extraProgress);
|
extraProgress = Math.max(extraProgress, input.extraProgress);
|
||||||
inputs.splice(i, 1);
|
//inputs.splice(i, 1);
|
||||||
i--;
|
//i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user