mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Fix handling of bonus time in item processor
Previously, the bonus time might not be applied to the next charge, but to the one after that, if it arrived before the first charge was done.
This commit is contained in:
parent
a9d7698700
commit
c1ded81f0e
@ -91,7 +91,8 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||
|
||||
// Process next charge
|
||||
if (currentCharge.remainingTime > 0.0) {
|
||||
currentCharge.remainingTime -= this.root.dynamicTickrate.deltaSeconds;
|
||||
currentCharge.remainingTime -= this.root.dynamicTickrate.deltaSeconds + processorComp.bonusTime;
|
||||
processorComp.bonusTime = 0;
|
||||
if (currentCharge.remainingTime > 0.0) {
|
||||
// This charge is not finished, so don't process the next one
|
||||
break;
|
||||
@ -302,15 +303,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;
|
||||
processorComp.ongoingCharges.push({
|
||||
items: outItems,
|
||||
remainingTime: timeToProcess,
|
||||
remainingTime: 1 / baseSpeed,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user