update dig-now docs

develop
myk002 2022-07-22 17:46:33 -07:00
parent 675f2edee2
commit 4cb57d25f1
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
3 changed files with 28 additions and 68 deletions

@ -1,10 +1,15 @@
dig-now dig-now
======= =======
Instantly completes non-marker dig designations, modifying tile shapes and Tags:
creating boulders, ores, and gems as if a miner were doing the mining or :dfhack-keybind:`dig-now`
engraving. By default, the entire map is processed and boulder generation
follows standard game rules, but the behavior is configurable. :index:`Instantly complete dig designations.
<dig-now; 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 Note that no units will get mining or engraving experience for the dug/engraved
tiles. tiles.
@ -25,37 +30,34 @@ that coordinate is processed.
Any ``<pos>`` parameters can either be an ``<x>,<y>,<z>`` triple (e.g. Any ``<pos>`` parameters can either be an ``<x>,<y>,<z>`` triple (e.g.
``35,12,150``) or the string ``here``, which means the position of the active ``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: Examples:
``dig-now`` - ``dig-now``
Dig designated tiles according to standard game rules. Dig designated tiles according to standard game rules.
- ``dig-now --clean``
``dig-now --clean`` Dig all designated tiles, but don't generate any boulders, ores, or gems.
Dig 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
``dig-now --dump here`` under the game cursor.
Dig tiles and dump all generated boulders, ores, and gems at the tile under
the game cursor.
Options: Options:
:``-c``, ``--clean``: - ``-c``, ``--clean``
Don't generate any boulders, ores, or gems. Equivalent to Don't generate any boulders, ores, or gems. Equivalent to
``--percentages 0,0,0,0``. ``--percentages 0,0,0,0``.
:``-d``, ``--dump <pos>``: - ``-d``, ``--dump <pos>``
Dump any generated items at the specified coordinates. If the tile at those 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 coordinates is open space or is a wall, items will be generated on the
closest walkable tile below. closest walkable tile below.
:``-e``, ``--everywhere``: - ``-e``, ``--everywhere``
Generate a boulder, ore, or gem for every tile that can produce one. Generate a boulder, ore, or gem for every tile that can produce one.
Equivalent to ``--percentages 100,100,100,100``. Equivalent to ``--percentages 100,100,100,100``.
:``-h``, ``--help``: - ``-p``, ``--percentages <layer>,<vein>,<small cluster>,<deep>``
Show quick usage help text.
:``-p``, ``--percentages <layer>,<vein>,<small cluster>,<deep>``:
Set item generation percentages for each of the tile categories. The Set item generation percentages for each of the tile categories. The
``vein`` category includes both the large oval clusters and the long stringy ``vein`` category includes both the large oval clusters and the long stringy
mineral veins. Default is ``25,33,100,100``. mineral veins. Default is ``25,33,100,100``.
:``-z``, ``--cur-zlevel``: - ``-z``, ``--cur-zlevel``
Restricts the bounds to the currently visible z-level. Restricts the bounds to the currently visible z-level.

@ -838,17 +838,6 @@ static bool get_options(color_ostream &out,
return true; 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) { bool dig_now_impl(color_ostream &out, const dig_now_options &options) {
if (!Maps::IsValid()) { if (!Maps::IsValid()) {
out.printerr("Map is not available!\n"); out.printerr("Map is not available!\n");
@ -880,18 +869,18 @@ command_result dig_now(color_ostream &out, std::vector<std::string> &params) {
dig_now_options options; dig_now_options options;
if (!get_options(out, options, params) || options.help) if (!get_options(out, options, params) || options.help)
{ return CR_WRONG_USAGE;
print_help(out);
return options.help ? CR_OK : CR_FAILURE;
}
return dig_now_impl(out, options) ? CR_OK : CR_FAILURE; return dig_now_impl(out, options) ? CR_OK : CR_FAILURE;
} }
DFhackCExport command_result plugin_init(color_ostream &, DFhackCExport command_result plugin_init(color_ostream &,
std::vector<PluginCommand> &commands) { std::vector<PluginCommand> &commands) {
commands.push_back(PluginCommand( commands.push_back(
"dig-now", "Instantly complete dig designations", dig_now, false)); PluginCommand(
"dig-now",
"Instantly complete dig designations.",
dig_now));
return CR_OK; return CR_OK;
} }

@ -4,37 +4,6 @@ local argparse = require('argparse')
local guidm = require('gui.dwarfmode') local guidm = require('gui.dwarfmode')
local utils = require('utils') 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 [<pos> [<pos>]] [<options>]
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 function parse_coords(opts, configname, arg)
local cursor = argparse.coords(arg, configname) local cursor = argparse.coords(arg, configname)
utils.assign(opts[configname], cursor) utils.assign(opts[configname], cursor)