Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Template for new versions:

## Misc Improvements
- All places where units are listed in DFHack tools now show the translated English name in addition to the native name. In particular, this makes units searchable by English name in `gui/sitemap`.
- `dig`: ASCII overlay now displays priority of digging designations

## Documentation

Expand Down
12 changes: 6 additions & 6 deletions docs/plugins/dig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ Overlay
This tool also provides three overlays that are managed by the `overlay`
framework.

asciicarve
~~~~~~~~~~
asciidesignated
~~~~~~~~~~~~~~~

The ``dig.asciicarve`` overlay makes carving designations visible in ASCII
mode. It highlights tiles that are designated for smoothing, engraving, track
carving, or fortification carving. The designations blink (slowly) so you can
still see what is underneath them.
The ``dig.asciidesignated`` overlay makes designations visible in ASCII mode.
It highlights tiles that are designated for digging, smoothing, engraving,
track carving, or fortification carving. The designations blink (slowly) so you
can still see what is underneath them.

Due to the limitations of the ASCII mode screen buffer, the designation
highlights may show through other interface elements that overlap the
Expand Down
23 changes: 14 additions & 9 deletions plugins/dig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,10 @@ static bool is_designated_for_track_carving(const designation &designation) {
return occ.bits.carve_track_east || occ.bits.carve_track_north || occ.bits.carve_track_south || occ.bits.carve_track_west;
}

static bool is_designated_for_digging(const designation &designation) {
return designation.td.bits.dig != df::tile_dig_designation::No;
}

static char get_track_char(const designation &designation) {
const df::tile_occupancy &occ = designation.to;
if (occ.bits.carve_track_east && occ.bits.carve_track_north && occ.bits.carve_track_south && occ.bits.carve_track_west)
Expand Down Expand Up @@ -2444,8 +2448,8 @@ static char get_tile_char(const df::coord &pos, char desig_char, bool draw_prior
}
}

static void paintScreenCarve() {
TRACE(log).print("entering paintScreenCarve\n");
static void paintScreenDesignated() {
TRACE(log).print("entering paintScreenDesignated\n");

if (Screen::inGraphicsMode() || blink(500))
return;
Expand All @@ -2461,11 +2465,6 @@ static void paintScreenCarve() {
if (!Maps::isValidTilePos(map_pos))
continue;

if (!Maps::isTileVisible(map_pos)) {
TRACE(log).print("skipping hidden tile\n");
continue;
}

TRACE(log).print("scanning map tile at (%d, %d, %d) screen offset (%d, %d)\n",
map_pos.x, map_pos.y, map_pos.z, x, y);

Expand All @@ -2486,8 +2485,14 @@ static void paintScreenCarve() {
else if (is_designated_for_track_carving(des)) {
cur_tile.ch = get_tile_char(map_pos, get_track_char(des), draw_priority); // directional track
}
else if (is_designated_for_digging(des)) {
static char empty_char = (char)0x00;
cur_tile.ch = get_tile_char(map_pos, empty_char, draw_priority);
if (cur_tile.ch == empty_char)
continue;
}
else {
TRACE(log).print("skipping tile with no carving designation\n");
TRACE(log).print("skipping tile with no designation\n");
continue;
}

Expand Down Expand Up @@ -2515,6 +2520,6 @@ DFHACK_PLUGIN_LUA_FUNCTIONS{
DFHACK_LUA_FUNCTION(toggleCurLevelWarmDig),
DFHACK_LUA_FUNCTION(toggleCurLevelDampDig),
DFHACK_LUA_FUNCTION(paintScreenWarmDamp),
DFHACK_LUA_FUNCTION(paintScreenCarve),
DFHACK_LUA_FUNCTION(paintScreenDesignated),
DFHACK_LUA_END
};
17 changes: 11 additions & 6 deletions plugins/lua/dig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,18 @@ function WarmDampOverlay:onRenderFrame(dc, rect)
end

-- --------------------------------
-- CarveOverlay
-- DesignatedOverlay
--

CarveOverlay = defclass(CarveOverlay, overlay.OverlayWidget)
CarveOverlay.ATTRS{
DesignatedOverlay = defclass(DesignatedOverlay, overlay.OverlayWidget)
DesignatedOverlay.ATTRS{
desc='Makes existing carving designations visible when in ASCII mode.',
viewscreens={
'dwarfmode/Designate/DIG_DIG',
'dwarfmode/Designate/DIG_REMOVE_STAIRS_RAMPS',
'dwarfmode/Designate/DIG_STAIR_UPDOWN',
'dwarfmode/Designate/DIG_RAMP',
'dwarfmode/Designate/DIG_CHANNEL',
'dwarfmode/Designate/SMOOTH',
'dwarfmode/Designate/ENGRAVE',
'dwarfmode/Designate/TRACK',
Expand All @@ -365,16 +370,16 @@ CarveOverlay.ATTRS{
frame={w=0, h=0},
}

function CarveOverlay:onRenderFrame()
paintScreenCarve()
function DesignatedOverlay:onRenderFrame()
paintScreenDesignated()
end

-- --------------------------------
-- Exported symbols
--

OVERLAY_WIDGETS = {
asciicarve=CarveOverlay,
asciidesignated=DesignatedOverlay,
warmdamp=WarmDampOverlay,
warmdamptoolbar=WarmDampToolbarOverlay,
}
Expand Down
Loading