|
|
|
@ -26,10 +26,8 @@ export class ItemEjectorComponent extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getSchema() {
|
|
|
|
|
// The cachedDestSlot, cachedTargetEntity fields
|
|
|
|
|
// are not serialized.
|
|
|
|
|
// The cachedDestSlot, cachedTargetEntity fields are not serialized.
|
|
|
|
|
return {
|
|
|
|
|
instantEject: types.bool,
|
|
|
|
|
slots: types.array(
|
|
|
|
|
types.structured({
|
|
|
|
|
pos: types.vector,
|
|
|
|
@ -57,7 +55,6 @@ export class ItemEjectorComponent extends Component {
|
|
|
|
|
|
|
|
|
|
return new ItemEjectorComponent({
|
|
|
|
|
slots: slotsCopy,
|
|
|
|
|
instantEject: this.instantEject,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -65,14 +62,10 @@ export class ItemEjectorComponent extends Component {
|
|
|
|
|
*
|
|
|
|
|
* @param {object} param0
|
|
|
|
|
* @param {Array<{pos: Vector, direction: enumDirection, layer?: enumLayer}>=} param0.slots The slots to eject on
|
|
|
|
|
* @param {boolean=} param0.instantEject If the ejection is instant
|
|
|
|
|
*/
|
|
|
|
|
constructor({ slots = [], instantEject = false }) {
|
|
|
|
|
constructor({ slots = [] }) {
|
|
|
|
|
super();
|
|
|
|
|
|
|
|
|
|
// How long items take to eject
|
|
|
|
|
this.instantEject = instantEject;
|
|
|
|
|
|
|
|
|
|
this.setSlots(slots);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -161,7 +154,7 @@ export class ItemEjectorComponent extends Component {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
this.slots[slotIndex].item = item;
|
|
|
|
|
this.slots[slotIndex].progress = this.instantEject ? 1 : 0;
|
|
|
|
|
this.slots[slotIndex].progress = 0;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|