-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1138 from myk002/myk_occupancy
new tool: fix/occupancy
- Loading branch information
Showing
7 changed files
with
60 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
fix/occupancy | ||
============= | ||
|
||
.. dfhack-tool:: | ||
:summary: Fix phantom occupancy issues. | ||
:tags: fort bugfix map | ||
|
||
If you see "unit blocking tile", "building present", or "items occupying site" | ||
messages that you can't account for (:bug:`3499`), this tool can help. | ||
|
||
Usage | ||
----- | ||
|
||
:: | ||
|
||
fix/occupancy [<pos>] [<options>] | ||
|
||
The optional position can be map coordinates in the form ``0,0,0``, without | ||
spaces, or the string ``here`` to use the position of the keyboard cursor, if | ||
active. | ||
|
||
Examples | ||
-------- | ||
|
||
``fix/occupancy`` | ||
Fix all occupancy issues on the map. | ||
``fix/occupancy here`` | ||
Fix all occupancy issues on the tile selected by the keyboard cursor. | ||
``fix-unit-occupancy -n`` | ||
Report on, but do not fix, all occupancy issues on the map. | ||
|
||
Options | ||
------- | ||
|
||
``-n``, ``--dry-run`` | ||
Report issues, but do not write any changes to the map. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local argparse = require('argparse') | ||
local plugin = require('plugins.fix-occupancy') | ||
|
||
local opts = { | ||
dry_run=false, | ||
} | ||
|
||
local positionals = argparse.processArgsGetopt({...}, { | ||
{ 'h', 'help', handler = function() opts.help = true end }, | ||
{ 'n', 'dry-run', handler = function() opts.dry_run = true end }, | ||
}) | ||
|
||
if positionals[1] == 'help' or opts.help then | ||
print(dfhack.script_help()) | ||
return | ||
end | ||
|
||
if not positionals[1] then | ||
plugin.fix_map(opts.dry_run) | ||
else | ||
plugin.fix_tile(argparse.coords(positionals[1], 'pos'), opts.dry_run) | ||
end |
This file was deleted.
Oops, something went wrong.