From 02b52fcb3decced37bad3dfd6226f35e7ddf6457 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 27 Mar 2023 16:11:21 -0700 Subject: [PATCH] confirm for removing burrows via the repaint menu --- docs/changelog.txt | 1 + docs/plugins/confirm.rst | 5 +++-- plugins/lua/confirm.lua | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index d55ab6585..62aa4a037 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -52,6 +52,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Misc Improvements - `buildingplan`: filters and global settings are now ignored when manually choosing items for a building +- `confirm`: adds confirmation for removing burrows via the repaint menu - `stockpiles`: support applying stockpile configurations with fully enabled categories to stockpiles in worlds other than the one where the configuration was exported from - `stockpiles`: support partial application of a saved config based on dynamic filtering - `stockpiles`: additive and subtractive modes when applying a second stockpile configuration on top of a first diff --git a/docs/plugins/confirm.rst b/docs/plugins/confirm.rst index f0a34b909..1e6270187 100644 --- a/docs/plugins/confirm.rst +++ b/docs/plugins/confirm.rst @@ -5,8 +5,9 @@ confirm :summary: Adds confirmation dialogs for destructive actions. :tags: fort interface -Now you can get the chance to avoid accidentally disbanding a squad or deleting a -hauling route in case you hit the key accidentally. +In the base game, it is frightenly easy to destroy hours of work with a single +misclick. Now you can avoid the consequences of accidentally disbanding a squad +(for example), or deleting a hauling route. Usage ----- diff --git a/plugins/lua/confirm.lua b/plugins/lua/confirm.lua index 13964645b..1ddf190b4 100644 --- a/plugins/lua/confirm.lua +++ b/plugins/lua/confirm.lua @@ -12,10 +12,11 @@ setmetatable(keys, { -- Mouse keys will be sent as a string instead of interface_key local MOUSE_LEFT = "MOUSE_LEFT" local MOUSE_RIGHT = "MOUSE_RIGHT" + --[[ The screen where a confirmation has been triggered Note that this is *not* necessarily the topmost viewscreen, so do not use gui.getCurViewscreen() or related functions. ]] -screen = nil +--screen = nil function if_nil(obj, default) if obj == nil then @@ -118,7 +119,9 @@ zone_remove.message = "Are you sure you want to remove this zone?" burrow_remove = defconf('burrow-remove') function burrow_remove.intercept_key(key) - return key == MOUSE_LEFT and df.global.game.main_interface.current_hover == 171 + return key == MOUSE_LEFT and + (df.global.game.main_interface.current_hover == 171 or + df.global.game.main_interface.current_hover == 168) end burrow_remove.title = "Remove burrow" burrow_remove.message = "Are you sure you want to remove this burrow?"