OBJECT
/std/food
LAST UPDATE
Thragor, 14-Jun-95
SYNOPSIS
inherit "/std/food";
DESCRIPTION
It is necessary for players to eat and drink to stay healthy. In
addition, the player can regain some hit points immediately by
eating.
/std/food provides a basic object for constructing some portable
foodstuff or beverage which disappears completely after being
consumed. For drinks, you should use /std/drink instead which
defines some bottled drink.
/std/food can easily be configured by calling the functions
mentioned below. The price of food depends on the "stuffed" and
"soaked" units, the alcohol content and the healing power of the
foodstuff. It is defined in /sys/health.h; the definition may
change in the future.
The food has some specific builtin properties, that can be set
by the following functions (and queried by the corresponding
Query...() functions):
string SetFoodKind(string kind) [optional]
sets the kind of foodstuff, which affects the command
the player has to issue to consume it. Normally, the
player "eat"s food (for this you don't have to call
the function at all); if you want him/her to "drink"
it, you have to set kind to "drink". (Parameters
different from "food" or "drink" are not accepted.)
void SetDrink()
void SetFood()
To avoid problems in the future (i. e. if the 'foodkinds'
are called different) you may use this functions, which at
the moment just do the same as SetFoodKind("drink") and
SetFoodKind("food").
mixed SetFoodMsgs(string|string*|closure message)
If set to a string only the player consuming this will get a
message written to the screen.
If the message is an array of strings , the size will be
queried to see how to handle it. If the size is:
1: it's handled as if it is just a string;
2: the first message is printed to the player and the
second one to her/his environment;
3: the first message is printed to the player, the second
one to all persons in the environment who can see and
the third one to all who can't;
4: the first message is printed to the player if (s)he can
see, the second one if (s)he can't, the third one to
the environment who can see and the last one to the
environment who can't..
If the message is a closure this will be called with the
playerobject and the object itself as arguments. If the
function returns 0, the food won't handle the result else
the result will be handled just like the above mentioned
procedure, i. e. string will be printed to one player, etc.
The strings will be passed through process_string before
printing. Some functions which may be called are predefined:
Pl_Name, Pl_name, Pl_Pronoun, Pl_pronoun, Pl_Possessive,
Pl_possessive, Pl_Objective, Pl_objective, Pl_Genetiv,
Pl_genetiv.
int SetFoodStuff(int stuff)
sets the saturation achieved by consuming this food.
stuff is passed to eat_food() in the player. A rich
meal should provide about 70 "stuffed" units (that's
half a day's ration). This may change in the future;
refer to /doc/concepts/health for a more elaborate
discussion.
int SetFoodAlc(int strength) [optional]
sets the alcoholic intoxication achieved by consuming
this food. strength is passed to drink_alcohol() in
the player.
int SetFoodSoak(int soak) [optional]
sets the liquid soaking achieved by consuming this
food. soak is passed to drink_soft() in the player; it
usually should be 0.
int SetFoodHeal(int heal) [optional]
sets the number of hit points immediately regained by
consuming this food. heal is passed to heal_self() in
the player object.
The Long and Short descriptions, the Ids, Weight and Value are
handled by the normal ``thing'' builtin properties. (Note that
the food's value is checked for consistency with the health
price rules).
Note that with this system you can model alcoholic sweets (e.g.
"Rumkugeln" :-) by setting a stuff and an alc value, and you
can model noodles with vodka sauce (Hi Mateese) by setting a
big stuff value, a small alc value and a slightly greater soak
value.
INHERITANCE TREE
food
|
`-thing
|...
EXAMPLES
/d/archwiz/common/health/exfood.c
/d/archwiz/common/health/exdrink1.c
SEE ALSO
thing(S), drink(S), health(C)