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 local handColor = params.handColor
-- collect data for message -- collect data for message
local state local state, preposition
local sourceName = getColoredName(handColor)
local targetName = getColoredName(playerColor)
-- modify data table -- modify data table
if not handVisibility[handColor] then if not handVisibility[handColor] then
handVisibility[handColor] = { playerColor, handColor } handVisibility[handColor] = { playerColor, handColor }
state = "Disabled" state, preposition = "Showing", "to"
elseif removeValueFromTable(handVisibility[handColor], playerColor) then elseif removeValueFromTable(handVisibility[handColor], playerColor) then
-- something was removed, maybe clear the table -- something was removed, maybe clear the table
if #handVisibility[handColor] == 1 and handVisibility[handColor][1] == handColor then if #handVisibility[handColor] == 1 and handVisibility[handColor][1] == handColor then
handVisibility[handColor] = nil handVisibility[handColor] = nil
end end
state = "Enabled" state, preposition = "Hiding", "from"
else else
-- add the new color as viewer -- add the new color as viewer
table.insert(handVisibility[handColor], playerColor) table.insert(handVisibility[handColor], playerColor)
state = "Disabled" state, preposition = "Showing", "to"
end 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() updateHandVisibility()
end end

View File

@ -28,7 +28,7 @@ local availableOptions = {
}, },
{ {
id = "visibilitySelect", id = "visibilitySelect",
title = "Toggle this Hand's hiding", title = "Show/Hide this Hand to me",
type = "button" type = "button"
} }
} }
@ -985,6 +985,11 @@ end
-- instruct Global to update this mat's hand visibility -- instruct Global to update this mat's hand visibility
function onClick_visibilitySelect(player) 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 }) Global.call("handVisibilityToggle", { playerColor = player.color, handColor = playerColor })
end end