Skip to main content

set_eat_object

Discworld food help

set_eat_object

Name

set_eat_object - Sets the eat object of the food.

Syntax

int set_eat_object(object ob);

Description

Sets the eat object of the food. This is used when the food is eaten, the eat function on the eat object is called when the food is eaten. The eat message is displayed at this point.

If the eat object is set, then the eat function needs to be set as well. If the function is not set then setting the object has no effect. :)

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

void create_food() {
object food;

food = clone_object("/obj/food/apple.food");
food->set_eat_object(this_object());
food->set_eat_func("eat_rabbit");
} /* create_food() */

void eat_rabbit(object food, object eater) {
/* Do something wonderful! */
} /* eat_rabbit() */

See also

set_eat_func, query_eat_object, set_eat_message, query_eat_func, query_eat_mess, setup_eat