Merge pull request #700 from Whimsical-Cloudheart/patch-1
Added confirmation dialog to discard hotkey
This commit is contained in:
commit
33c8b1377a
@ -135,11 +135,17 @@ function discardObject(playerColor, hoveredObject)
|
||||
return
|
||||
end
|
||||
|
||||
-- warning for locations since these are usually not meant to be discarded
|
||||
if hoveredObject.hasTag("Location") then
|
||||
broadcastToAll("Watch out: A location was discarded.", "Yellow")
|
||||
-- These should probably not be discarded normally. Ask player for confirmation.
|
||||
if (hoveredObject.type == "Deck") or hoveredObject.hasTag("Location") then
|
||||
local suspect = (hoveredObject.type == "Deck") and "Deck" or "Location"
|
||||
Player[playerColor].showConfirmDialog("Discard " .. suspect .. "?", function () performDiscard(playerColor, hoveredObject) end)
|
||||
return
|
||||
end
|
||||
|
||||
performDiscard(playerColor, hoveredObject)
|
||||
end
|
||||
|
||||
function performDiscard(playerColor, hoveredObject)
|
||||
-- initialize list of objects to discard
|
||||
local discardTheseObjects = { hoveredObject }
|
||||
|
||||
@ -168,7 +174,7 @@ function discardTopDeck(playerColor, hoveredObject)
|
||||
else
|
||||
takenCard = hoveredObject
|
||||
end
|
||||
Wait.frames(function() discardObject(playerColor, takenCard) end, 1)
|
||||
Wait.frames(function() performDiscard(playerColor, takenCard) end, 1)
|
||||
end
|
||||
|
||||
-- helper function to get the player to trigger the discard function for
|
||||
|
Loading…
x
Reference in New Issue
Block a user