autounlock:untrap

Implement 'untrap' as an 'autounlock' action.  Quite a bit more work
than anticipated.  The new documentation is rather clumsy; too many
if-this and if-not-that clauses have intruded.

I'll be astonished if all the return values are correct....

[A couple of places were checking for (rx != 0 && ry != 0) to decide
whether they were performating an autounlock action at <rx,ry> but
that erroneously excludes the top line of the map if the current
level extends that far.  Just check rx for zero/non-zero.]
This commit is contained in:
PatR
2022-05-06 14:44:57 -07:00
parent a31dd26d8a
commit 02207b967a
10 changed files with 268 additions and 126 deletions

View File

@@ -3662,15 +3662,26 @@ Persistent.
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:
\fIapply-key\fP which will attempt to use a key or other unlocking tool
if you have one;
\fIkick\fP which will kick the door (if you lack a key or omit apply-key;
.PS Apply-Key
.PL Untrap
prompt about whether to attempt to find a trap;
it might fail to find one even when present; if it does find one, it
will ask whether you want to try to disarm the trap; if you decline,
your character will forget that the door or box is trapped;
.PL Apply-Key
if carrying a key or other unlocking tool, prompt about using it;
.PL Kick
kick the door (if you omit untrap or decline to attempt untrap and
you omit apply-key or you lack a key or you decline to use the key;
has no effect on containers);
\fIforce\fP 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
\fInone\fP which can't be combined with the other choices.
.lp ""
.PL Force
try to force a container's lid with your currently
wielded weapon (if you omit untrap or decline to attempt untrap and
you omit apply-key or you lack a key or you decline to use the key;
has no effect on doors);
.PL None
none of the above; can't be combined with the other choices.
.PE
Omitting the value is treated as if \f(CRautounlock:apply-key\fP.
Preceding \f(CRautounlock\fP with \(oq!\(cq or \(lqno\(rq is treated as
\f(CRautounlock:none\fP.
@@ -3680,7 +3691,7 @@ 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 \fIapply-key\fP.
The default is Apply-Key.
Persistent.
.lp blind
Start the character permanently blind (default false).

View File

@@ -3970,19 +3970,42 @@ If no weapon is found or the option is
false, the `t' (throw) command is executed instead. Persistent.
%.lp
\item[\ib{autounlock}]
%\hyphenation{apply\-key}%this needs to be tested...
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;
% paranoid
% au => autounlock
\newlength{\auwidth}
%.PS Apply-Key
\settowidth{\auwidth}{\tt Apply-Key}
\addtolength{\auwidth}{\labelsep}
\blist{\leftmargin \auwidth \topsep 1mm \itemsep 0mm}
%.PL Untrap
\item[{\tt Untrap}]
prompt about whether to attempt to find a trap;
it might fail to find one even when present; if it does find one, it
will ask whether you want to try to disarm the trap; if you decline,
your character will forget that the door or box is trapped;
%.PL Apply-Key
\item[{\tt Apply-Key}]
if carrying a key or other unlocking tool, prompt about using it;
%.PL Kick
\item[{\tt Kick}]
kick the door (if you omit untrap or decline to attempt untrap and
you omit apply-key or you lack a key or you decline to use the 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 ""
%.PL Force
\item[{\tt Force}]
try to force a container's lid with your currently
wielded weapon (if you omit untrap or decline to attempt untrap and
you omit apply-key or you lack a key or you decline to use the key;
has no effect on doors);
%.PL None
\item[{\tt None}]
none of the above; can't be combined with the other choices.
%.PE
\elist
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}.
@@ -3994,7 +4017,7 @@ 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\/}.
The default is Apply-Key.
Persistent.
%.lp
\item[\ib{blind}]

View File

@@ -1197,6 +1197,7 @@ using #wizmakemap on Plane of Water added a new set of air bubbles each time
it was run and eventually replaced just about all the water; likewise
with clouds on Plane of Air
avoid new "where are we?" panic if player quits during character selection
add Untrap as a potential 'autounlock' action
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support