From 19a150fb38cc3b148995fcf6692bef1116c0b529 Mon Sep 17 00:00:00 2001 From: jj Date: Wed, 12 Sep 2012 17:38:00 +0200 Subject: [PATCH] ruby: fix dig smooth overdigging --- plugins/ruby/map.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/ruby/map.rb b/plugins/ruby/map.rb index 5b4e94218..d662a3436 100644 --- a/plugins/ruby/map.rb +++ b/plugins/ruby/map.rb @@ -190,16 +190,20 @@ module DFHack def dig(mode=:Default) if mode == :Smooth - if tilemat != :SOIL and caption !~ /smooth|pillar/i # XXX - # need to check if already smooth, otherwise re-setting - # des.smooth will carve a fortification + if tilemat != :SOIL and caption !~ /smooth|pillar|fortification/i and # XXX caption.. + designation.smooth == 0 and not df.world.job_list.find { |j| + # the game removes 'smooth' designation as soon as it assigns a job, if we + # re-set it the game may queue another :DetailWall that will carve a fortification + (j.job_type == :DetailWall or j.job_type == :DetailFloor) and df.same_pos?(j, self) + } designation.dig = :No designation.smooth = 1 + mapblock.flags.designated = true end else designation.dig = mode + mapblock.flags.designated = true if mode != :No end - mapblock.flags.designated = true if mode != :No end def spawn_liquid(quantity, is_magma=false, flowing=true)