diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index 59a1d98e..4f4c052e 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -2,6 +2,7 @@ import { BaseHUDPart } from "../base_hud_part"; import { makeDiv, round3Digits, round2Digits } from "../../../core/utils"; import { Math_round } from "../../../core/builtins"; import { DynamicDomAttach } from "../dynamic_dom_attach"; +import { KEYMAPPINGS } from "../../key_action_mapper"; export class HUDDebugInfo extends BaseHUDPart { createElements(parent) { @@ -18,12 +19,17 @@ export class HUDDebugInfo extends BaseHUDPart { this.visible = false; this.domAttach = new DynamicDomAttach(this.root, this.element); - // this.root.keyMapper + this.root.keyMapper.getBinding(KEYMAPPINGS.ingame.toggleFPSInfo).add(() => this.toggle()); + } + + toggle() { + this.visible = !this.visible; + this.domAttach.update(this.visible); } update() { const now = this.root.time.realtimeNow(); - if (now - this.lastTick > 0.25) { + if (now - this.lastTick > 0.25 && this.visible) { this.lastTick = now; this.tickRateElement.innerText = "Tickrate: " + this.root.dynamicTickrate.currentTickRate; this.fpsElement.innerText = diff --git a/src/js/game/key_action_mapper.js b/src/js/game/key_action_mapper.js index eab0f408..40774933 100644 --- a/src/js/game/key_action_mapper.js +++ b/src/js/game/key_action_mapper.js @@ -31,7 +31,7 @@ export const KEYMAPPINGS = { menuOpenStats: { keyCode: key("G") }, toggleHud: { keyCode: 113 }, // F2 - toggleFPSInfo: { keyCode: 112 }, // F1 + toggleFPSInfo: { keyCode: 115 }, // F1 }, buildings: { diff --git a/src/js/game/systems/miner.js b/src/js/game/systems/miner.js index f42e46c9..4ecf1e2d 100644 --- a/src/js/game/systems/miner.js +++ b/src/js/game/systems/miner.js @@ -104,7 +104,7 @@ export class MinerSystem extends GameSystemWithFilter { if (entity && entity.components.Miner) { const staticComp = entity.components.StaticMapEntity; if (!staticComp.shouldBeDrawn(parameters)) { - return; + continue; } const lowerLayerItem = this.root.map.getLowerLayerContentXY( diff --git a/translations/base-en.yaml b/translations/base-en.yaml index d8e5373a..05de5157 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -388,6 +388,7 @@ keybindings: menuOpenStats: Statistics toggleHud: Toggle HUD + toggleFPSInfo: Toggle FPS and Debug Info belt: *belt splitter: *splitter underground_belt: *underground_belt