1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-13 19:39:20 +00:00

Statistics screen will now sort pinned shapes above non-pinned shapes

This commit is contained in:
David Burhans 2020-06-15 22:22:41 -05:00
parent 2d4a67aa11
commit f64ac04d9e

View File

@ -175,7 +175,15 @@ export class HUDStatistics extends BaseHUDPart {
}
}
entries.sort((a, b) => b[1] - a[1]);
// Reach into the Hud to get the object that tracks which parts are pinned
const { pinnedShapes } = this.root.hud.parts;
entries.sort((a, b) => {
// do a sort calculation based on if the shapes are pinned
const pinSort =
Number(pinnedShapes.isShapePinned(b[0])) - Number(pinnedShapes.isShapePinned(a[0]));
// if the pinning of shapes is not equal, sort on that, otherwise, sort on the rates
return pinSort !== 0 ? pinSort : b[1] - a[1];
});
let rendered = new Set();