mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Display storage throughput even if the contents are empty
This commit is contained in:
parent
a550adc14a
commit
dafa943a18
@ -69,19 +69,31 @@ export class StorageSystem extends GameSystemWithFilter {
|
|||||||
const storageComp = entity.components.Storage;
|
const storageComp = entity.components.Storage;
|
||||||
|
|
||||||
const storedItem = storageComp.storedItem;
|
const storedItem = storageComp.storedItem;
|
||||||
|
const center = staticComp.getTileSpaceBounds().getCenter().toWorldSpace();
|
||||||
|
|
||||||
if (storedItem !== null) {
|
if (storedItem !== null) {
|
||||||
context.globalAlpha = storageComp.overlayOpacity;
|
context.globalAlpha = storageComp.overlayOpacity;
|
||||||
const center = staticComp.getTileSpaceBounds().getCenter().toWorldSpace();
|
|
||||||
storedItem.draw(center.x, center.y, parameters, 30);
|
storedItem.draw(center.x, center.y, parameters, 30);
|
||||||
|
}
|
||||||
|
|
||||||
this.storageOverlaySprite.drawCached(parameters, center.x - 15, center.y + 15, 30, 15);
|
switch (storageComp.displayType) {
|
||||||
|
case enumStorageDisplayType.count:
|
||||||
|
if (storedItem !== null) {
|
||||||
|
this.storageOverlaySprite.drawCached(parameters, center.x - 15, center.y + 15, 30, 15);
|
||||||
|
|
||||||
|
context.font = "bold 10px GameFont";
|
||||||
|
context.textAlign = "center";
|
||||||
|
context.fillStyle = "#64666e";
|
||||||
|
context.fillText(formatBigNumber(storageComp.storedCount), center.x, center.y + 25.5);
|
||||||
|
context.textAlign = "left";
|
||||||
|
context.globalAlpha = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case enumStorageDisplayType.rate:
|
||||||
|
context.globalAlpha = 1;
|
||||||
|
this.storageOverlaySprite.drawCached(parameters, center.x - 15, center.y + 15, 30, 15);
|
||||||
|
|
||||||
if (storageComp.displayType === enumStorageDisplayType.count) {
|
|
||||||
context.font = "bold 10px GameFont";
|
|
||||||
context.textAlign = "center";
|
|
||||||
context.fillStyle = "#64666e";
|
|
||||||
context.fillText(formatBigNumber(storageComp.storedCount), center.x, center.y + 25.5);
|
|
||||||
} else if (storageComp.displayType === enumStorageDisplayType.rate) {
|
|
||||||
let rate =
|
let rate =
|
||||||
(this.root.productionAnalytics.getCurrentShapeRate(
|
(this.root.productionAnalytics.getCurrentShapeRate(
|
||||||
enumAnalyticsDataSource.deliveredToStorage,
|
enumAnalyticsDataSource.deliveredToStorage,
|
||||||
@ -93,10 +105,9 @@ export class StorageSystem extends GameSystemWithFilter {
|
|||||||
context.textAlign = "center";
|
context.textAlign = "center";
|
||||||
context.fillStyle = "#64666e";
|
context.fillStyle = "#64666e";
|
||||||
context.fillText("" + formatBigNumber(rate) + " /s", center.x, center.y + 24.5);
|
context.fillText("" + formatBigNumber(rate) + " /s", center.x, center.y + 24.5);
|
||||||
}
|
context.textAlign = "left";
|
||||||
|
context.globalAlpha = 1;
|
||||||
context.textAlign = "left";
|
break;
|
||||||
context.globalAlpha = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user