From 67840026ffb6866e28c49defdd003cf7ae230eb3 Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 22 Jan 2025 20:08:12 -0800 Subject: [PATCH] bugfix: gray out radial emoji option after sending emoji to all players --- src/client/graphics/layers/radial/RadialMenu.ts | 4 +++- src/core/GameRunner.ts | 5 +++-- src/core/game/Game.ts | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/graphics/layers/radial/RadialMenu.ts b/src/client/graphics/layers/radial/RadialMenu.ts index 9fe0b0f99..cfe05ab05 100644 --- a/src/client/graphics/layers/radial/RadialMenu.ts +++ b/src/client/graphics/layers/radial/RadialMenu.ts @@ -259,7 +259,9 @@ export class RadialMenu implements Layer { this.activateMenuElement(Slot.Build, "#ebe250", buildIcon, () => { this.buildMenu.showMenu(myPlayer, this.clickedCell) }) - if (actions.interaction?.canSendEmoji) { + const canSendEmojiToPlayer = this.g.hasOwner(tile) && this.g.ownerID(tile) != myPlayer.smallID() && actions.interaction?.canSendEmoji + const canSendEmojiToAllPlayers = this.g.ownerID(tile) == myPlayer.smallID() && actions.canSendEmojiAllPlayers + if (canSendEmojiToPlayer || canSendEmojiToAllPlayers) { this.activateMenuElement(Slot.Emoji, "#00a6a4", emojiIcon, () => { const target = this.g.owner(tile) == myPlayer ? AllPlayers : (this.g.owner(tile) as Player) this.emojiTable.onEmojiClicked = (emoji: string) => { diff --git a/src/core/GameRunner.ts b/src/core/GameRunner.ts index 245f296d3..fb77c2fe5 100644 --- a/src/core/GameRunner.ts +++ b/src/core/GameRunner.ts @@ -4,7 +4,7 @@ import { getConfig } from "./configuration/Config"; import { EventBus } from "./EventBus"; import { Executor } from "./execution/ExecutionManager"; import { WinCheckExecution } from "./execution/WinCheckExecution"; -import { Cell, DisplayMessageUpdate, Game, GameUpdateType, MessageType, MutableGame, NameViewData, Player, PlayerActions, PlayerID, PlayerProfile, PlayerType, UnitType } from "./game/Game"; +import { AllPlayers, Cell, DisplayMessageUpdate, Game, GameUpdateType, MessageType, MutableGame, NameViewData, Player, PlayerActions, PlayerID, PlayerProfile, PlayerType, UnitType } from "./game/Game"; import { createGame } from "./game/GameImpl"; import { loadTerrainMap as loadGameMap } from "./game/TerrainMapLoader"; import { GameConfig, Turn } from "./Schemas"; @@ -94,7 +94,8 @@ export class GameRunner { const actions = { canBoat: this.canBoat(player, tile), canAttack: this.canAttack(player, tile), - buildableUnits: Object.values(UnitType).filter(ut => player.canBuild(ut, tile) != false) + buildableUnits: Object.values(UnitType).filter(ut => player.canBuild(ut, tile) != false), + canSendEmojiAllPlayers: player.canSendEmoji(AllPlayers) } as PlayerActions if (this.game.hasOwner(tile)) { diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index 6c3583378..52cab714c 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -357,6 +357,7 @@ export interface PlayerActions { canBoat: boolean canAttack: boolean buildableUnits: UnitType[] + canSendEmojiAllPlayers: boolean interaction?: PlayerInteraction }