From 7c924218d3772b38f894a42da65a755155efacdb Mon Sep 17 00:00:00 2001 From: Najeeb Al-Shabibi Date: Mon, 25 Sep 2023 18:06:21 +0100 Subject: [PATCH] constructionIsUnsupported() - early return if unreachable to reduce spam --- suspendmanager.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/suspendmanager.lua b/suspendmanager.lua index a37cd28dee..2de83aecec 100644 --- a/suspendmanager.lua +++ b/suspendmanager.lua @@ -409,6 +409,13 @@ local function neighboursFloorSupportsFloor(pos) } end +local function hasWalkableNeighbour(pos) + for _,n in pairs(neighbours(pos)) do + if (walkable(n)) then return true end + end + return false +end + local function tileHasSupportWall(pos) local tt = dfhack.maps.getTileType(pos) if tt then @@ -443,6 +450,10 @@ local function constructionIsUnsupported(job) local pos = {x=building.centerx, y=building.centery,z=building.z} + -- if no neighbour is walkable it can't be constructed now anyways, + -- this early return helps reduce "spam" + if not hasWalkableNeighbour(pos) then return false end + -- find out what type of construction local constr_type = building:getSubtype() local wall_would_support = {}