ItemEater.txt
snippets · 3.0 KB · 2010-03-30
Special function Item Eater: a mob special that eats items on the floor and in the mob's inventory.
Download « Back to the snippets list
/****************************************************************************
* Special Function Item Eater *
* Eats the items on the floor and in the mobs inventory *
* *
* Use as you will, please give credit *
* *
* This code was written for use on New Bourn Kaos: Kaos Reborn MUD, based *
* on EOD V2.0 *
* *
* Penned by my hand, this 6th day of May, 2005 *
* --Ragabash (RagabashLOE@msn.com) *
****************************************************************************/
/****************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik Staerfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
****************************************************************************/
//Add the following code to special.c
// Add to Declarations at the top of the file
DECLARE_SPEC_FUN( spec_itemeater );
// Here's the program
bool spec_itemeater( CHAR_DATA *ch )
{
OBJ_DATA *object;
OBJ_DATA *object_next;
if ( !IS_AWAKE( ch ) )
return FALSE;
for ( object = ch->in_room->contents; object; object = object_next )
{
object_next = object->next_content;
if ( object == NULL )
continue;
if ( !IS_SET( object->wear_flags, ITEM_TAKE ) )
continue;
{
act( "$n picks up $p and gobbles it down.", ch, object, NULL, TO_ROOM );
obj_from_room( object );
obj_to_char( object, ch );
if ( object != NULL )
{
extract_obj( object );
}
}
}
for ( object = ch->carrying; object; object = object_next )
{
object_next = object->next_content;
if ( object == NULL )
continue;
if ( !IS_SET( object->wear_flags, ITEM_TAKE ) )
continue;
{
act( "$n eats $p.", ch, object, NULL, TO_ROOM );
if ( object != NULL )
{
extract_obj( object );
return TRUE;
}
}
}
return FALSE;
}
//Add to the special table at the bottom of the file
{ "spec_itemeater", spec_itemeater},