From 31dd3ee5cc473c22ee2ad9a72a1789ce8e5d2c2e Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 29 Oct 2023 16:37:49 -0700 Subject: [PATCH] use new walkability group api --- devel/unit-path.lua | 11 +---------- gui/pathable.lua | 3 +-- warn-stranded.lua | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/devel/unit-path.lua b/devel/unit-path.lua index 707ecf8e94..459ff92159 100644 --- a/devel/unit-path.lua +++ b/devel/unit-path.lua @@ -47,15 +47,6 @@ local function getTileType(cursor) end end -local function getTileWalkable(cursor) - local block = dfhack.maps.getTileBlock(cursor) - if block then - return block.walkable[cursor.x%16][cursor.y%16] - else - return 0 - end -end - local function paintMapTile(dc, vp, cursor, pos, ...) if not same_xyz(cursor, pos) then local stile = vp:tileToScreen(pos) @@ -115,7 +106,7 @@ function UnitPathUI:renderPath(dc,vp,cursor) end end local color = COLOR_LIGHTGREEN - if getTileWalkable(pt) == 0 then color = COLOR_LIGHTRED end + if dfhack.maps.getWalkableGroup(pt) == 0 then color = COLOR_LIGHTRED end paintMapTile(dc, vp, cursor, pt, char, color) end end diff --git a/gui/pathable.lua b/gui/pathable.lua index 863e625ece..868ce5d7f6 100644 --- a/gui/pathable.lua +++ b/gui/pathable.lua @@ -73,8 +73,7 @@ function Pathable:onRenderBody() return end - local block = dfhack.maps.getTileBlock(target) - local walk_group = block and block.walkable[target.x % 16][target.y % 16] or 0 + local walk_group = dfhack.maps.getWalkableGroup(target) group:setText(walk_group == 0 and 'None' or tostring(walk_group)) if self.subviews.draw:getOptionValue() then diff --git a/warn-stranded.lua b/warn-stranded.lua index 0933a7364b..b68f80ead8 100644 --- a/warn-stranded.lua +++ b/warn-stranded.lua @@ -301,7 +301,7 @@ end local function getWalkGroup(pos) local block = dfhack.maps.getTileBlock(pos) if not block then return end - local walkGroup = block.walkable[pos.x % 16][pos.y % 16] + local walkGroup = dfhack.maps.getWalkableGroup(pos) return walkGroup ~= 0 and walkGroup or nil end