diff --git a/code/modules/casino/board_games/space_battle.dm b/code/modules/casino/board_games/space_battle.dm index 8e8158e3bf6..d446badde3b 100644 --- a/code/modules/casino/board_games/space_battle.dm +++ b/code/modules/casino/board_games/space_battle.dm @@ -71,7 +71,7 @@ "current_player" = ui.user, "player_one" = player_one_mob, "player_two" = player_two_mob, - "all_placed" = ships_have_been_placed == (PLAYER_ONE_PLACED_SHIPS | PLAYER_TWO_PLACED_SHIPS), + "all_placed" = ships_have_been_placed, "shots_fired_pone" = shots_fired_pone, "shots_fired_ptwo" = shots_fired_ptwo, "destroyed_ships_pone" = destroyed_ships_pone, diff --git a/code/modules/tgui/states/board_game.dm b/code/modules/tgui/states/board_game.dm index 7ced0b7ef03..2f97455aff4 100644 --- a/code/modules/tgui/states/board_game.dm +++ b/code/modules/tgui/states/board_game.dm @@ -1,7 +1,7 @@ /** * tgui state: board_game_state * - * Checks that the default living handling or if the user or the object are inside a belly + * Checks the distance only based on the turf, to allow interaction with devices held in hand or people inside a belly **/ GLOBAL_DATUM_INIT(tgui_board_game_state, /datum/tgui_state/board_game_state, new) @@ -9,10 +9,7 @@ GLOBAL_DATUM_INIT(tgui_board_game_state, /datum/tgui_state/board_game_state, new /datum/tgui_state/board_game_state/can_use_topic(atom/src_object, mob/user) if(!isliving(user)) return STATUS_UPDATE - var/mob/living/living_user = user - if(isbelly(living_user.loc) || isbelly(src_object.loc)) - return living_user.board_game_can_use_tgui_topic(src_object) - return living_user.default_can_use_tgui_topic(src_object) + return user.board_game_can_use_tgui_topic(src_object) /mob/proc/board_game_can_use_tgui_topic(atom/src_object) return STATUS_CLOSE @@ -23,4 +20,8 @@ GLOBAL_DATUM_INIT(tgui_board_game_state, /datum/tgui_state/board_game_state, new var/dist = get_dist(get_turf(src_object), get_turf(src)) if(dist <= 1) return STATUS_INTERACTIVE + else if(dist <= 2) // View only if 2-3 tiles away. + return STATUS_UPDATE + else if(dist <= 5) // Disable if 5 tiles away. + return STATUS_DISABLED return STATUS_CLOSE diff --git a/tgui/packages/tgui/interfaces/ChessCheckers/PlayerMenu.tsx b/tgui/packages/tgui/interfaces/ChessCheckers/PlayerMenu.tsx index c7535e9ef41..105e9285976 100644 --- a/tgui/packages/tgui/interfaces/ChessCheckers/PlayerMenu.tsx +++ b/tgui/packages/tgui/interfaces/ChessCheckers/PlayerMenu.tsx @@ -1,5 +1,6 @@ import { useBackend } from 'tgui/backend'; import { Box, Button, Section, Stack } from 'tgui-core/components'; +import { AnimatedArrows, AnimatedArrowsLeft } from '../common/AnimatedArrows'; import { VorePanelTooltip } from '../VorePanel/VorePanelElements/VorePanelTooltip'; import { gameTooltip } from './constants'; import { gameStateToText, stateToColor } from './functions'; @@ -111,6 +112,9 @@ export const PlayerMenu = (props) => { {gameStateToText(game_state, game_flags, winner)} + + + { ); }; + +export const PlayerIndicator = (props: { gameState: number }) => { + const { gameState } = props; + if (gameState === 1) { + return ; + } + if (gameState === 2) { + return ; + } + return null; +}; diff --git a/tgui/packages/tgui/interfaces/NineMen/PlayerMenu.tsx b/tgui/packages/tgui/interfaces/NineMen/PlayerMenu.tsx index 93738fbdeb9..c6d07f5f27b 100644 --- a/tgui/packages/tgui/interfaces/NineMen/PlayerMenu.tsx +++ b/tgui/packages/tgui/interfaces/NineMen/PlayerMenu.tsx @@ -1,5 +1,6 @@ import { useBackend } from 'tgui/backend'; import { Box, Button, Section, Stack } from 'tgui-core/components'; +import { PlayerIndicator } from '../ChessCheckers/PlayerMenu'; import { VorePanelTooltip } from '../VorePanel/VorePanelElements/VorePanelTooltip'; import { gameTooltip, phastToText } from './constants'; import { gameStateToText, stateToColor } from './functions'; @@ -110,6 +111,9 @@ export const PlayerMenu = (props) => { {phastToText[phase]} + + + ; destroyedShips: Ship[]; @@ -86,7 +86,7 @@ const Playfield = (props: { const { game_state, ship_sizes, visible_ships } = data; const { player, - isOponent, + isOpponent, isSelf, shotsFired, destroyedShips, @@ -167,7 +167,12 @@ const Playfield = (props: { function getCellStyle(x: number, y: number) { const key = `${x},${y}`; - let cellStyle: React.CSSProperties = {}; + let cellStyle: { + backgroundColor?: string; + icon?: string; + disabled?: boolean; + classes: string[]; + } = { classes: [] }; if (visible_ships) { for (const ship of visible_ships) { @@ -184,16 +189,21 @@ const Playfield = (props: { const shot = shotsFired[key]; if (shot === 1) { cellStyle.backgroundColor = 'red'; + cellStyle.icon = 'explosion'; + cellStyle.disabled = true; } else if (shot === 0) { cellStyle.backgroundColor = 'white'; + cellStyle.icon = 'water'; + cellStyle.disabled = true; } } for (const ship of destroyedShips) { if (ship.coords?.some((coord) => coord[0] === x && coord[1] === y)) { cellStyle = { - border: '2px solid gold', - backgroundColor: 'maroon', + icon: 'burst', + classes: ['SpaceBattle__ShipSunk'], + disabled: true, }; } } @@ -227,11 +237,10 @@ const Playfield = (props: { ) : (
handleButtonHover(x, y)}>