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

@@ -124,8 +124,11 @@ opt_##a,
set_in_game, No, Yes, No, NoAlias, "edit autopickup exceptions")
NHOPTB(autoquiver, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
&flags.autoquiver)
NHOPTB(autounlock, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
&flags.autounlock)
NHOPTC(autounlock,
(sizeof "none" + sizeof "untrap" + sizeof "apply-key"
+ sizeof "kick" + sizeof "force" + 20),
opt_out, set_in_game, Yes, Yes, No, Yes, NoAlias,
"action to take when encountering locked door or chest")
#if defined(MICRO) && !defined(AMIGA)
NHOPTB(BIOS, 0, opt_in, set_in_config, Off, Yes, No, No, NoAlias,
&iflags.BIOS)