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

[item] don't match spider webs #1120

Merged
merged 2 commits into from
May 16, 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 changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Template for new versions:
## New Features

## Fixes
- `item`: don't match uncollected spider webs when you search for "silk"

## Misc Improvements

Expand Down
3 changes: 3 additions & 0 deletions docs/item.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ Options
``--include-owned``
Include items owned by units (e.g., your dwarves or visitors)

``--ignore-webs``
Ignore undisturbed spider webs.

``-i``, ``--inside <burrow>``
Only include items inside the given burrow.

Expand Down
5 changes: 4 additions & 1 deletion item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ end

--- @param action "melt"|"unmelt"|"forbid"|"unforbid"|"dump"|"undump"|"count"|"hide"|"unhide"
--- @param conditions conditions
--- @param options { help : boolean, artifact : boolean, dryrun : boolean, bytype : boolean, owned : boolean, verbose : boolean }
--- @param options { help : boolean, artifact : boolean, dryrun : boolean, bytype : boolean, owned : boolean, nowebs : boolean, verbose : boolean }
--- @param return_items boolean|nil
--- @return number, item[], table<number,number>
function execute(action, conditions, options, return_items)
Expand All @@ -219,6 +219,7 @@ function execute(action, conditions, options, return_items)
(item.flags.artifact and not options.artifact) or
item.flags.on_fire or
item.flags.trader or
(item.flags.spider_web and options.nowebs) or
(item.flags.owned and not options.owned)
then
goto skipitem
Expand Down Expand Up @@ -343,6 +344,7 @@ local options = {
dryrun = false,
bytype = false,
owned = false,
nowebs = false,
verbose = false,
}

Expand Down Expand Up @@ -370,6 +372,7 @@ local positionals = argparse.processArgsGetopt({ ... }, {
{ 'v', 'verbose', handler = function() options.verbose = true end },
{ 'a', 'include-artifacts', handler = function() options.artifact = true end },
{ nil, 'include-owned', handler = function() options.owned = true end },
{ nil, 'ignore-webs', handler = function() options.nowebs = true end },
{ 'n', 'dry-run', handler = function() options.dryrun = true end },
{ nil, 'by-type', handler = function() options.bytype = true end },
{ 'i', 'inside', hasArg = true,
Expand Down