diff --git a/docs/plugins/dig-now.rst b/docs/plugins/dig-now.rst index b6f4d64f7..4628f10f5 100644 --- a/docs/plugins/dig-now.rst +++ b/docs/plugins/dig-now.rst @@ -1,10 +1,15 @@ dig-now ======= -Instantly completes non-marker dig designations, modifying tile shapes and -creating boulders, ores, and gems as if a miner were doing the mining or -engraving. By default, the entire map is processed and boulder generation -follows standard game rules, but the behavior is configurable. +Tags: +:dfhack-keybind:`dig-now` + +:index:`Instantly complete dig designations. +` This tool will magically +complete non-marker dig designations, modifying tile shapes and creating +boulders, ores, and gems as if a miner were doing the mining or engraving. By +default, the entire map is processed and boulder generation follows standard +game rules, but the behavior is configurable. Note that no units will get mining or engraving experience for the dug/engraved tiles. @@ -25,37 +30,34 @@ that coordinate is processed. Any ```` parameters can either be an ``,,`` triple (e.g. ``35,12,150``) or the string ``here``, which means the position of the active -game cursor should be used. +game cursor should be used. You can use the `position` command to get the +current cursor position if you need it. Examples: -``dig-now`` +- ``dig-now`` Dig designated tiles according to standard game rules. - -``dig-now --clean`` - Dig designated tiles, but don't generate any boulders, ores, or gems. - -``dig-now --dump here`` - Dig tiles and dump all generated boulders, ores, and gems at the tile under - the game cursor. +- ``dig-now --clean`` + Dig all designated tiles, but don't generate any boulders, ores, or gems. +- ``dig-now --dump here`` + Dig tiles and teleport all generated boulders, ores, and gems to the tile + under the game cursor. Options: -:``-c``, ``--clean``: +- ``-c``, ``--clean`` Don't generate any boulders, ores, or gems. Equivalent to ``--percentages 0,0,0,0``. -:``-d``, ``--dump ``: +- ``-d``, ``--dump `` Dump any generated items at the specified coordinates. If the tile at those coordinates is open space or is a wall, items will be generated on the closest walkable tile below. -:``-e``, ``--everywhere``: +- ``-e``, ``--everywhere`` Generate a boulder, ore, or gem for every tile that can produce one. Equivalent to ``--percentages 100,100,100,100``. -:``-h``, ``--help``: - Show quick usage help text. -:``-p``, ``--percentages ,,,``: +- ``-p``, ``--percentages ,,,`` Set item generation percentages for each of the tile categories. The ``vein`` category includes both the large oval clusters and the long stringy mineral veins. Default is ``25,33,100,100``. -:``-z``, ``--cur-zlevel``: +- ``-z``, ``--cur-zlevel`` Restricts the bounds to the currently visible z-level. diff --git a/plugins/dig-now.cpp b/plugins/dig-now.cpp index 78b2b1522..bbcabde65 100644 --- a/plugins/dig-now.cpp +++ b/plugins/dig-now.cpp @@ -838,17 +838,6 @@ static bool get_options(color_ostream &out, return true; } -static void print_help(color_ostream &out) { - auto L = Lua::Core::State; - Lua::StackUnwinder top(L); - - if (!lua_checkstack(L, 1) || - !Lua::PushModulePublic(out, L, "plugins.dig-now", "print_help") || - !Lua::SafeCall(out, L, 0, 0)) { - out.printerr("Failed to load dig-now Lua code\n"); - } -} - bool dig_now_impl(color_ostream &out, const dig_now_options &options) { if (!Maps::IsValid()) { out.printerr("Map is not available!\n"); @@ -880,18 +869,18 @@ command_result dig_now(color_ostream &out, std::vector ¶ms) { dig_now_options options; if (!get_options(out, options, params) || options.help) - { - print_help(out); - return options.help ? CR_OK : CR_FAILURE; - } + return CR_WRONG_USAGE; return dig_now_impl(out, options) ? CR_OK : CR_FAILURE; } DFhackCExport command_result plugin_init(color_ostream &, std::vector &commands) { - commands.push_back(PluginCommand( - "dig-now", "Instantly complete dig designations", dig_now, false)); + commands.push_back( + PluginCommand( + "dig-now", + "Instantly complete dig designations.", + dig_now)); return CR_OK; } diff --git a/plugins/lua/dig-now.lua b/plugins/lua/dig-now.lua index 2d7ae40d7..b3ffeb0bc 100644 --- a/plugins/lua/dig-now.lua +++ b/plugins/lua/dig-now.lua @@ -4,37 +4,6 @@ local argparse = require('argparse') local guidm = require('gui.dwarfmode') local utils = require('utils') -local short_help_text = [=[ - -dig-now -======= - -Instantly completes dig designations, modifying map tiles and creating boulders, -ores, and gems as if a miner were doing the mining or engraving. By default, all -dig designations on the map are completed and boulder generation follows -standard game rules, but the behavior is configurable. - -Usage: - - dig-now [ []] [] - -Examples: - -dig-now - Dig all designated tiles according to standard game rules. - -dig-now --clean - Dig designated tiles, but don't generate any boulders, ores, or gems. - -dig-now --dump here - Dig tiles and dump all generated boulders, ores, and gems at the tile under - the game cursor. - -See the online DFHack documentation for details on all options. -]=] - -function print_help() print(short_help_text) end - local function parse_coords(opts, configname, arg) local cursor = argparse.coords(arg, configname) utils.assign(opts[configname], cursor)