1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-12 02:49:20 +00:00

added special logic for cutters so they remove overlays of empty outputs, and added clearing overlays on clear items

This commit is contained in:
Sense101 2021-08-11 14:29:47 +01:00
parent 6ba12f094f
commit 07c703f7d6
2 changed files with 21 additions and 10 deletions

View File

@ -52,6 +52,7 @@ export class ItemEjectorComponent extends Component {
clear() { clear() {
for (const slot of this.slots) { for (const slot of this.slots) {
slot.item = null; slot.item = null;
slot.lastItem = null;
slot.progress = 0; slot.progress = 0;
} }
} }

View File

@ -334,14 +334,19 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const cutDefinitions = this.root.shapeDefinitionMgr.shapeActionCutHalf(inputDefinition); const cutDefinitions = this.root.shapeDefinitionMgr.shapeActionCutHalf(inputDefinition);
const ejectorComp = payload.entity.components.ItemEjector;
for (let i = 0; i < cutDefinitions.length; ++i) { for (let i = 0; i < cutDefinitions.length; ++i) {
const definition = cutDefinitions[i]; const definition = cutDefinitions[i];
if (!definition.isEntirelyEmpty()) {
payload.outItems.push({ if (definition.isEntirelyEmpty()) {
item: this.root.shapeDefinitionMgr.getShapeItemFromDefinition(definition), ejectorComp.slots[i].lastItem = null;
requiredSlot: i, continue;
});
} }
payload.outItems.push({
item: this.root.shapeDefinitionMgr.getShapeItemFromDefinition(definition),
requiredSlot: i,
});
} }
} }
@ -355,14 +360,19 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const cutDefinitions = this.root.shapeDefinitionMgr.shapeActionCutQuad(inputDefinition); const cutDefinitions = this.root.shapeDefinitionMgr.shapeActionCutQuad(inputDefinition);
const ejectorComp = payload.entity.components.ItemEjector;
for (let i = 0; i < cutDefinitions.length; ++i) { for (let i = 0; i < cutDefinitions.length; ++i) {
const definition = cutDefinitions[i]; const definition = cutDefinitions[i];
if (!definition.isEntirelyEmpty()) {
payload.outItems.push({ if (definition.isEntirelyEmpty()) {
item: this.root.shapeDefinitionMgr.getShapeItemFromDefinition(definition), ejectorComp.slots[i].lastItem = null;
requiredSlot: i, continue;
});
} }
payload.outItems.push({
item: this.root.shapeDefinitionMgr.getShapeItemFromDefinition(definition),
requiredSlot: i,
});
} }
} }