mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-07 10:03:59 +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
|
// Production analytics
|
||||||
statisticsGraphDpi: 2.5,
|
statisticsGraphDpi: 2.5,
|
||||||
statisticsGraphSlices: 100,
|
statisticsGraphSlices: 100,
|
||||||
analyticsSliceDurationSeconds: 10,
|
analyticsSliceDurationSeconds: G_IS_DEV ? 1 : 10,
|
||||||
|
|
||||||
minimumTickRate: 25,
|
minimumTickRate: 25,
|
||||||
maximumTickRate: 500,
|
maximumTickRate: 500,
|
||||||
|
@ -126,8 +126,23 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
*/
|
*/
|
||||||
tryAcceptItem(item) {
|
tryAcceptItem(item) {
|
||||||
if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) {
|
if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) {
|
||||||
this.items.unshift([this.spacingToFirstItem, item]);
|
// So, since we already need one tick to accept this item we will add this directly.
|
||||||
this.spacingToFirstItem = 0;
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
import { gItemRegistry } from "../../core/global_registries";
|
||||||
|
import { types } from "../../savegame/serialization";
|
||||||
import { BaseItem } from "../base_item";
|
import { BaseItem } from "../base_item";
|
||||||
import { Component } from "../component";
|
import { Component } from "../component";
|
||||||
import { enumDirection, Vector } from "../../core/vector";
|
|
||||||
import { types } from "../../savegame/serialization";
|
|
||||||
import { gItemRegistry } from "../../core/global_registries";
|
|
||||||
|
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
export const enumItemProcessorTypes = {
|
export const enumItemProcessorTypes = {
|
||||||
@ -102,6 +101,12 @@ export class ItemProcessorComponent extends Component {
|
|||||||
* @param {number} sourceSlot
|
* @param {number} sourceSlot
|
||||||
*/
|
*/
|
||||||
tryTakeItem(item, 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
|
// Check that we only take one item per slot
|
||||||
for (let i = 0; i < this.inputSlots.length; ++i) {
|
for (let i = 0; i < this.inputSlots.length; ++i) {
|
||||||
const slot = this.inputSlots[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 { GameRoot } from "../../root";
|
||||||
import { ShapeDefinition } from "../../shape_definition";
|
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} */
|
/** @enum {string} */
|
||||||
export const enumDisplayMode = {
|
export const enumDisplayMode = {
|
||||||
@ -91,6 +91,11 @@ export class HUDShapeStatisticsHandle {
|
|||||||
"<shapes>",
|
"<shapes>",
|
||||||
formatBigNumber(rate)
|
formatBigNumber(rate)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (G_IS_DEV && globalConfig.debug.detailedStatistics) {
|
||||||
|
this.counter.innerText = "" + round2Digits(rate / 60) + " /s";
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user