mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-18 22:09:20 +00:00
Works with regular layer
This commit is contained in:
parent
6f99d49435
commit
3d9f8c9b42
@ -15,20 +15,14 @@ export class ChainableSplitterSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
// Precompute effective belt speed
|
const beltSpeed = this.getBeltSpeed();
|
||||||
const effectiveBeltSpeed = this.root.hubGoals.getBeltBaseSpeed() * globalConfig.itemSpacingOnBelts;
|
|
||||||
let progressGrowth = (effectiveBeltSpeed / 0.5) * this.root.dynamicTickrate.deltaSeconds;
|
|
||||||
|
|
||||||
if (G_IS_DEV && globalConfig.debug.instantBelts) {
|
|
||||||
progressGrowth = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||||
const entity = this.allEntities[i];
|
const entity = this.allEntities[i];
|
||||||
const splitterComp = entity.components.ChainableSplitter;
|
const splitterComp = entity.components.ChainableSplitter;
|
||||||
|
|
||||||
// First, try to get rid of received item
|
// First, try to get rid of received item
|
||||||
this.tryEject(entity, progressGrowth);
|
this.tryEject(entity, beltSpeed);
|
||||||
|
|
||||||
const item = splitterComp.inputItem;
|
const item = splitterComp.inputItem;
|
||||||
if (item === null) {
|
if (item === null) {
|
||||||
@ -115,4 +109,19 @@ export class ChainableSplitterSystem extends GameSystemWithFilter {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @returns {number} */
|
||||||
|
getBeltSpeed() {
|
||||||
|
let progressGrowth = 2 * this.root.dynamicTickrate.deltaSeconds;
|
||||||
|
|
||||||
|
if (G_IS_DEV && globalConfig.debug.instantBelts) {
|
||||||
|
progressGrowth = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
progressGrowth *
|
||||||
|
this.root.hubGoals.getBeltBaseSpeed(enumLayer.regular) *
|
||||||
|
globalConfig.beltItemSpacingByLayer[enumLayer.regular]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user