1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Update item_processor.jsFix for delays in processor charge time, pervents processing delays when having more outputted items then ejectors (double painter) and delays in update ticks

This commit is contained in:
generalcrazy 2020-10-14 19:30:42 -04:00
parent 0146aa91bb
commit 60a304816b

View File

@ -76,16 +76,23 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const currentCharge = processorComp.ongoingCharges[0];
if (currentCharge) {
// Process next charge
if (currentCharge.remainingTime > 0.0) {
currentCharge.remainingTime -= this.root.dynamicTickrate.deltaSeconds;
if (currentCharge.remainingTime < 0.0) {
// Select active charge, prevent process delayd caused when having more outputted items then ejectors (double painter)
for (let j = 0; j < processorComp.ongoingCharges.length; ++j) {
const charge = processorComp.ongoingCharges[j];
if (charge && charge.remainingTime > 0.0) {
// Remove bonus time from charge
charge.remainingTime -= this.root.dynamicTickrate.deltaSeconds + processorComp.bonusTime;
// Reset bonus time
processorComp.bonusTime = 0;
if (charge.remainingTime < 0.0) {
// Add bonus time, this is the time we spent too much
processorComp.bonusTime += -currentCharge.remainingTime;
processorComp.bonusTime += -charge.remainingTime;
}
break;
}
}
if (currentCharge) {
// Check if it finished
if (currentCharge.remainingTime <= 0.0) {
const itemsToEject = currentCharge.items;