mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
fixed the belt reader
This commit is contained in:
parent
057eb7ee0a
commit
ea375e92e3
@ -24,11 +24,15 @@ export class BeltReaderSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pinsComp.slots[1].value = readerComp.lastItem;
|
pinsComp.slots[1].value = readerComp.lastItem;
|
||||||
pinsComp.slots[0].value =
|
if( (readerComp.lastItemTimes[readerComp.lastItemTimes.length - 1] || 0) >
|
||||||
(readerComp.lastItemTimes[readerComp.lastItemTimes.length - 1] || 0) >
|
minimumTimeForThroughput) {
|
||||||
minimumTimeForThroughput
|
pinsComp.slots[0].value = BOOL_TRUE_SINGLETON;
|
||||||
? BOOL_TRUE_SINGLETON
|
} else {
|
||||||
: BOOL_FALSE_SINGLETON;
|
pinsComp.slots[0].value = BOOL_FALSE_SINGLETON;
|
||||||
|
if(entity.components.ItemEjector.canEjectOnSlot(0)) {
|
||||||
|
readerComp.lastItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (now - readerComp.lastThroughputComputation > 0.5) {
|
if (now - readerComp.lastThroughputComputation > 0.5) {
|
||||||
// Compute throughput
|
// Compute throughput
|
||||||
@ -46,10 +50,15 @@ export class BeltReaderSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
throughput = 1 / (averageSpacing / averageSpacingNum);
|
throughput = 1 / (averageSpacing / averageSpacingNum);
|
||||||
|
const decimal = throughput - Math.floor(throughput);
|
||||||
|
if(decimal > 0.8)
|
||||||
|
{
|
||||||
|
throughput = Math.round(throughput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readerComp.lastThroughput = Math.min(globalConfig.beltSpeedItemsPerSecond * 23.9, throughput);
|
readerComp.lastThroughput = Math.min(globalConfig.beltSpeedItemsPerSecond * 23.9, throughput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user