added new function for hand visibility

This commit is contained in:
Chr1Z93 2024-08-04 00:11:44 +02:00
parent 6334707115
commit 3f9770a61a
4 changed files with 19 additions and 5 deletions

View File

@ -106,7 +106,7 @@ function takeCardIntoThreatArea(playerColor, hoveredObject)
-- contruct feedback message -- contruct feedback message
local cardName = hoveredObject.getName() local cardName = hoveredObject.getName()
if cardName == "" then cardName = "a card" end if cardName == "" then cardName = "a card" end
local playerName = Global.call("getColoredName", playerColor) local playerName = GlobalApi.getColoredName(playerColor)
broadcastToAll("Moved " .. cardName .. " to " .. playerName .. "'s threat area.", "White") broadcastToAll("Moved " .. cardName .. " to " .. playerName .. "'s threat area.", "White")
-- get new rotation (rounded) -- get new rotation (rounded)
@ -379,7 +379,7 @@ function removeOneUse(playerColor, hoveredObject)
end end
-- construct feedback message -- construct feedback message
local playerName = Global.call("getColoredName", playerColor) local playerName = GlobalApi.getColoredName(playerColor)
local cardInfo = "" local cardInfo = ""
if cardName and cardName ~= "" then if cardName and cardName ~= "" then
cardInfo = " from " .. cardName cardInfo = " from " .. cardName
@ -530,7 +530,7 @@ function takeClueFromLocation(playerColor, hoveredObject)
end end
-- construct feedback message -- construct feedback message
local playerName = Global.call("getColoredName", playerColor) local playerName = GlobalApi.getColoredName(playerColor)
local cardInfo = "" local cardInfo = ""
if cardName and cardName ~= "" then if cardName and cardName ~= "" then
cardInfo = " from " .. cardName cardInfo = " from " .. cardName

View File

@ -2503,6 +2503,7 @@ function isTableEmpty(tbl)
end end
-- returns the colored steam name or color -- returns the colored steam name or color
---@param playerColor string Color of the player
function getColoredName(playerColor) function getColoredName(playerColor)
local displayName = playerColor local displayName = playerColor
if Player[playerColor].steam_name then if Player[playerColor].steam_name then

View File

@ -40,6 +40,19 @@ do
Global.call("updateGlobalXml", newXml) Global.call("updateGlobalXml", newXml)
end end
-- returns the colored steam name or color
---@param playerColor string Color of the player
function GlobalApi.getColoredName(playerColor)
return Global.call("getColoredName", playerColor)
end
-- toggles the hand visibility of a hand for a specific player
---@param playerColor string Color of the player that needs the visibility toggled
---@param handColor string Color of the hand to toggle the visibility for
function GlobalApi.handVisibilityToggle(playerColor, handColor)
Global.call("handVisibilityToggle", { playerColor = playerColor, handColor = handColor})
end
-- loads saved options -- loads saved options
---@param options table Set a new state for the option table ---@param options table Set a new state for the option table
function GlobalApi.loadOptionPanelSettings(options) function GlobalApi.loadOptionPanelSettings(options)

View File

@ -624,7 +624,7 @@ function doDiscardOne()
local cardId = choices[num] .. "/" .. #hand local cardId = choices[num] .. "/" .. #hand
deckLib.placeOrMergeIntoDeck(card, returnGlobalDiscardPosition(), self.getRotation()) deckLib.placeOrMergeIntoDeck(card, returnGlobalDiscardPosition(), self.getRotation())
local playerName = Global.call("getColoredName", playerColor) local playerName = GlobalApi.getColoredName(playerColor)
broadcastToAll(playerName .. " randomly discarded " .. cardName " (" .. cardId .. ").", "White") broadcastToAll(playerName .. " randomly discarded " .. cardName " (" .. cardId .. ").", "White")
end end
end end
@ -979,7 +979,7 @@ function onClick_visibilitySelect(player)
return return
end end
Global.call("handVisibilityToggle", { playerColor = player.color, handColor = playerColor }) GlobalApi.handVisibilityToggle(player.color, playerColor)
end end
-- changes the UI state and the internal variable for the togglebuttons -- changes the UI state and the internal variable for the togglebuttons