diff --git a/src/core/GameKeyHandler.ttslua b/src/core/GameKeyHandler.ttslua index 1570280b..e3faced4 100644 --- a/src/core/GameKeyHandler.ttslua +++ b/src/core/GameKeyHandler.ttslua @@ -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