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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- warning for locations since these are usually not meant to be discarded
|
-- These should probably not be discarded normally. Ask player for confirmation.
|
||||||
if hoveredObject.hasTag("Location") then
|
if (hoveredObject.type == "Deck") or hoveredObject.hasTag("Location") then
|
||||||
broadcastToAll("Watch out: A location was discarded.", "Yellow")
|
local suspect = (hoveredObject.type == "Deck") and "Deck" or "Location"
|
||||||
|
Player[playerColor].showConfirmDialog("Discard " .. suspect .. "?", function () performDiscard(playerColor, hoveredObject) end)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
performDiscard(playerColor, hoveredObject)
|
||||||
|
end
|
||||||
|
|
||||||
|
function performDiscard(playerColor, hoveredObject)
|
||||||
-- initialize list of objects to discard
|
-- initialize list of objects to discard
|
||||||
local discardTheseObjects = { hoveredObject }
|
local discardTheseObjects = { hoveredObject }
|
||||||
|
|
||||||
@ -168,7 +174,7 @@ function discardTopDeck(playerColor, hoveredObject)
|
|||||||
else
|
else
|
||||||
takenCard = hoveredObject
|
takenCard = hoveredObject
|
||||||
end
|
end
|
||||||
Wait.frames(function() discardObject(playerColor, takenCard) end, 1)
|
Wait.frames(function() performDiscard(playerColor, takenCard) end, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- helper function to get the player to trigger the discard function for
|
-- helper function to get the player to trigger the discard function for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user