Skip to content

Commit

Permalink
Merge pull request #4256 from myk002/myk_probe
Browse files Browse the repository at this point in the history
[probe] clean up and update
  • Loading branch information
myk002 authored Feb 8, 2024
2 parents 1b5b928 + 240b984 commit 4953e7e
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 282 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Template for new versions:
## Fixes

## Misc Improvements
- `probe`: act on the selected building/unit instead of requiring placement of the keyboard cursor for ``bprobe`` and ``cprobe``

## Documentation

Expand Down
27 changes: 19 additions & 8 deletions docs/plugins/probe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@ probe
Usage
-----

``probe``
Displays properties of the tile selected with :kbd:`k`. Some of these
properties can be passed into `tiletypes`.
``probe [<options>]``
Displays properties of the tile highlighted with the keyboard cursor or at
the specified coordinates. If you do not have a keyboard cursor visible,
enter a mode that shows the keyboard cursor (like mining mode). If the
keyboard cursor is still not visible, hit Alt-k to invoke
`toggle-kbd-cursor`.
``bprobe``
Displays properties of the building selected with :kbd:`q` or :kbd:`t`.
For deeper inspection of the building, see `gui/gm-editor`.
Displays properties of the selected building. For deeper inspection of the
building, see `gui/gm-editor`.
``cprobe``
Displays properties of the unit selected with :kbd:`v`. It also displays the
IDs of any worn items. For deeper inspection of the unit and inventory items,
see `gui/gm-unit` and `gui/gm-editor`.
Displays properties of the selected unit. It also displays the IDs of any
worn items. For deeper inspection of the unit and inventory items, see
`gui/gm-unit` and `gui/gm-editor`.

Options
-------

``-c``, ``--cursor <x>,<y>,<z>``
Use the specified map coordinates instead of the current keyboard cursor.
If this option is specified, then an active keyboard cursor is not
necessary.
2 changes: 1 addition & 1 deletion plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ if(BUILD_SUPPORTED)
#dfhack_plugin(petcapRemover petcapRemover.cpp)
#dfhack_plugin(plants plants.cpp)
dfhack_plugin(preserve-tombs preserve-tombs.cpp)
dfhack_plugin(probe probe.cpp)
dfhack_plugin(probe probe.cpp LINK_LIBRARIES lua)
dfhack_plugin(prospector prospector.cpp LINK_LIBRARIES lua)
#dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua)
dfhack_plugin(regrass regrass.cpp)
Expand Down
14 changes: 14 additions & 0 deletions plugins/lua/probe.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local _ENV = mkmodule('plugins.probe')

local argparse = require('argparse')

function parse_commandline(...)
local cursor = nil
argparse.processArgsGetopt({...}, {
{'c', 'cursor', hasArg=true,
handler=function(optarg) cursor = argparse.coords(optarg) end},
})
return cursor
end

return _ENV
Loading

0 comments on commit 4953e7e

Please sign in to comment.