From c6f3ebde5c10fa3f5a1d5b6139ec14e05baa7331 Mon Sep 17 00:00:00 2001 From: Quietust Date: Sat, 26 Jul 2025 13:15:44 -0600 Subject: [PATCH] dig-now - properly handle UNDIGGABLE tiles Fixes #5512 --- docs/changelog.txt | 1 + plugins/dig-now.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index ef0b1b00da..730508f2d9 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -58,6 +58,7 @@ Template for new versions: ## Fixes - several fixes related to changes in file system handling in DF 52.01 +- `dig-now`: don't allow UNDIGGABLE stones to be excavated ## Misc Improvements - `autoclothing`: added a ``clear`` option to unset previously set orders diff --git a/plugins/dig-now.cpp b/plugins/dig-now.cpp index 16fe585157..48984e1b9f 100644 --- a/plugins/dig-now.cpp +++ b/plugins/dig-now.cpp @@ -450,12 +450,10 @@ static bool is_diggable(MapExtras::MapCache &map, const DFCoord &pos, break; } - if (mat == df::tiletype_material::FEATURE) { - // adamantine is the only is diggable feature - t_feature feature; - return map.BlockAtTile(pos)->GetLocalFeature(&feature) - && feature.type == feature_type::deep_special_tube; - } + MaterialInfo mi; + mi.decode(map.baseMaterialAt(pos)); + if (mi.material != nullptr && mi.material->flags.is_set(df::material_flags::UNDIGGABLE)) + return false; return true; }