mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Allow toggling debug info and fix miners sometimes being incorrectly culled
This commit is contained in:
parent
8760026893
commit
c6228f8d32
@ -2,6 +2,7 @@ import { BaseHUDPart } from "../base_hud_part";
|
|||||||
import { makeDiv, round3Digits, round2Digits } from "../../../core/utils";
|
import { makeDiv, round3Digits, round2Digits } from "../../../core/utils";
|
||||||
import { Math_round } from "../../../core/builtins";
|
import { Math_round } from "../../../core/builtins";
|
||||||
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
||||||
|
import { KEYMAPPINGS } from "../../key_action_mapper";
|
||||||
|
|
||||||
export class HUDDebugInfo extends BaseHUDPart {
|
export class HUDDebugInfo extends BaseHUDPart {
|
||||||
createElements(parent) {
|
createElements(parent) {
|
||||||
@ -18,12 +19,17 @@ export class HUDDebugInfo extends BaseHUDPart {
|
|||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.domAttach = new DynamicDomAttach(this.root, this.element);
|
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() {
|
update() {
|
||||||
const now = this.root.time.realtimeNow();
|
const now = this.root.time.realtimeNow();
|
||||||
if (now - this.lastTick > 0.25) {
|
if (now - this.lastTick > 0.25 && this.visible) {
|
||||||
this.lastTick = now;
|
this.lastTick = now;
|
||||||
this.tickRateElement.innerText = "Tickrate: " + this.root.dynamicTickrate.currentTickRate;
|
this.tickRateElement.innerText = "Tickrate: " + this.root.dynamicTickrate.currentTickRate;
|
||||||
this.fpsElement.innerText =
|
this.fpsElement.innerText =
|
||||||
|
@ -31,7 +31,7 @@ export const KEYMAPPINGS = {
|
|||||||
menuOpenStats: { keyCode: key("G") },
|
menuOpenStats: { keyCode: key("G") },
|
||||||
|
|
||||||
toggleHud: { keyCode: 113 }, // F2
|
toggleHud: { keyCode: 113 }, // F2
|
||||||
toggleFPSInfo: { keyCode: 112 }, // F1
|
toggleFPSInfo: { keyCode: 115 }, // F1
|
||||||
},
|
},
|
||||||
|
|
||||||
buildings: {
|
buildings: {
|
||||||
|
@ -104,7 +104,7 @@ export class MinerSystem extends GameSystemWithFilter {
|
|||||||
if (entity && entity.components.Miner) {
|
if (entity && entity.components.Miner) {
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
if (!staticComp.shouldBeDrawn(parameters)) {
|
if (!staticComp.shouldBeDrawn(parameters)) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lowerLayerItem = this.root.map.getLowerLayerContentXY(
|
const lowerLayerItem = this.root.map.getLowerLayerContentXY(
|
||||||
|
@ -388,6 +388,7 @@ keybindings:
|
|||||||
menuOpenStats: Statistics
|
menuOpenStats: Statistics
|
||||||
|
|
||||||
toggleHud: Toggle HUD
|
toggleHud: Toggle HUD
|
||||||
|
toggleFPSInfo: Toggle FPS and Debug Info
|
||||||
belt: *belt
|
belt: *belt
|
||||||
splitter: *splitter
|
splitter: *splitter
|
||||||
underground_belt: *underground_belt
|
underground_belt: *underground_belt
|
||||||
|
Loading…
Reference in New Issue
Block a user