Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed hand helper being loaded first #759

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/accessories/HandHelper.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,11 +34,14 @@ function onLoad()
buttonParamaters.font_color = "Black"
self.createButton(buttonParamaters)

updateColors()
-- 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)
-- start loop to update card count
playermatApi.checkForDES(matColor)
Wait.time(updateValue, 1, -1)
end, 1)
end

-- updates colors when object is dropped somewhere
Expand Down Expand Up @@ -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

Expand Down
10 changes: 4 additions & 6 deletions src/playermat/Playermat.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -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
table.insert(choices, i)
end
else
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)
elseif md == nil then
broadcastToColor(hand[i].getName() .. " is missing metadata and won't be discarded.", messageColor, "Orange")
end
end

Expand Down
Loading