mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-13 02:01:51 +00:00
test
This commit is contained in:
parent
3bd86aa6d0
commit
93daf53b0f
@ -34,7 +34,7 @@ export const enumItemProcessorRequirements = {
|
||||
* }} EjectorItemToEject */
|
||||
|
||||
/** @typedef {{
|
||||
* remainingTime: number,
|
||||
* remainingProgress: number,
|
||||
* items: Array<EjectorItemToEject>,
|
||||
* }} EjectorCharge */
|
||||
|
||||
@ -103,12 +103,6 @@ export class ItemProcessorComponent extends Component {
|
||||
* @type {Array<EjectorCharge>}
|
||||
*/
|
||||
this.ongoingCharges = [];
|
||||
|
||||
/**
|
||||
* How much processing time we have left from the last tick
|
||||
* @type {number}
|
||||
*/
|
||||
this.bonusTime = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -560,7 +560,7 @@ export class HubGoals extends BasicSerializableObject {
|
||||
);
|
||||
|
||||
const progress = globalConfig.buildingRatios[processorType] - 1;
|
||||
return progress / upgrade;
|
||||
return progress + 0.5 / upgrade;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -327,7 +327,7 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
||||
}
|
||||
|
||||
// Limit the progress to the maximum available space on the next belt (also see #1000)
|
||||
let progress = slot.progress;
|
||||
let progress = Math.min(0.5, slot.progress);
|
||||
const nextBeltPath = slot.cachedBeltPath;
|
||||
if (nextBeltPath) {
|
||||
/*
|
||||
|
||||
@ -76,6 +76,11 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||
}
|
||||
|
||||
update() {
|
||||
const progressGrowth =
|
||||
this.root.dynamicTickrate.deltaSeconds *
|
||||
globalConfig.beltSpeedItemsPerSecond *
|
||||
globalConfig.itemSpacingOnBelts;
|
||||
|
||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||
const entity = this.allEntities[i];
|
||||
|
||||
@ -86,16 +91,12 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||
|
||||
if (currentCharge) {
|
||||
// Process next charge
|
||||
if (currentCharge.remainingTime > 0.0) {
|
||||
currentCharge.remainingTime -= this.root.dynamicTickrate.deltaSeconds;
|
||||
if (currentCharge.remainingTime < 0.0) {
|
||||
// Add bonus time, this is the time we spent too much
|
||||
processorComp.bonusTime += -currentCharge.remainingTime;
|
||||
}
|
||||
if (currentCharge.remainingProgress > 0.0) {
|
||||
currentCharge.remainingProgress -= progressGrowth;
|
||||
}
|
||||
|
||||
// Check if it finished
|
||||
if (currentCharge.remainingTime <= 0.0) {
|
||||
if (currentCharge.remainingProgress <= 0.0) {
|
||||
const itemsToEject = currentCharge.items;
|
||||
|
||||
// Go over all items and try to eject them
|
||||
@ -286,16 +287,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;
|
||||
const progress = this.root.hubGoals.getProcessingProgress(processorComp.type);
|
||||
processorComp.ongoingCharges.push({
|
||||
items: outItems,
|
||||
remainingTime: timeToProcess,
|
||||
remainingProgress: progress, // + Math.min(extra progress' of inputs)
|
||||
});
|
||||
|
||||
processorComp.inputSlots.clear();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user