File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -728,18 +728,23 @@ API.functions["shop"] = function(args)
728728 return
729729 end
730730
731+
732+ -- Used to ensure dollars and shop have been updated before responding, not inheritly atomic
733+ local dollars_before = G .GAME .dollars
734+ local expected_dollars = dollars_before - card .cost
735+ local shop_size_before = # G .shop_jokers .cards
736+
731737 -- activate the buy button using the UI element handler
732738 G .FUNCS .buy_from_shop (card_buy_button )
733739
734-
735740 -- send response once shop is updated
736741 --- @type PendingRequest
737742 API .pending_requests [" shop" ] = {
738- -- TODO: This sends the update before the dollars have been updated.
739743 condition = function ()
740744 return G .STATE == G .STATES .SHOP
741- and # G .E_MANAGER .queues .base < EVENT_QUEUE_THRESHOLD
742- and G .STATE_COMPLETE
745+ and # G .shop_jokers .cards == shop_size_before - 1
746+ and G .GAME .dollars == expected_dollars
747+ and G .STATE_COMPLETE
743748 end ,
744749 action = function ()
745750 local game_state = utils .get_game_state ()
You can’t perform that action at this time.
0 commit comments