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
local cardName = hoveredObject.getName()
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")
-- get new rotation (rounded)
@ -379,7 +379,7 @@ function removeOneUse(playerColor, hoveredObject)
end
-- construct feedback message
local playerName = Global.call("getColoredName", playerColor)
local playerName = GlobalApi.getColoredName(playerColor)
local cardInfo = ""
if cardName and cardName ~= "" then
cardInfo = " from " .. cardName
@ -530,7 +530,7 @@ function takeClueFromLocation(playerColor, hoveredObject)
end
-- construct feedback message
local playerName = Global.call("getColoredName", playerColor)
local playerName = GlobalApi.getColoredName(playerColor)
local cardInfo = ""
if cardName and cardName ~= "" then
cardInfo = " from " .. cardName

View File

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

View File

@ -40,6 +40,19 @@ do
Global.call("updateGlobalXml", newXml)
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
---@param options table Set a new state for the option table
function GlobalApi.loadOptionPanelSettings(options)

View File

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