fixed hand helper being loaded first

This commit is contained in:
Chr1Z93 2024-07-08 09:29:15 +02:00
parent bf4fcd6051
commit abbc8d5ff2
2 changed files with 15 additions and 10 deletions

View File

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

View File

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