mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	Minor fixes to the throughput
This commit is contained in:
		
							parent
							
								
									84417b60a5
								
							
						
					
					
						commit
						de0b305276
					
				@ -38,7 +38,7 @@ export const globalConfig = {
 | 
			
		||||
    // Production analytics
 | 
			
		||||
    statisticsGraphDpi: 2.5,
 | 
			
		||||
    statisticsGraphSlices: 100,
 | 
			
		||||
    analyticsSliceDurationSeconds: 10,
 | 
			
		||||
    analyticsSliceDurationSeconds: G_IS_DEV ? 1 : 10,
 | 
			
		||||
 | 
			
		||||
    minimumTickRate: 25,
 | 
			
		||||
    maximumTickRate: 500,
 | 
			
		||||
 | 
			
		||||
@ -126,8 +126,23 @@ export class BeltPath extends BasicSerializableObject {
 | 
			
		||||
     */
 | 
			
		||||
    tryAcceptItem(item) {
 | 
			
		||||
        if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) {
 | 
			
		||||
            this.items.unshift([this.spacingToFirstItem, item]);
 | 
			
		||||
            this.spacingToFirstItem = 0;
 | 
			
		||||
            // So, since we already need one tick to accept this item we will add this directly.
 | 
			
		||||
            const beltProgressPerTick =
 | 
			
		||||
                this.root.hubGoals.getBeltBaseSpeed() *
 | 
			
		||||
                this.root.dynamicTickrate.deltaSeconds *
 | 
			
		||||
                globalConfig.itemSpacingOnBelts;
 | 
			
		||||
 | 
			
		||||
            // First, compute how much progress we can make *at max*
 | 
			
		||||
            const maxProgress = Math.max(0, this.spacingToFirstItem - globalConfig.itemSpacingOnBelts);
 | 
			
		||||
            const initialProgress = Math.min(maxProgress, beltProgressPerTick);
 | 
			
		||||
 | 
			
		||||
            this.items.unshift([this.spacingToFirstItem - initialProgress, item]);
 | 
			
		||||
            this.spacingToFirstItem = initialProgress;
 | 
			
		||||
 | 
			
		||||
            if (G_IS_DEV && globalConfig.debug.checkBeltPaths) {
 | 
			
		||||
                this.debug_checkIntegrity("accept-item");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,7 @@
 | 
			
		||||
import { gItemRegistry } from "../../core/global_registries";
 | 
			
		||||
import { types } from "../../savegame/serialization";
 | 
			
		||||
import { BaseItem } from "../base_item";
 | 
			
		||||
import { Component } from "../component";
 | 
			
		||||
import { enumDirection, Vector } from "../../core/vector";
 | 
			
		||||
import { types } from "../../savegame/serialization";
 | 
			
		||||
import { gItemRegistry } from "../../core/global_registries";
 | 
			
		||||
 | 
			
		||||
/** @enum {string} */
 | 
			
		||||
export const enumItemProcessorTypes = {
 | 
			
		||||
@ -102,6 +101,12 @@ export class ItemProcessorComponent extends Component {
 | 
			
		||||
     * @param {number} sourceSlot
 | 
			
		||||
     */
 | 
			
		||||
    tryTakeItem(item, sourceSlot) {
 | 
			
		||||
        if (this.type === enumItemProcessorTypes.hub || this.type === enumItemProcessorTypes.trash) {
 | 
			
		||||
            // Hub has special logic .. not really nice but efficient.
 | 
			
		||||
            this.inputSlots.push({ item, sourceSlot });
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Check that we only take one item per slot
 | 
			
		||||
        for (let i = 0; i < this.inputSlots.length; ++i) {
 | 
			
		||||
            const slot = this.inputSlots[i];
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,10 @@
 | 
			
		||||
import { makeOffscreenBuffer } from "../../../core/buffer_utils";
 | 
			
		||||
import { globalConfig } from "../../../core/config";
 | 
			
		||||
import { clamp, formatBigNumber, round2Digits } from "../../../core/utils";
 | 
			
		||||
import { T } from "../../../translations";
 | 
			
		||||
import { enumAnalyticsDataSource } from "../../production_analytics";
 | 
			
		||||
import { GameRoot } from "../../root";
 | 
			
		||||
import { ShapeDefinition } from "../../shape_definition";
 | 
			
		||||
import { enumAnalyticsDataSource } from "../../production_analytics";
 | 
			
		||||
import { formatBigNumber, clamp } from "../../../core/utils";
 | 
			
		||||
import { globalConfig } from "../../../core/config";
 | 
			
		||||
import { makeOffscreenBuffer } from "../../../core/buffer_utils";
 | 
			
		||||
import { T } from "../../../translations";
 | 
			
		||||
 | 
			
		||||
/** @enum {string} */
 | 
			
		||||
export const enumDisplayMode = {
 | 
			
		||||
@ -91,6 +91,11 @@ export class HUDShapeStatisticsHandle {
 | 
			
		||||
                    "<shapes>",
 | 
			
		||||
                    formatBigNumber(rate)
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                if (G_IS_DEV && globalConfig.debug.detailedStatistics) {
 | 
			
		||||
                    this.counter.innerText = "" + round2Digits(rate / 60) + " /s";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user