Re: Item Decay

From: Lars (lars@temperedweaves.com)
Date: 03/20/02


Objects are already equipped with a timer (GET_OBJ_TIMER(obj))... on
mine, in limits.c I think, where it checks the timer for a corpse, I put
more in it to add to the timer (providing for object degeneration),
every time it runs through that... something to this affect happens

if (!(IS_CORPSE(obj)) {
if ([item_in_inv])
  GET_OBJ_TIMER(obj) += 1;
if ([item_in_eq])
  GET_OBJ_TIMER(obj) += 2;
if ([item_in_room])
  GET_OBJ_TIMER(obj) += 1;

if (GET_OBJ_TIMER(obj) > [set your limit for objs in room] &&
[item_in_room]) {
  extract_obj(obj);
else if (GET_OBJ_TIMER(obj) > [set your limit for obj degen]) {
  obj_from_char(ch, obj);
  extract_obj(obj);
  send_to_char("The item crumbles into dust.\r\n", ch);
}
}
Now that's highly paraphrased and I'm not sure the syntax is entirely
correct off the top of my head, but you get the idea... I'm sure mine
isn't the prettiest in the world, but it's worked good for me for more
than a year now, and provides object degeneration and cleanup.  (you
would want to put a check in there to avoid cleaning the donation room
probably, and maybe add something to show_obj_to_char that will report
the condition of the object)

Lars


>
>
>Was thinking that Items should have decay timer set on them so that
>after a period of time if no one has picked it up out of the room then
>it gets extracted and no longer takes up memory.
>This of course would only apply to items put in the room by players or
>from a corpse decaying. The timer would be reset any time the object is
>picked up. While there are janitor and scavenger procs the mobs that
>they are set on may not be in every zone and may not hit every room.
>
>Yeah I suppose memory use really isn't much of a problem on small muds
>but large muds it would probably be more of an issue. Anyways wouldn't
>be all that hard to add as i've already done a quick hack to do it (but
>not the best way to do it) and would make a nice memory friendly
>addition to the code base.
>
>Ron
>

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT