This commit is contained in:
Chr1Z93 2024-05-21 11:35:07 +02:00
parent c61d6dc6d5
commit a62e08c65b
2 changed files with 10 additions and 10 deletions

View File

@ -20,6 +20,7 @@
"Note": "",
"ObjectStates_order": [
"GUIDReferenceHandler.123456",
"GameKeyHandler.fce69c",
"TokenSpawnTracker.e3ffc9",
"HandTrigger.5fe087",
"HandTrigger.be2f17",
@ -196,7 +197,6 @@
"Fan-MadeExpansionOverview.de7cae",
"OptionPanelSource.830bd0",
"SoundCube.3c988f",
"GameKeyHandler.fce69c",
"TokenSpawningReference.f8b3a7",
"3DText.d628cc",
"NavigationOverlayHandler.797ede",

View File

@ -15,22 +15,22 @@ function onLoad(savedData)
addHotkey("Drawing Tool: Redraw", processLines)
end
function onScriptingButtonDown(index, player_color)
function onScriptingButtonDown(index, playerColor)
if index ~= 10 then return end
Timer.create {
identifier = player_color .. "_draw_from",
identifier = playerColor .. "_draw_from",
function_name = "draw_from",
parameters = { Player[player_color] },
parameters = { player = Player[playerColor] },
delay = 1
}
end
function draw_from(player)
local source = player.getHoverObject()
function draw_from(params)
local source = params.player.getHoverObject()
if not source then return end
for _, item in ipairs(player.getSelectedObjects()) do
for _, item in ipairs(params.player.getSelectedObjects()) do
if item ~= source then
if item.getGUID() > source.getGUID() then
addPair(item, source)
@ -43,13 +43,13 @@ function draw_from(player)
processLines()
end
function onScriptingButtonUp(index, player_color)
function onScriptingButtonUp(index, playerColor)
if index ~= 10 then return end
-- returns true only if there is a timer to cancel. If this is false then we've waited longer than a second.
if not Timer.destroy(player_color .. "_draw_from") then return end
if not Timer.destroy(playerColor .. "_draw_from") then return end
local items = Player[player_color].getSelectedObjects()
local items = Player[playerColor].getSelectedObjects()
if #items < 2 then return end
table.sort(items, function(a, b) return a.getGUID() > b.getGUID() end)