updated context menu function

This commit is contained in:
Chr1Z93 2024-06-02 19:34:35 +02:00
parent 49dcb9625f
commit b2f7f152d3

View File

@ -180,8 +180,8 @@ function updateDisplay()
end end
function addContextMenu() function addContextMenu()
self.addContextMenuItem("Change class", function(playerColor) self.addContextMenuItem("Change color", function(playerColor)
Player[playerColor].showOptionsDialog("Choose class", listOfClasses, class, updateClass) Player[playerColor].showOptionsDialog("Choose color", listOfClasses, class, updateClass)
end) end)
-- get display symbol from potential list -- get display symbol from potential list
@ -194,15 +194,16 @@ function addContextMenu()
Player[playerColor].showOptionsDialog("Choose symbol", listOfSymbols, symbols[1], updateSymbol) Player[playerColor].showOptionsDialog("Choose symbol", listOfSymbols, symbols[1], updateSymbol)
end) end)
self.addContextMenuItem("Add 2nd symbol", function(playerColor) self.addContextMenuItem("Change 2nd symbol", function(playerColor)
if string.contains(symbol, "/") then Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbols[1], function(additionalSymbol)
broadcastToColor("Two symbols is the maximum!", playerColor, "Orange") symbol = symbols[1] .. "/" .. additionalSymbol
else updateDisplay()
Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbol, function(additionalSymbol) end)
symbol = symbol .. "/" .. additionalSymbol end)
updateDisplay()
end) self.addContextMenuItem("Remove 2nd symbol", function()
end symbol = symbols[1]
updateDisplay()
end) end)
end end