bugfix: gray out radial emoji option after sending emoji to all players

This commit is contained in:
Evan
2025-01-22 20:08:12 -08:00
parent f7a0619347
commit 67840026ff
3 changed files with 7 additions and 3 deletions
@@ -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) => {
+3 -2
View File
@@ -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)) {
+1
View File
@@ -357,6 +357,7 @@ export interface PlayerActions {
canBoat: boolean
canAttack: boolean
buildableUnits: UnitType[]
canSendEmojiAllPlayers: boolean
interaction?: PlayerInteraction
}