diff --git a/src/js/game/components/item_processor.js b/src/js/game/components/item_processor.js index f7dddec1..fbe03391 100644 --- a/src/js/game/components/item_processor.js +++ b/src/js/game/components/item_processor.js @@ -34,7 +34,7 @@ export const enumItemProcessorRequirements = { * }} EjectorItemToEject */ /** @typedef {{ - * remainingTime: number, + * remainingProgress: number, * items: Array, * }} EjectorCharge */ @@ -103,12 +103,6 @@ export class ItemProcessorComponent extends Component { * @type {Array} */ this.ongoingCharges = []; - - /** - * How much processing time we have left from the last tick - * @type {number} - */ - this.bonusTime = 0; } /** diff --git a/src/js/game/hub_goals.js b/src/js/game/hub_goals.js index 4fe267d8..b013530d 100644 --- a/src/js/game/hub_goals.js +++ b/src/js/game/hub_goals.js @@ -560,7 +560,7 @@ export class HubGoals extends BasicSerializableObject { ); const progress = globalConfig.buildingRatios[processorType] - 1; - return progress / upgrade; + return progress + 0.5 / upgrade; } /** diff --git a/src/js/game/systems/item_ejector.js b/src/js/game/systems/item_ejector.js index 57d577b0..c735c7bd 100644 --- a/src/js/game/systems/item_ejector.js +++ b/src/js/game/systems/item_ejector.js @@ -327,7 +327,7 @@ export class ItemEjectorSystem extends GameSystemWithFilter { } // Limit the progress to the maximum available space on the next belt (also see #1000) - let progress = slot.progress; + let progress = Math.min(0.5, slot.progress); const nextBeltPath = slot.cachedBeltPath; if (nextBeltPath) { /* diff --git a/src/js/game/systems/item_processor.js b/src/js/game/systems/item_processor.js index 36c837fb..9b746e44 100644 --- a/src/js/game/systems/item_processor.js +++ b/src/js/game/systems/item_processor.js @@ -76,6 +76,11 @@ export class ItemProcessorSystem extends GameSystemWithFilter { } update() { + const progressGrowth = + this.root.dynamicTickrate.deltaSeconds * + globalConfig.beltSpeedItemsPerSecond * + globalConfig.itemSpacingOnBelts; + for (let i = 0; i < this.allEntities.length; ++i) { const entity = this.allEntities[i]; @@ -86,16 +91,12 @@ export class ItemProcessorSystem extends GameSystemWithFilter { if (currentCharge) { // Process next charge - if (currentCharge.remainingTime > 0.0) { - currentCharge.remainingTime -= this.root.dynamicTickrate.deltaSeconds; - if (currentCharge.remainingTime < 0.0) { - // Add bonus time, this is the time we spent too much - processorComp.bonusTime += -currentCharge.remainingTime; - } + if (currentCharge.remainingProgress > 0.0) { + currentCharge.remainingProgress -= progressGrowth; } // Check if it finished - if (currentCharge.remainingTime <= 0.0) { + if (currentCharge.remainingProgress <= 0.0) { const itemsToEject = currentCharge.items; // Go over all items and try to eject them @@ -286,16 +287,10 @@ export class ItemProcessorSystem extends GameSystemWithFilter { } // Queue Charge - const baseSpeed = this.root.hubGoals.getProcessorBaseSpeed(processorComp.type); - const originalTime = 1 / baseSpeed; - - const bonusTimeToApply = Math.min(originalTime, processorComp.bonusTime); - const timeToProcess = originalTime - bonusTimeToApply; - - processorComp.bonusTime -= bonusTimeToApply; + const progress = this.root.hubGoals.getProcessingProgress(processorComp.type); processorComp.ongoingCharges.push({ items: outItems, - remainingTime: timeToProcess, + remainingProgress: progress, // + Math.min(extra progress' of inputs) }); processorComp.inputSlots.clear();