Skip to content

Commit 3055c6f

Browse files
committed
Add copy building overlay
1 parent 004b4dd commit 3055c6f

File tree

4 files changed

+1013
-0
lines changed

4 files changed

+1013
-0
lines changed

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Template for new versions:
5555
# Future
5656

5757
## New Tools
58+
- `buildingplan`: Added ``buildingplan.copybuilding`` overlay that shows a copy button on planned/constructed buildings.
5859

5960
## New Features
6061

docs/plugins/buildingplan.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,29 @@ usual) unless freed via the ``Free`` buttons on the ``Show items`` tab on both
237237
buildings. This will remove the mechanism from the building and drop it onto the
238238
ground, allowing it to be reused elsewhere. There is an option to auto-free
239239
mechanisms when unlinking to perform this step automatically.
240+
241+
Copying buildings
242+
-----------------
243+
244+
When viewing a planned or constructed building, a button to ``Copy`` the building
245+
will appear. Clicking this button puts you in placement mode for that building type,
246+
allowing you to quickly place copies of already planned/constructed buildings with
247+
a single action. Details about the copied building are not currently preserved.
248+
249+
You can add a keyboard shortcut to copy buildings without needing to open the building
250+
info screen. To do this, add a line like the following to your
251+
``dfhack-config/init/onMapLoad`` file::
252+
253+
keybinding add <keybinding> copybuilding
254+
255+
In addtion to allowing you to more quickly copy building, this also enables you to copy
256+
buildings that don't have an info screen, such as constructions.
257+
258+
Each time you copy a building it gets added to a history of recently copied buildings
259+
(up to 9 entries). To recall these, you can add additional keybindings like the following::
260+
261+
keybinding add <keybinding> "copybuilding 1"
262+
keybinding add <keybinding> "copybuilding 2"
263+
... etc up to 9 as desired
264+
265+
This allows you to quickly cycle through your recently copied buildings.

plugins/lua/buildingplan.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local _ENV = mkmodule('plugins.buildingplan')
1313
--]]
1414

1515
local argparse = require('argparse')
16+
local copybuilding = require('plugins.buildingplan.copybuilding')
1617
local inspector = require('plugins.buildingplan.inspectoroverlay')
1718
local mechanisms = require('plugins.buildingplan.mechanisms')
1819
local pens = require('plugins.buildingplan.pens')
@@ -137,6 +138,7 @@ function reload_modules()
137138
reload('plugins.buildingplan.itemselection')
138139
reload('plugins.buildingplan.planneroverlay')
139140
reload('plugins.buildingplan.inspectoroverlay')
141+
reload('plugins.buildingplan.copybuilding')
140142
reload('plugins.buildingplan.mechanisms')
141143
reload('plugins.buildingplan.unlink_mechanisms')
142144
reload('plugins.buildingplan')
@@ -145,6 +147,7 @@ end
145147
OVERLAY_WIDGETS = {
146148
planner=planner.PlannerOverlay,
147149
inspector=inspector.InspectorOverlay,
150+
copybuilding=copybuilding.CopyBuildingOverlay,
148151
mechanisms=mechanisms.MechanismOverlay,
149152
mechanism_free=unlink_mechanisms.MechItemOverlay,
150153
mechanism_unlink=unlink_mechanisms.MechLinkOverlay,

0 commit comments

Comments
 (0)