set_eat_func |
Discworld food help |
set_eat_func |
Name
set_eat_func - Sets the eat function of the object.
Syntax
int set_eat_func(string func);
Description
Sets the eat function of the object. This is used when the object is eaten, the eat function on the eat object is called when the object is eaten. The eat message is displayed at this point.
If you set the eat function and not the eat object, then the function is called on the food object itself. The function will be called with two parameters, the first being the object being eaten and the second being the person eating the object.
Example
inherit "/obj/food";
void setup() {
/* Standard setup object stuff. */
...
/*
* What to do when we are eaten!
*/
set_eat_func("eat_rabbit");
} /* setup() */
void eat_rabbit(object consumer, object eater) {
/* Do something wild and interesting */
} /* eat_rabbit() */
See also
query_eat_func, set_eat_object, set_eat_message, query_eat_object, query_eat_message, setup_eat