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

Adjust processor output intervals for equality

This commit is contained in:
isaisstillalive 2020-07-08 09:57:06 +09:00
parent 2ccf39f1bf
commit 21a9027add

View File

@ -20,10 +20,10 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const ejectorComp = entity.components.ItemEjector; const ejectorComp = entity.components.ItemEjector;
// First of all, process the current recipe // First of all, process the current recipe
processorComp.secondsUntilEject = Math.max( if (processorComp.secondsUntilEject > 0) {
0, processorComp.secondsUntilEject =
processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds;
); }
if (G_IS_DEV && globalConfig.debug.instantProcessors) { if (G_IS_DEV && globalConfig.debug.instantProcessors) {
processorComp.secondsUntilEject = 0; processorComp.secondsUntilEject = 0;
@ -31,7 +31,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
// Check if we have any finished items we can eject // Check if we have any finished items we can eject
if ( if (
processorComp.secondsUntilEject === 0 && // it was processed in time processorComp.secondsUntilEject <= 0 && // it was processed in time
processorComp.itemsToEject.length > 0 // we have some items left to eject processorComp.itemsToEject.length > 0 // we have some items left to eject
) { ) {
for (let itemIndex = 0; itemIndex < processorComp.itemsToEject.length; ++itemIndex) { for (let itemIndex = 0; itemIndex < processorComp.itemsToEject.length; ++itemIndex) {
@ -103,7 +103,9 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
} }
const baseSpeed = this.root.hubGoals.getProcessorBaseSpeed(processorComp.type); const baseSpeed = this.root.hubGoals.getProcessorBaseSpeed(processorComp.type);
processorComp.secondsUntilEject = 1 / baseSpeed; if (processorComp.secondsUntilEject <= 0) {
processorComp.secondsUntilEject += 1 / baseSpeed;
}
/** @type {Array<{item: BaseItem, requiredSlot?: number, preferredSlot?: number}>} */ /** @type {Array<{item: BaseItem, requiredSlot?: number, preferredSlot?: number}>} */
const outItems = []; const outItems = [];