autounlock overhaul

This gives the player more control over what autounlock does.  It is
now a compound option rather than a boolean, and takes values of
  autounlock:none
  !autounlock or noautounlock (shortcuts for none)
  autounlock:untrap + apply-key + kick + force (spaces are optional
    or can be used instead of plus-signs, but can't mix "foo bar+quux")
  autounlock (without a value, shortcut for autounlock:apply-key).
Default is autounlock:apply-key.

Untrap isn't implemented (feel free to jump in) so is suppressed from
the 'O' command's new sub-menu for autounlock.  It's parsed and
accepted from .nethackrc but won't accomplish anything.

[Just musing: it should be feasible to kick in direction '.' to break
open a container or #force to an adjacent spot to break open a door.
If that was done, autounlock:kick+force (or more likely autounlock:
apply-key+kick+force when lacking a key) would resort to force if hero
couldn't kick due to wounded legs or riding.

This changes struct flags so increments EDITLEVEL again.

This includes pull requests #750 from entrez and #751 from FIQ but was
entered from scratch rather than using use their commits.

Closes #750
Closes #751
This commit is contained in:
PatR
2022-05-04 19:13:28 -07:00
parent d1b14e08c4
commit 44d5be6eb4
9 changed files with 282 additions and 31 deletions

View File

@@ -3970,9 +3970,31 @@ If no weapon is found or the option is
false, the `t' (throw) command is executed instead. Persistent.
%.lp
\item[\ib{autounlock}]
Walking into a locked door or looting a locked container while carrying
an unlocking tool (such as a key) will ask whether to use that tool to
unlock the door or container (default true).
Controls what action to take when attempting to walk into a locked door
or to loot a locked container.
Takes a plus-sign separated list of values:
{\it apply-key\/} which will attempt to use a key or other unlocking tool
if you have one;
{\it kick\/} which will kick the door (if you lack a key or omit apply-key;
has no effect on containers);
{\it force\/} which will try to force a container's lid with your currently
wielded weapon (if you lack a key or omit apply-key; has no effect on
doors); or
{\it none\/} which can't be combined with the other choices.
\\
%.lp ""
Omitting the value is treated as if {\tt autounlock:apply-key}.
Preceding {\tt autounlock} with `{\tt !}' or ``{\tt no}'' is treated as
{\tt autounlock:none}.
\\
%.lp ""
Applying a key might set off a trap if the door or container is trapped.
Successfully kicking a door will break it and wake up nearby monsters.
Successfully forcing a container open will break its lock and might also
destroy some of its contents or damage your weapon or both.
\\
%.lp ""
The default is {\it apply-key\/}.
Persistent.
%.lp
\item[\ib{blind}]