Skip to content

Commit

Permalink
Fix interactable objects not opening other panels
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcanorum committed Apr 15, 2021
1 parent e3d92cd commit 1b2485e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/src/game/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class Game extends Phaser.Scene {
if (document.activeElement.tagName === "INPUT") return true;
// Or any panel is open.
if (GUIState.activePanel !== Panels.NONE) {
// except chat panel
// Except chat panel.
if (GUIState.activePanel !== Panels.Chat) return true;
}

Expand Down
20 changes: 16 additions & 4 deletions client/src/game/Statics.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ class DungeonPortal extends Portal {
onPressed() {
if (!this.isWithinPressableRange()) return;
// Prevent opening the crafting panel when a station is clicked on behind and already open panel.
if (GUIState.activePanel !== Panels.NONE) return;
if (GUIState.activePanel !== Panels.NONE) {
// Except chat panel.
if (GUIState.activePanel !== Panels.Chat) return;
}

PubSub.publish(DUNGEON_PORTAL_PRESSED, this);
}
Expand All @@ -293,7 +296,10 @@ class CraftingStation extends Static {
onPressed() {
if (!this.isWithinPressableRange()) return;
// Prevent opening the crafting panel when a station is clicked on behind and already open panel.
if (GUIState.activePanel !== Panels.NONE) return;
if (GUIState.activePanel !== Panels.NONE) {
// Except chat panel.
if (GUIState.activePanel !== Panels.Chat) return;
}

GUIState.setCraftingStation(
this.stationTypeNumber,
Expand Down Expand Up @@ -346,7 +352,10 @@ class BankChest extends Static {
onPressed() {
if (!this.isWithinPressableRange()) return;
// Prevent opening the crafting panel when a station is clicked on behind and already open panel.
if (GUIState.activePanel !== Panels.NONE) return;
if (GUIState.activePanel !== Panels.NONE) {
// Except chat panel.
if (GUIState.activePanel !== Panels.Chat) return;
}

GUIState.setActivePanel(Panels.Bank);
}
Expand All @@ -361,7 +370,10 @@ class Register extends Static {
onPressed() {
if (!this.isWithinPressableRange()) return;
// Prevent opening the crafting panel when a station is clicked on behind and already open panel.
if (GUIState.activePanel !== Panels.NONE) return;
if (GUIState.activePanel !== Panels.NONE) {
// Except chat panel.
if (GUIState.activePanel !== Panels.Chat) return;
}

GUIState.setActivePanel(Panels.ChangeName);
}
Expand Down
5 changes: 4 additions & 1 deletion client/src/game/entities/merchants/Merchant.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class Merchant extends Container {

onPointerDown() {
// Prevent opening the shop panel when a merchant is clicked on behind and already open panel.
if (GUIState.activePanel !== Panels.NONE) return;
if (GUIState.activePanel !== Panels.NONE) {
// Except chat panel.
if (GUIState.activePanel !== Panels.Chat) return;
}

// Check they are within trading range.
const entity = dungeonz.gameScene.dynamics[this.entityId];
Expand Down

0 comments on commit 1b2485e

Please sign in to comment.