A dump of #2803 (Corpse)

@create #9338 named generic corpse:generic corpse,corpse
@prop #2803."help_msg" {} rc
;;#2803.("help_msg") = {" ", "-- Brief overview of properties and verbs.", " ", ".victim       -- Who is this pile of worm meal?", ".time_of_death        -- When victim expired.", " ", ":set_victim(victim)    -- What it says.", ":accept(what)          -- Only accept objects on victim's person.", ":rot()                 -- Get rid of the corpse.", ":look_self()           -- Maybe show how long it's been dead.", ":tell_contents()       -- Neat display of loot."}
@prop #2803."victim" #-1 r
@prop #2803."time_of_death" 949683881 r
@prop #2803."is_corpse" 1 r
"#2803.("lookers") => E_PERM (Permission denied)
;;#2803.("store_action") = "store"
;;#2803.("manufactured") = 923451666
;;#2803.("worth") = -1
;;#2803.("condition") = E_NONE
;;#2803.("odrop_failed_msg") = "%<tries> to drop %t but fails!"
;;#2803.("odrop_succeeded_msg") = "%<drops> %t."
;;#2803.("otake_succeeded_msg") = "%<picks> up %t."
"#2803.("key") => E_PERM (Permission denied)
;;#2803.("aliases") = {"generic corpse", "corpse"}
;;#2803.("description") = "The prototype of all festering corpses.  Man--it really stinks."
;;#2803.("object_size") = {6122, 1141286558}

@verb #2803:"set_victim" this none this
@program #2803:set_victim
":set_victim(OBJ character)";
"Set whose soul this corpse previously contained.";
if (!$local.rpg:trusted(caller_perms()))
  return E_PERM;
else
  return this.victim = args[1];
endif
.

@verb #2803:"accept" this none this rx
@program #2803:accept
"Accept items from `victim', or those belonging to victim's owner.";
return ((!valid(victim = this.victim)) || (args[1].location == victim)) || $perm_utils:controls(victim.owner, args[1]);
.

@verb #2803:"rot_msg" this none this
@program #2803:rot_msg
":rot_msg() -- Messaged displayed when this corpse rots.";
return this:title() + " collapses into dust and blows away in the wind.";
.

@verb #2803:"look_self" this none this
@program #2803:look_self
pass(@args);
saw = 0;
time = time();
recent = 0;
newlookers = {};
for n in (this.lookers)
  if (n[2] > (time - 600))
    if (n[1] == player)
      recent = 1;
      saw = n[3];
    else
      newlookers = {@newlookers, n};
    endif
  endif
endfor
if ((!recent) && ($local.rpg:resolve(player, "notice", -35) > 0))
  saw = 1;
endif
this.lookers = {@newlookers, {player, time, saw}};
if (saw)
  player:tell("Your master forensic sense tells you that the unfortunate victim has been dead for about ", $string_utils:from_seconds(time() - this.time_of_death), ".");
else
  player:tell("Thousands of hours of `Quincy' reruns tell you that the unfortunate victim has been dead for about ", $string_utils:from_seconds(random(time())), ".");
endif
.

@verb #2803:"tell_contents" this none this
@program #2803:tell_contents
":tell_contents([contents]) -- Show the loot.";
if (c = args ? args[1] | this:contents())
  player:tell("Scattered around and upon the dead body you spot ", $string_utils:title_list(c), ".");
else
  player:tell("Hmm.  No loot around.  Maybe you CAN take it with you.");
endif
"Quinn 01-DEC-93 0407: Added provision for no loot.";
.

@verb #2803:"rot" this none this rx
@program #2803:rot
":rot_corpse() -- Rot this corpse and all it contains.";
rpg = $local.rpg;
if (!rpg:trusted(caller_perms()))
  return E_PERM;
endif
rpg:rpg_announce_all(this.location, this:rot_msg());
stickit = rpg.cemetery;
for loot in (this:contents())
  loot:moveto(stickit);
endfor
if (this.owner != rpg.owner)
  this:moveto($nothing);
elseif (verbs(this) || properties(this))
  return E_NACC;
else
  rpg.recycler:_recycle(this);
endif
"StarDancer 2-DEC-95 changed line 7 so all the stuff on the corpse goes to #1131. Also put :room_announce inside a fork so's it won't die if there're too many Ahabs inna room.";
"Profane 1-DEC-96 1225PST -- nuke fork, put in rpg_announce_all";
.

@verb #2803:"maybe_rot" this none this rx
@program #2803:maybe_rot
":maybe_rot()";
"Rot if the .victim belonging to this corpse is .alive.";
if (this.victim.alive || (this.victim.body != this))
  fork (0)
    this:rot();
  endfork
endif
.

@verb #2803:"notify_arrival" this none this rx
@program #2803:notify_arrival
":notify_arrival(who, exit)";
this:maybe_rot();
return pass(@args);
.

"***finished***