From 5a90a04a8eb3f95ee560a335395b8c03cc22f9c1 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Wed, 21 Jun 2023 02:00:06 -0700 Subject: [PATCH] handle obsidian --- docs/changelog.txt | 1 + plugins/dig-now.cpp | 42 ++++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 14b47663a..3300bd0c1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -49,6 +49,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Blueprint library: pump_stack: updated walkthrough and separated dig and channel steps so boulders can be cleared - Blueprint library: aquifer_tap: updated walkthrough - `orders`: better order conditions for the ``smelting`` library orders to reduce cancellation spam +- `dig-now`: can now handle digging obsidian that has been formed from magma and water ## Documentation - `blueprint-library-guide`: update Dreamfort screenshots, add ``aquifer_tap`` screenshot diff --git a/plugins/dig-now.cpp b/plugins/dig-now.cpp index 94d8c761f..1cd56255b 100644 --- a/plugins/dig-now.cpp +++ b/plugins/dig-now.cpp @@ -388,21 +388,37 @@ struct dug_tile_info { df::tiletype tt = map.tiletypeAt(pos); tmat = tileMaterial(tt); + itype = df::item_type::BOULDER; + imat = -1; + + df::tiletype_shape shape = tileShape(tt); + if (shape == df::tiletype_shape::WALL || shape == df::tiletype_shape::FORTIFICATION) { + switch (tmat) { + case df::tiletype_material::STONE: + case df::tiletype_material::MINERAL: + case df::tiletype_material::FEATURE: + imat = map.baseMaterialAt(pos).mat_index; + break; + case df::tiletype_material::LAVA_STONE: + { + MaterialInfo mi; + if (mi.findInorganic("OBSIDIAN")) + imat = mi.index; + return; // itype should always be BOULDER, regardless of vein + } + default: + break; + } + } + switch (map.BlockAtTile(pos)->veinTypeAt(pos)) { case df::inclusion_type::CLUSTER_ONE: case df::inclusion_type::CLUSTER_SMALL: itype = df::item_type::ROUGH; break; default: - itype = df::item_type::BOULDER; + break; } - - imat = -1; - if (tileShape(tt) == df::tiletype_shape::WALL - && (tmat == df::tiletype_material::STONE - || tmat == df::tiletype_material::MINERAL - || tmat == df::tiletype_material::FEATURE)) - imat = map.baseMaterialAt(pos).mat_index; } }; @@ -415,7 +431,6 @@ static bool is_diggable(MapExtras::MapCache &map, const DFCoord &pos, case df::tiletype_material::RIVER: case df::tiletype_material::TREE: case df::tiletype_material::ROOT: - case df::tiletype_material::LAVA_STONE: case df::tiletype_material::MAGMA: case df::tiletype_material::HFS: case df::tiletype_material::UNDERWORLD_GATE: @@ -444,15 +459,6 @@ static bool dig_tile(color_ostream &out, MapExtras::MapCache &map, return false; } - /** The algorithm process seems to be: - * for each tile - * check for a designation - * if a designation exists send it to dig_tile - * - * dig_tile (below) then digs the layer below the channel designated tile - * thereby changing it and causing its designation to be lost - * */ - df::tiletype target_type = df::tiletype::Void; switch(designation) { case df::tile_dig_designation::Default: