From ca5218561fd4172349ea44387fd651d837aba25e Mon Sep 17 00:00:00 2001 From: DJ1TJOO Date: Sun, 28 Feb 2021 20:39:51 +0100 Subject: [PATCH] Added better support for hud parts --- src/js/game/hud/hud.js | 5 +++++ src/js/modloader/mod.js | 1 + 2 files changed, 6 insertions(+) diff --git a/src/js/game/hud/hud.js b/src/js/game/hud/hud.js index 714b697a..8e76029e 100644 --- a/src/js/game/hud/hud.js +++ b/src/js/game/hud/hud.js @@ -112,6 +112,11 @@ export class GameHUD { /* typehints:end */ }; + for (const partKey in shapezAPI.ingame.hudParts) { + if (!shapezAPI.ingame.hudParts.hasOwnProperty(partKey)) continue; + this.parts[partKey] = shapezAPI.ingame.hudParts[partKey]; + } + for (let i = 0; i < shapezAPI.ingame.layers.length; i++) { const layer = shapezAPI.ingame.layers[i]; if (shapezAPI.toolbars[layer]) diff --git a/src/js/modloader/mod.js b/src/js/modloader/mod.js index cd6f5b9d..ba86b8a6 100644 --- a/src/js/modloader/mod.js +++ b/src/js/modloader/mod.js @@ -869,6 +869,7 @@ export class ShapezAPI { this.ingame = { buildings: {}, components: {}, + hudParts: {}, //Must be array because of update order systems: [], items: {},