diff --git a/src/js/game/buildings/storage.js b/src/js/game/buildings/storage.js index 78f398be..df9f95f4 100644 --- a/src/js/game/buildings/storage.js +++ b/src/js/game/buildings/storage.js @@ -81,6 +81,7 @@ export class MetaStorageBuilding extends MetaBuilding { direction: enumDirection.bottom, }, ], + lengthMultiplier: 3, // make progress 1.5 to reach the ejector }) ); diff --git a/src/js/game/components/item_acceptor.js b/src/js/game/components/item_acceptor.js index c5fcdd9f..5c989521 100644 --- a/src/js/game/components/item_acceptor.js +++ b/src/js/game/components/item_acceptor.js @@ -44,14 +44,6 @@ import { GameRoot } from "../root"; * }} InputCompletedArgs */ -/** @enum {string} */ -const enumItemAcceptorTypes = { - hub: "hub", - storage: "storage", - trash: "trash", - undergroundBelt: "undergroundBelt", -}; - export class ItemAcceptorComponent extends Component { static getId() { return "ItemAcceptor"; @@ -61,9 +53,9 @@ export class ItemAcceptorComponent extends Component { * * @param {object} param0 * @param {Array} param0.slots The slots from which we accept items - * @param {enumItemAcceptorTypes=} param0.type Function that gets called when the input of an item is completed + * @param {number=} param0.lengthMultiplier Whether the acceptor is double the usual length */ - constructor({ slots = [] }) { + constructor({ slots = [], lengthMultiplier = 1 }) { super(); /** @type {ItemAcceptorInputs} */ @@ -71,6 +63,7 @@ export class ItemAcceptorComponent extends Component { /** @type {ItemAcceptorCompletedInputs} */ this.completedInputs = new Map(); // @SENSETODO does this need to be saved? this.setSlots(slots); + this.progressLength = 0.5 * lengthMultiplier; } /** @@ -110,7 +103,7 @@ export class ItemAcceptorComponent extends Component { this.inputs.set(slotIndex, { item, direction, - animProgress: Math.min(1, startProgress), + animProgress: Math.min(this.progressLength, startProgress), }); return true; } diff --git a/src/js/game/systems/item_acceptor.js b/src/js/game/systems/item_acceptor.js index c150c4f2..24b8b603 100644 --- a/src/js/game/systems/item_acceptor.js +++ b/src/js/game/systems/item_acceptor.js @@ -18,13 +18,12 @@ export class ItemAcceptorSystem extends GameSystemWithFilter { this.root.dynamicTickrate.deltaSeconds * this.root.hubGoals.getBeltBaseSpeed() * globalConfig.itemSpacingOnBelts; - // it's only half a belt - const maxProgress = 0.5; for (let i = 0; i < this.allEntities.length; ++i) { const entity = this.allEntities[i]; const acceptorComp = entity.components.ItemAcceptor; const inputs = acceptorComp.inputs; + const maxProgress = acceptorComp.progressLength; inputs.forEach((values, index) => { values.animProgress += progressGrowth; diff --git a/src/js/game/systems/item_processor.js b/src/js/game/systems/item_processor.js index f5beb37a..ab7eeba9 100644 --- a/src/js/game/systems/item_processor.js +++ b/src/js/game/systems/item_processor.js @@ -205,8 +205,13 @@ export class ItemProcessorSystem extends GameSystemWithFilter { case enumItemProcessorRequirements.painterQuad: { const pinsComp = entity.components.WiredPins; + const input = acceptorComp.inputs.get(0); + if (!input) { + return false; + } + // First slot is the shape, so if it's not there we can't do anything - const shapeItem = /** @type {ShapeItem} */ (acceptorComp.inputs.get(0).item); + const shapeItem = /** @type {ShapeItem} */ (input.item); if (!shapeItem) { return false; }