This is a snippet file produced by Jeff Maxx, owner of the Lands of Altanos(c)
for usage in your MUD. This snippet will add grenades into your MUD, so that you
can create an object with the type grenade, and set its damage done, and timer
until it explodes after being pulled. You can find Jeff Maxx's website at the
following URL: http://altanos.trealms.org.

In merc.h along with the other pulses add the following line:

#define PULSE_GRENADE           ( 1 * PULSE_PER_SECOND)    /* Jeff Maxx */

Later, In the definitions of itemtypes, under ITEM_JUKEBOX, add:

#define ITEM_GRENADE               36

Later, underneath the PLR flag definitions, add:

/* grenade states - Jeff Maxx */
#define GRENADE_NOTPULLED   0
#define GRENADE_PULLED      1

In update.c among the local functions, add:

void  grenade_update     args(( void ));

Later in the file, before the obj_update function, add:

In act_obj.c in the get_obj function, add:

    if ( obj->value[1] = GRENADE_PULLED )
    {
      if ( obj->item_type == ITEM_GRENADE )
      {
       send_to_char("ARE YOU CRAZY OR SOMETHING???!?!?!?\n\r",ch);
       return;
      }
    }

/*
* Update all grenades. -Jeff Maxx
*/
void grenade_update( void )
{
    OBJ_DATA *obj;
    OBJ_DATA *obj_next;
    CHAR_DATA *vch;
    char buf[MSL];

    for ( obj = object_list; obj != NULL; obj = obj_next )
    {
	obj_next = obj->next;

      if ( obj->item_type != ITEM_GRENADE )
       continue;

      if ( obj->value[1] == GRENADE_PULLED )
      {
        if ( obj->value[0] > 0 )
        {
          for (vch = obj->in_room->people; vch != NULL; vch = 
vch->next_in_room)
          {
           sprintf( buf, "{Y%s{Y ticks quietly here.{x\n\r", 
capitalize(obj->short_descr));
           obj->value[0]--;
           send_to_char(buf,vch);
           return;
          }
        }
        for (vch = obj->in_room->people; vch != NULL; vch = 
vch->next_in_room)
        {
        sprintf( buf, "{R%s{R is consumed in flames as it 
EXPLODES!{x\n\r",capitalize(obj->short_descr));
        send_to_char(buf,vch);
        sprintf( buf, "{rYou are struck by the shrapnel!{x\n\r");
        send_to_char(buf,vch);
	  damage(vch,vch,obj->value[2],0,DAM_NEGATIVE,FALSE);
	  extract_obj( obj );
        }
      }
    }

    return;
}

In the update_handler function, near the beginning with the other static 
ints, add:

    static  int     pulse_grenade;

Along with the other countdowns similar to this one, add the following 
lines:

    if ( --pulse_grenade <= 0 )
    {
      pulse_grenade     = PULSE_GRENADE;
      grenade_update    ( );
    }

In db.c, in the create_object function, under case ITEM_GEM, add:

    case ITEM_GRENADE:

Now, if you don't have OLC you can forget about the next part, make clean 
and
add a grenade into one of your area files for testing.
Otherwise, read the next few steps to add grenades to OLC as well.

In show_obj_values in olc_act.c, add along with the other CASE: ITEM_....'s:

          case ITEM_GRENADE:
           sprintf( buf,
            "[v0] Timer           [%d]\n\r"
            "[v1] Unused          [?]\n\r"
            "[v2] Damage          [%d]\n\r"
            "[v3] Unused          [?]\n\r",
		obj->value[0],
		obj->value[2]);
	    send_to_char( buf, ch );
	    break;

Later in olc_act.c, in the set_obj_values function, add the following:

        case ITEM_GRENADE:
	    switch ( value_num )
	    {
	        default:
		    do_help( ch, "ITEM_GRENADE" );
	            return FALSE;
              case 0:
                  send_to_char( "TIMER SET.\n\r\n\r", ch);
                  pObj->value[0] = atoi( argument );
                  break;
	        case 2:
	            send_to_char( "DAMAGE SET.\n\r\n\r", ch );
	            pObj->value[2] = atoi( argument );
	            break;
	    }
            break;

Thank you for reading my work. Working on altanos for eight years really got me
revved up to take a break and do something less strictly midieval. So I
downloaded Fast_Rom and did a few new things. Since I couldn't care less for my
work on the wee rom mud, I decided to release it, so you future MUDs could get a
kick out of it. For the five minutes it takes to add--believe me, its fun :).
Just be careful that noone tries to donate pulled grenades. Thats what we want,
exploding newbies.

