mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Fix items being stuck on belts
This commit is contained in:
parent
fa3d516913
commit
84417b60a5
@ -165,7 +165,17 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
this.ejectorSlot = this.ejectorComp.slots[0];
|
this.ejectorSlot = this.ejectorComp.slots[0];
|
||||||
|
|
||||||
for (let i = 0; i < this.entityPath.length; ++i) {
|
for (let i = 0; i < this.entityPath.length; ++i) {
|
||||||
this.entityPath[i].components.ItemEjector.enabled = i === this.entityPath.length - 1;
|
const ejectorComp = this.entityPath[i].components.ItemEjector;
|
||||||
|
const isLast = i === this.entityPath.length - 1;
|
||||||
|
ejectorComp.enabled = isLast;
|
||||||
|
|
||||||
|
// Clear all slots of non-end entities
|
||||||
|
if (!isLast) {
|
||||||
|
for (let k = 0; k < ejectorComp.slots.length; ++k) {
|
||||||
|
ejectorComp.slots[k].item = null;
|
||||||
|
ejectorComp.slots[k].progress = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,5 +25,21 @@ export class SavegameInterface_V1005 extends SavegameInterface_V1004 {
|
|||||||
|
|
||||||
// just reset belt paths for now
|
// just reset belt paths for now
|
||||||
dump.beltPaths = [];
|
dump.beltPaths = [];
|
||||||
|
|
||||||
|
const entities = dump.entities;
|
||||||
|
|
||||||
|
// clear ejector slots
|
||||||
|
for (let i = 0; i < entities.length; ++i) {
|
||||||
|
const entity = entities[i];
|
||||||
|
const itemEjector = entity.components.ItemEjector;
|
||||||
|
if (itemEjector) {
|
||||||
|
const slots = itemEjector.slots;
|
||||||
|
for (let k = 0; k < slots.length; ++k) {
|
||||||
|
const slot = slots[k];
|
||||||
|
slot.item = null;
|
||||||
|
slot.progress = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user