Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[probe] clean up and update #4256

Merged
merged 4 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading