updated context menu
This commit is contained in:
parent
9a2a09bb23
commit
ed26af2124
@ -155,6 +155,10 @@ function onLoad(savedData)
|
|||||||
end, 1)
|
end, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getRandomSeed()
|
||||||
|
return math.random(999)
|
||||||
|
end
|
||||||
|
|
||||||
-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag
|
-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag
|
||||||
-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the
|
-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the
|
||||||
-- chaos bag during search operations to avoid this.
|
-- chaos bag during search operations to avoid this.
|
||||||
|
@ -52,7 +52,9 @@ function onLoad(savedData)
|
|||||||
|
|
||||||
updateDisplay()
|
updateDisplay()
|
||||||
addContextMenu()
|
addContextMenu()
|
||||||
math.randomseed(os.time())
|
|
||||||
|
-- get random seed from Global so all are different
|
||||||
|
math.randomseed(Global.call("getRandomSeed"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateDisplay()
|
function updateDisplay()
|
||||||
@ -72,7 +74,7 @@ function updateDisplay()
|
|||||||
{
|
{
|
||||||
tag = "Image",
|
tag = "Image",
|
||||||
attributes = {
|
attributes = {
|
||||||
image = "Bundle/Border",
|
image = "Bundle/Ring",
|
||||||
height = "200",
|
height = "200",
|
||||||
width = "200",
|
width = "200",
|
||||||
position = "0 0 -10.2",
|
position = "0 0 -10.2",
|
||||||
@ -105,7 +107,7 @@ function updateDisplay()
|
|||||||
{
|
{
|
||||||
tag = "Image",
|
tag = "Image",
|
||||||
attributes = {
|
attributes = {
|
||||||
image = "Bundle/Border",
|
image = "Bundle/Ring",
|
||||||
color = "#000000",
|
color = "#000000",
|
||||||
height = "200",
|
height = "200",
|
||||||
width = "200",
|
width = "200",
|
||||||
@ -179,30 +181,42 @@ function updateDisplay()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getSymbolList()
|
||||||
|
local symbolList = {}
|
||||||
|
for str in string.gmatch(symbol, "([^/]+)") do
|
||||||
|
table.insert(symbolList, str)
|
||||||
|
end
|
||||||
|
return symbolList
|
||||||
|
end
|
||||||
|
|
||||||
function addContextMenu()
|
function addContextMenu()
|
||||||
self.addContextMenuItem("Change color", function(playerColor)
|
self.addContextMenuItem("Change color", function(playerColor)
|
||||||
Player[playerColor].showOptionsDialog("Choose color", listOfClasses, class, updateClass)
|
Player[playerColor].showOptionsDialog("Choose color", listOfClasses, class, updateClass)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- get display symbol from potential list
|
self.addContextMenuItem("Change 1st symbol", function(playerColor)
|
||||||
local symbols = {}
|
local symbolList = getSymbolList()
|
||||||
for str in string.gmatch(symbol, "([^/]+)") do
|
Player[playerColor].showOptionsDialog("Choose symbol", listOfSymbols, symbolList[1], function(newSymbol)
|
||||||
table.insert(symbols, str)
|
if symbolList[2] then
|
||||||
end
|
symbol = newSymbol .. "/" .. symbolList[2]
|
||||||
|
else
|
||||||
self.addContextMenuItem("Change symbol", function(playerColor)
|
symbol = newSymbol
|
||||||
Player[playerColor].showOptionsDialog("Choose symbol", listOfSymbols, symbols[1], updateSymbol)
|
end
|
||||||
|
updateDisplay()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.addContextMenuItem("Change 2nd symbol", function(playerColor)
|
self.addContextMenuItem("Change 2nd symbol", function(playerColor)
|
||||||
Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbols[1], function(additionalSymbol)
|
local symbolList = getSymbolList()
|
||||||
symbol = symbols[1] .. "/" .. additionalSymbol
|
Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbolList[2] or symbolList[1], function(newSymbol)
|
||||||
|
symbol = symbolList[1] .. "/" .. newSymbol
|
||||||
updateDisplay()
|
updateDisplay()
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.addContextMenuItem("Remove 2nd symbol", function()
|
self.addContextMenuItem("Remove 2nd symbol", function()
|
||||||
symbol = symbols[1]
|
local symbolList = getSymbolList()
|
||||||
|
symbol = symbolList[1]
|
||||||
updateDisplay()
|
updateDisplay()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user