updated label and message

This commit is contained in:
Chr1Z93 2024-08-03 19:44:41 +02:00
parent 4c4bcad32b
commit e688efe176
2 changed files with 13 additions and 8 deletions

View File

@ -1834,27 +1834,27 @@ function handVisibilityToggle(params)
local handColor = params.handColor
-- collect data for message
local state
local sourceName = getColoredName(handColor)
local targetName = getColoredName(playerColor)
local state, preposition
-- modify data table
if not handVisibility[handColor] then
handVisibility[handColor] = { playerColor, handColor }
state = "Disabled"
state, preposition = "Showing", "to"
elseif removeValueFromTable(handVisibility[handColor], playerColor) then
-- something was removed, maybe clear the table
if #handVisibility[handColor] == 1 and handVisibility[handColor][1] == handColor then
handVisibility[handColor] = nil
end
state = "Enabled"
state, preposition = "Hiding", "from"
else
-- add the new color as viewer
table.insert(handVisibility[handColor], playerColor)
state = "Disabled"
state, preposition = "Showing", "to"
end
broadcastToAll(state .. " hiding of " .. sourceName .. "'s hand for " .. targetName .. ".")
local sourceName = getColoredName(handColor)
local targetName = getColoredName(playerColor)
broadcastToAll(state .. " " .. sourceName .. "'s hand " .. preposition .. " " .. targetName .. ".")
updateHandVisibility()
end

View File

@ -28,7 +28,7 @@ local availableOptions = {
},
{
id = "visibilitySelect",
title = "Toggle this Hand's hiding",
title = "Show/Hide this Hand to me",
type = "button"
}
}
@ -985,6 +985,11 @@ end
-- instruct Global to update this mat's hand visibility
function onClick_visibilitySelect(player)
if player.color == playerColor then
printToColor("This is meant to be clicked by other players to be able to see your hand (primarily for multi-handed gameplay). It won't do anything for you.", playerColor)
return
end
Global.call("handVisibilityToggle", { playerColor = player.color, handColor = playerColor })
end