mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-06 17:44:33 +00:00
Show warning when placing too many buildings
This commit is contained in:
parent
9c75e1777d
commit
07ac928717
@ -45,6 +45,7 @@ import { HUDLeverToggle } from "./parts/lever_toggle";
|
|||||||
import { HUDLayerPreview } from "./parts/layer_preview";
|
import { HUDLayerPreview } from "./parts/layer_preview";
|
||||||
import { HUDMinerHighlight } from "./parts/miner_highlight";
|
import { HUDMinerHighlight } from "./parts/miner_highlight";
|
||||||
import { HUDBetaOverlay } from "./parts/beta_overlay";
|
import { HUDBetaOverlay } from "./parts/beta_overlay";
|
||||||
|
import { HUDPerformanceWarning } from "./parts/performance_warning";
|
||||||
|
|
||||||
export class GameHUD {
|
export class GameHUD {
|
||||||
/**
|
/**
|
||||||
@ -85,6 +86,7 @@ export class GameHUD {
|
|||||||
layerPreview: new HUDLayerPreview(this.root),
|
layerPreview: new HUDLayerPreview(this.root),
|
||||||
|
|
||||||
minerHighlight: new HUDMinerHighlight(this.root),
|
minerHighlight: new HUDMinerHighlight(this.root),
|
||||||
|
performanceWarning: new HUDPerformanceWarning(this.root),
|
||||||
|
|
||||||
// Typing hints
|
// Typing hints
|
||||||
/* typehints:start */
|
/* typehints:start */
|
||||||
|
16
src/js/game/hud/parts/performance_warning.js
Normal file
16
src/js/game/hud/parts/performance_warning.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { T } from "../../../translations";
|
||||||
|
import { BaseHUDPart } from "../base_hud_part";
|
||||||
|
|
||||||
|
export class HUDPerformanceWarning extends BaseHUDPart {
|
||||||
|
initialize() {
|
||||||
|
this.warningShown = false;
|
||||||
|
this.root.signals.entityManuallyPlaced.add(this.checkAfterPlace, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkAfterPlace() {
|
||||||
|
if (!this.warningShown && this.root.entityMgr.entities.length > 10000) {
|
||||||
|
this.root.hud.parts.dialogs.showInfo(T.dialogs.entityWarning.title, T.dialogs.entityWarning.desc);
|
||||||
|
this.warningShown = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -287,6 +287,10 @@ dialogs:
|
|||||||
title: Rename Savegame
|
title: Rename Savegame
|
||||||
desc: You can rename your savegame here.
|
desc: You can rename your savegame here.
|
||||||
|
|
||||||
|
entityWarning:
|
||||||
|
title: Performance Warning
|
||||||
|
desc: You have placed a lot of buildings, this is just a friendly reminder that the game can not handle an endless count of buildings - So try to keep your factories compact!
|
||||||
|
|
||||||
ingame:
|
ingame:
|
||||||
# This is shown in the top left corner and displays useful keybindings in
|
# This is shown in the top left corner and displays useful keybindings in
|
||||||
# every situation
|
# every situation
|
||||||
|
Loading…
Reference in New Issue
Block a user