Skip to content

Commit

Permalink
constructionIsUnsupported() - early return if unreachable to reduce spam
Browse files Browse the repository at this point in the history
  • Loading branch information
master-spike committed Sep 25, 2023
1 parent 01481c6 commit 7c92421
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions suspendmanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit 7c92421

Please sign in to comment.