A dump of #11286 (Secure Exit)

@create #3736 named Secure Exit:Secure Exit
@prop #11286."free_entry" 0 rc
"#11286.("key") => E_PERM (Permission denied)
;;#11286.("aliases") = {"Secure Exit"}
;;#11286.("object_size") = {6272, 1141286561}

@verb #11286:"is_unlocked_for" this none this rx
@program #11286:is_unlocked_for
{what} = args;
c = `$perm_utils:caller() ! E_RANGE => this';
cannot_walk = ((!is_player(what)) && (what in $local.rpg.pcs)) ? what.doll:cannot_walk() | 0;
return ((!cannot_walk) && pass(what)) && ((((((this.free_entry || (((typeof(this.dest) == OBJ) && valid(this.dest)) && this.dest:accept(what))) || (((typeof(this.source) == OBJ) && valid(this.source)) && ((this.source == what.location) || this.source:accept(what)))) || (c[1] == this.source)) || (c[3] == this.owner)) || (what.owner in {this.owner, this.source.owner, this.dest.owner})) || what.owner.wizard);
"Profane (#30788) - Sat May 22, 1999 - trap for E_RANGE";
"THX (#105941) - Thu Oct 14, 1999 - Put a hack in for monster.doll:cannot_walk() for the AHaBs.";
.

@verb #11286:"move" this none this
@program #11286:move
{what} = args;
rpg = $local.rpg;
if ((this.owner in rpg.gms) && ((caller == this) || (caller_perms() in rpg.gms)))
  if (is_player(what))
    old = what.location;
    if (valid(doll = rpg:get_doll(what)))
      "doll:invite(doll.slowness, {7})";
      doll:check_schedule();
      if (p = doll:cannot_walk())
        return rpg:playertell(what, (typeof(p) == STR) ? p | "You're paralyzed and can't possibly go anywhere.");
      elseif ((doll.last_attack > time()) && (!(rpg.magic_db.rf_combat_effect in doll.combat_effects)))
        reject_msg = "a recent mental shock";
        if ((note = doll:read_misc_note("teleport lag")) == E_PROPNF)
        elseif (note > time())
          reject_msg = "your recent use of LambdaMOO teleportation";
        else
          doll:erase_misc_note("teleport lag");
        endif
        return rpg:playertell(what, "You are still disoriented from ", reject_msg, " and cannot negotiate an exit.");
      endif
    endif
    rpg.object_db.wandering_option_monster_heart:heartbeat();
    if (((what.location == old) && (old == this.source)) && this:check_move(what))
      pass(what);
    endif
  elseif ((what in rpg.pcs) || (caller_perms() in rpg.gms))
    if (!valid(what.location))
      what:moveto(rpg.cemetery);
    elseif (rpg.object_db:is_rpg_room(this.dest))
      "... ok living critter is heading for another LRPG room ...";
    else
      return E_PERM;
    endif
    rpg:s_i_n();
    `what:do_the_move(this) ! ANY => pass(what)';
    rpg.clock:check_schedule(what);
  endif
elseif (what.location == this.source)
  if ((is_player(what) && (what == player)) || ((what.owner == player) && (!(what.owner in rpg.gms))))
    pass(what);
  else
    return E_PERM;
  endif
else
  return E_PERM;
endif
"9/27/95 Quinn -- Rewrote initial perms to disallow movement of RPG objects by untrusted individuals.";
"Irin Thu Nov 21 15:49:00 1996 PST -- Paralyze check.";
"Irin Sun Jan 26 14:07:36 1997 PST sub /(caller_perms() != what)/caller != this/3 ";
"THX 1-Apr-1997 --  added a check for location validity so that monsters go to the cemetery before using the exit if they are in $nowhere ... this avoids a TB from the exit messaging.";
"Profane (#30788) - Mon Oct  6 18:23:48 1997 PDT - Check for exit ownership";
"THX (#105941) - Mon Nov 22, 1999 - Allow player-owned secure exits to work, but only on objects in the .source that are owned by player and not non-player gm-owned objects.";
"THX (#105941) - Sat Apr 21, 2001 - Trigger rpg.clock:check_schedule() when a critter uses the exit.  Trigger the GWOM heart:heartbeat() when a player uses the exit.";
.

@verb #11286:"make_fertile" this none this
@program #11286:make_fertile
":make_fertile() -- Temporarily toggles the 'f' bit, allowing GMs (and not builders in general) to create a child of adventure gear.  To be used as follows:";
";;#equipment:make_fertile();return player:_create(#equipment)";
"Where '#equipment' is the number of the object you're wanting to create.  The blank object returned will be your child.  Congratulations, Mommy.";
if ($local.rpg:trusted(caller_perms()))
  if (!this.f)
    this.f = 1;
    fork (0)
      this.f = 0;
    endfork
  endif
  return this.f;
endif
"Quinn 09-JUL-93 0343: Changed :trust call to :trusted(caller_perms()); Updated comment lines;  eliminated check for ownership in first 'if'.  Let it crash if a kid not owned by GM uses the parent; Now returns status of f-bit.";
.

@verb #11286:"check_move" this none this
@program #11286:check_move
"Hook for exit specific stuff.";
{what} = args;
rpg = $local.rpg;
if (((what in rpg.check_player) && (this.owner == rpg.owner)) && (caller_perms() in rpg.gms))
  oldest = this.dest;
  this.dest = rpg.player_start;
  fork (0)
    this.dest = oldest;
    (what.location == rpg.player_start) && (rpg.check_player = setremove(rpg.check_player, what));
  endfork
endif
return 1;
.

@verb #11286:"announce_msg" this none this
@program #11286:announce_msg
":announce_msg(place, what, msg)";
"  announce msg in place (except to what). Prepend with what:title if it isn't part of the string";
{place, what, msg} = args;
rpg = $local.rpg;
if ((caller == this) || (caller_perms() in rpg.gms))
  (what in `(dest = this.dest).unannounced ! ANY => {}') && (dest.unannounced = setremove(dest.unannounced, what));
  title = what:titlec();
  $string_utils:index_delimited(msg, title) || (msg = tostr(title, " ", msg));
  rpg:rpg_announce_all_but(place, {what}, msg);
endif
.

"***finished***