Merge pull request #659 from argonui/state-cards

Allow changing card state with number typing
This commit is contained in:
BootleggerFinn 2024-04-20 21:19:54 -05:00 committed by GitHub
commit 4f213e13d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -211,6 +211,16 @@ function onObjectNumberTyped(hoveredObject, playerColor, number)
return true
end
end
-- check if this is a card with states (and then change state instead of drawing it)
local states = hoveredObject.getStates()
if states ~= nil and #states > 0 then
local stateId = hoveredObject.getStateId()
if stateId ~= number and (#states + 1) >= number then
hoveredObject.setState(number)
return true
end
end
end
---------------------------------------------------------