1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

fix item acceptor rendering from map view

This commit is contained in:
EmeraldBlock 2021-06-04 20:10:24 -05:00
parent fc3b6eeb0c
commit ec02dcd07a
2 changed files with 31 additions and 0 deletions

View File

@ -307,6 +307,7 @@ export class HUDScreenshotExporter extends BaseHUDPart {
this.root.currentLayer = "regular";
this.root.hud.parts.wiresOverlay.currentAlpha = 0;
}
this.root.systemMgr.systems.itemAcceptor.updateForScreenshot();
// Render all relevant chunks
this.root.signals.gameFrameStarted.dispatch();

View File

@ -56,6 +56,36 @@ export class ItemAcceptorSystem extends GameSystemWithFilter {
}
}
updateForScreenshot() {
// Compute how much ticks we missed
const numTicks = this.accumulatedTicksWhileInMapOverview;
const progress =
this.root.dynamicTickrate.deltaSeconds *
2 *
this.root.hubGoals.getBeltBaseSpeed() *
globalConfig.itemSpacingOnBelts * // * 2 because its only a half tile
numTicks;
// Reset accumulated ticks
this.accumulatedTicksWhileInMapOverview = 0;
for (let i = 0; i < this.allEntities.length; ++i) {
const entity = this.allEntities[i];
const aceptorComp = entity.components.ItemAcceptor;
const animations = aceptorComp.itemConsumptionAnimations;
// Process item consumption animations to avoid items popping from the belts
for (let animIndex = 0; animIndex < animations.length; ++animIndex) {
const anim = animations[animIndex];
anim.animProgress += progress;
if (anim.animProgress > 1) {
fastArrayDelete(animations, animIndex);
animIndex -= 1;
}
}
}
}
/**
* @param {DrawParameters} parameters
* @param {MapChunkView} chunk