diff options
| author | jj | 2012-08-03 16:54:40 +0200 |
|---|---|---|
| committer | jj | 2012-08-03 17:00:02 +0200 |
| commit | c1bcd270e9488f668f0c38c4d8ac736f5368ee00 (patch) | |
| tree | 76df5fc57b1f7bbd04b40cb6c17c1249579dcf7a /plugins/ruby | |
| parent | f400591080b29add7b64d196b4bf3911c2803ded (diff) | |
| download | dfhack-c1bcd270e9488f668f0c38c4d8ac736f5368ee00.tar.gz dfhack-c1bcd270e9488f668f0c38c4d8ac736f5368ee00.tar.bz2 dfhack-c1bcd270e9488f668f0c38c4d8ac736f5368ee00.tar.xz | |
ruby: add spawn_water/spawn_magma methods to MapTile
Diffstat (limited to 'plugins/ruby')
| -rw-r--r-- | plugins/ruby/map.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/ruby/map.rb b/plugins/ruby/map.rb index a0438670..c99d5b88 100644 --- a/plugins/ruby/map.rb +++ b/plugins/ruby/map.rb @@ -107,6 +107,31 @@ module DFHack Tiletype::Direction[tiletype] end + def shape_caption + TiletypeShape::Caption[shape] + end + + def shape_basic + TiletypeShape::BasicShape[shape] + end + + def shape_passablelow + TiletypeShape::PassableLow[shape] + end + + def shape_passablehigh + TiletypeShape::PassableHigh[shape] + end + + def shape_passableflow + TiletypeShape::PassableFlow[shape] + end + + def shape_walkable + TiletypeShape::Walkable[shape] + end + + # return all veins for current mapblock def all_veins mapblock.block_events.grep(BlockSquareEventMineralst) @@ -162,5 +187,28 @@ module DFHack def inspect "#<MapTile pos=[#@x, #@y, #@z] shape=#{shape} tilemat=#{tilemat} material=#{mat_info.token}>" end + + def spawn_liquid(quantity, is_magma=false, flowing=true) + designation.flow_size = quantity + designation.liquid_type = (is_magma ? :Magma : :Water) + designation.flow_forbid = true if is_magma or quantity >= 4 + + if flowing + mapblock.flags.update_liquid = true + mapblock.flags.update_liquid_twice = true + + zf = df.world.map.z_level_flags[z] + zf.update = true + zf.update_twice = true + end + end + + def spawn_water(quantity=7) + spawn_liquid(quantity) + end + + def spawn_magma(quantity=7) + spawn_liquid(quantity, true) + end end end |
