--------------------------------------------------------------------------------
This is a simple little snippet to let your players open and unlock doors
automatically. No credit of any kind is due, so just enjoy it.
-- Midboss (eclipsing.souls@gmail.com)
-------------------------------------------------------------------------merc.h-
Add this to your PLR_* defines:
#define PLR_AUTODOOR (bb)
Change the bitvector if you have to.
---------------------------------------------------------------------act_move.c-
In move_char, find:
if (IS_SET (pexit->exit_info, EX_CLOSED)
&& IS_SET (pexit->exit_info, EX_NOPASS)
&& !IS_TRUSTED (ch, ANGEL))
{
act ("The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR);
return;
}
And replace it with:
if (IS_SET (pexit->exit_info, EX_CLOSED))
{
if (IS_SET (ch->act, PLR_AUTODOOR))
{
if (IS_SET (pexit->exit_info, EX_LOCKED))
do_unlock (ch, pexit->keyword[0] != '\0' ?
pexit->keyword : dir_name[door]);
if (!IS_SET (pexit->exit_info, EX_LOCKED))
do_open (ch, pexit->keyword[0] != '\0' ?
pexit->keyword : dir_name[door]);
if (IS_SET (pexit->exit_info, EX_CLOSED)
|| (IS_SET (pexit->exit_info, EX_NOPASS)
&& !IS_TRUSTED (ch, ANGEL)))
{
act ("You can't get through the $d.",
ch, NULL, pexit->keyword, TO_CHAR);
return;
}
}
else
{
act ("The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR);
return;
}
}
----------------------------------------------------------------------handler.c-
Add this to the second half of act_bit_name:
if (act_flags & PLR_AUTODOOR)
strcat (buf, " autodoor");
-----------------------------------------------------------------------tables.c-
Add this to the table plr_flags:
{"autodoor", bb, FALSE},
Again, change the bitvector to suit your MUD.
---------------------------------------------------------------------act_info.c-
In do_autolist, somewhere among the auto displays, add:
send_to_char ("autodoor ", ch);
if (IS_SET (ch->act, PLR_AUTODOOR))
send_to_char ("{GON{x\n\r", ch);
else
send_to_char ("{ROFF{x\n\r", ch);
Now, add this command to act_info.c:
void do_autodoor (CHAR_DATA * ch, char *argument)
{
if (IS_NPC (ch))
return;
if (IS_SET (ch->act, PLR_AUTODOOR))
{
send_to_char ("You will no longer open doors automatically.\n\r", ch);
REMOVE_BIT (ch->act, PLR_AUTODOOR);
}
else
{
send_to_char ("You will now open doors automatically.\n\r", ch);
SET_BIT (ch->act, PLR_AUTODOOR);
}
}
---------------------------------------------------------------------interp.c/h-
Add this to the bottom of interp.h:
DECLARE_DO_FUN( do_autodoor );
And this with your other auto commands in interp.c's cmd_table:
{"autodoor", do_autodoor, POS_DEAD, 0, LOG_NORMAL, 1},
--------------------------------------------------------------------------------