Merge pull request #759 from argonui/hand-helper

Fixed hand helper being loaded first
This commit is contained in:
Chr1Z 2024-07-08 13:12:06 +02:00 committed by GitHub
commit f8d8cb0d28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 10 deletions

View File

@ -9,6 +9,7 @@ function onLoad()
-- index 0: button as hand size label -- index 0: button as hand size label
buttonParamaters.hover_color = "White" buttonParamaters.hover_color = "White"
buttonParamaters.label = 0
buttonParamaters.click_function = "none" buttonParamaters.click_function = "none"
buttonParamaters.position = Vector(0, 0.11, -0.4) buttonParamaters.position = Vector(0, 0.11, -0.4)
buttonParamaters.height = 0 buttonParamaters.height = 0
@ -33,11 +34,14 @@ function onLoad()
buttonParamaters.font_color = "Black" buttonParamaters.font_color = "Black"
self.createButton(buttonParamaters) self.createButton(buttonParamaters)
-- make sure this part executes after the playermats are loaded
Wait.time(function()
updateColors() updateColors()
-- start loop to update card count -- start loop to update card count
playermatApi.checkForDES(matColor) playermatApi.checkForDES(matColor)
Wait.time(updateValue, 1, -1) Wait.time(updateValue, 1, -1)
end, 1)
end end
-- updates colors when object is dropped somewhere -- updates colors when object is dropped somewhere
@ -70,6 +74,9 @@ function updateValue()
updateColors() updateColors()
end end
-- if one of the colors is undefined, then end here
if matColor == nil or handColor == nil then return end
-- if there is still no handzone, then end here -- if there is still no handzone, then end here
if Player[handColor].getHandCount() == 0 then return end if Player[handColor].getHandCount() == 0 then return end

View File

@ -554,13 +554,11 @@ function doDiscardOne()
else else
local choices = {} local choices = {}
for i = 1, #hand do for i = 1, #hand do
local notes = JSON.decode(hand[i].getGMNotes()) local md = JSON.decode(hand[i].getGMNotes())
if notes ~= nil then if md ~= nil and (not md.weakness and not md.hidden and md.type ~= "Enemy") then
if notes.hidden ~= true then
table.insert(choices, i)
end
else
table.insert(choices, i) table.insert(choices, i)
elseif md == nil then
broadcastToColor(hand[i].getName() .. " is missing metadata and won't be discarded.", messageColor, "Orange")
end end
end end