Re: 2 things...

From: Skylar (skylar@ifconfig.intserv.com)
Date: 07/17/96


On Tue, 16 Jul 1996, Melen wrote:

> 1) I would like ALL objects to deteriorate, like corpses do. I mean, I 
> hate seeing an object in a room 3 hours after the person dropped it and 
> left the game. It's annoying. I'd like the object to crumble after a 
> period of time (except like the donation rooms) without having to flag them.

You're going to need SOME way to differentiate the objects that should be
crumbling, or maybe the ones that should NOT crumble perhaps... it would
be pretty tough to do without using any flags like ITEM_BIO or ITEM_NOBIO.
If you dont have something like that, stuff like boards, signs, chests and
gold in treasure rooms... all that will crumble as well.  I guess you could
probably avoid flagging by doing some madness like setting objects which
are loaded into rooms to a timer of -1 or something like that... all other
obj's should get their timer's set to something pretty high, so you can use
that to count down to when they crumble...


Anyways, if you solve that problem, the crumble part is pretty easy...
you can simply make an object_activity() function, pretty much like 
the mobile_activity function... somewhere near the top of it, check if 
the object's in_room != NOWHERE (which is equipment, inventory or in_obj),
then, check the in_room for whatever no-crumble flag you're using for
donation rooms (houses would be a good place for it too) - if the obj
is not in NOWHERE, and not in a flagged room, decrease the timer by 1.
A little later in that same object_activity() function, just check the
timers and if they are == 0 then crumble and extract them.

The object_activity() function you write can also be useful for doing
other silly things, like making objects with the HUM flag emit a sound,
or ones with the GLOW flag flicker...


Here's what the top of my object_activity() looks like, I'm not using it
to wholesale massacre every obj on the ground, but you can probably tweak
it to suit your needs...

-snip-
void object_activity(void)
{
  struct obj_data *obj;
  int room;

  for (obj = object_list; obj; obj = obj->next) {
    if (GET_OBJ_TIMER(obj) > 0)
      GET_OBJ_TIMER(obj) --;
      if (IS_OBJ_STAT(obj, ITEM_BIO) && (!GET_OBJ_TIMER(obj))) {
          act("$p decays into gritty debris and blows away.",
                                      0, 0, obj, 0, TO_ROOM);
          extract_obj(obj);
      }
-snip



-Sky



This archive was generated by hypermail 2b30 : 12/07/00 PST