From f7272e4a8f09d11ee41b068277de1f61993cfaa8 Mon Sep 17 00:00:00 2001 From: jj Date: Sun, 23 Sep 2012 10:58:31 +0200 Subject: [PATCH 1/4] ruby: use cursor as default map_tile_at arg --- plugins/ruby/map.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/map.rb b/plugins/ruby/map.rb index d662a3436..4e8bf9100 100644 --- a/plugins/ruby/map.rb +++ b/plugins/ruby/map.rb @@ -26,7 +26,7 @@ module DFHack end end - def map_tile_at(x, y=nil, z=nil) + def map_tile_at(x=df.cursor, y=nil, z=nil) x = x.pos if x.respond_to?(:pos) x, y, z = x.x, x.y, x.z if x.respond_to?(:x) b = map_block_at(x, y, z) From f2199c2951e195a8ee496fd75ee5b512d6e3e15e Mon Sep 17 00:00:00 2001 From: jj Date: Sun, 23 Sep 2012 11:44:27 +0200 Subject: [PATCH 2/4] ruby: fix activity zone_num --- plugins/ruby/building.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/ruby/building.rb b/plugins/ruby/building.rb index 68229c007..3f8842b44 100644 --- a/plugins/ruby/building.rb +++ b/plugins/ruby/building.rb @@ -299,9 +299,13 @@ module DFHack # construct an abstract building (stockpile, farmplot, ...) def building_construct_abstract(bld) - if bld.getType == :Stockpile + case bld.getType + when :Stockpile max = df.world.buildings.other[:STOCKPILE].map { |s| s.stockpile_number }.max bld.stockpile_number = max.to_i + 1 + when :Civzone + max = df.world.buildings.other[:ANY_ZONE].map { |z| z.zone_num }.max + bld.zone_num = max.to_i + 1 end building_link bld if !bld.flags.exists From aefedb98872d6eb34fee1ba3d7a7c7994d49f12e Mon Sep 17 00:00:00 2001 From: jj Date: Sun, 23 Sep 2012 23:26:57 +0200 Subject: [PATCH 3/4] ruby: MapTile#offset, tweak #dig to check for existing jobs --- plugins/ruby/map.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/ruby/map.rb b/plugins/ruby/map.rb index 4e8bf9100..9629c3f9e 100644 --- a/plugins/ruby/map.rb +++ b/plugins/ruby/map.rb @@ -67,6 +67,14 @@ module DFHack @mapblock = b end + def offset(dx, dy=nil, dz=0) + if dx.respond_to?(:x) + dz = dx.z if dx.respond_to?(:z) + dx, dy = dx.x, dx.y + end + df.map_tile_at(@x+dx, @y+dy, @z+dz) + end + def designation @mapblock.designation[@dx][@dy] end @@ -191,16 +199,20 @@ module DFHack def dig(mode=:Default) if mode == :Smooth if tilemat != :SOIL and caption !~ /smooth|pillar|fortification/i and # XXX caption.. - designation.smooth == 0 and not df.world.job_list.find { |j| + designation.smooth == 0 and (designation.hidden or 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 + return if mode != :No and designation.dig == :No and not designation.hidden and df.world.job_list.find { |j| + # someone already enroute to dig here, avoid 'Inappropriate dig square' spam + JobType::Type[j.job_type] == :Digging and df.same_pos?(j, self) + } designation.dig = mode mapblock.flags.designated = true if mode != :No end From b665c344daf0403587b05fca67f575325472c8f4 Mon Sep 17 00:00:00 2001 From: jj Date: Sun, 23 Sep 2012 23:37:57 +0200 Subject: [PATCH 4/4] add deathcause to README --- README.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index e495b1584..73147d061 100644 --- a/README.rst +++ b/README.rst @@ -1052,7 +1052,7 @@ Export the current loaded map as a file. This will be eventually usable with visualizers. dwarfexport -----------= +----------- Export dwarves to RuneSmith-compatible XML. @@ -1632,7 +1632,7 @@ With no argument, this command shows an help message and list existing sources. digfort -========= +======= A script to designate an area for digging according to a plan in csv format. This script, inspired from quickfort, can designate an area for digging. @@ -1668,6 +1668,12 @@ drainaquifer ============ Remove all 'aquifer' tag from the map blocks. Irreversible. +deathcause +========== +Focus a body part ingame, and this script will display the cause of death of +the creature. + + ======================= In-game interface tools =======================