OBJECT
drink
LAST UPDATE
Pumuckel, Sat Oct 9 22:59:29 MET 1993
SYNOPSIS
#include <properties.h>
inherit "std/drink";
DESCRIPTION
It is necessary for players to eat and drink to stay healthy. In
addition, the player can regain some hit points immediately by
drink.
/std/drink provides an object for constructing portable beverages
enclosed in vessels. That is, after a player has consumed e.g a
bottle of water, he will still carry around the empty bottle. The
vessel can be refilled (see below).
(If you want a drink to disappear completely after being consumed,
you should use /std/food instead. See also the example files at
the end of this file.)
/std/drink can easily be configured by calling the functions
mentioned below. The minimal price of drinks depends on the "soaked"
units, the alcohol content and the healing power of the beverage.
It is defined in "/sys/health.h". The minimal price is always set.
But you can set a higher price for the drink than the minimal.
With the following functions you may configure your drink:
Set_Vessel_Name(string vessel_desc)
sets the name of the vessel which contains the drink,
e.g. "bottle". The short description is assembled from
the name of the drink and the name of the vessel in the
following fashion:
"a [vessel_desc] of [liquid_desc]"
Example:
"a bottle of firebreather"
THIS FUNCTION HAS TO BE CALLED BEFORE Set_Drink_Name(),
otherwise the ID liquid_desc won't exist!!!
Set_Drink_Name(string liquid_desc)
sets the name of the drink, e.g. "firebreather". Do not
enter the complete short description here; this is
assembled by /std/drink itself and should not be
overloaded.
SetFoodMsg1(string msg1) [optional]
sets the message which the consumer of the drink gets,
otherwise it is "You drink a [short_desc].\n"
SetFoodMsg2(string msg2) [optional]
sets the message which other players in the same room
as the consumer get, otherwise it is "[name] drinks a
[short_desc].\n". The string msg2 is submitted to a
process_string() call so you can do some quite tricky
things here if you want to.
See also: process_string(E)
SetFoodAlc(int percent) [optional]
sets the percentage of alcohol the drink has.
SetFoodHeal(int heal) [optional]
sets the number of hit points you will regained by
drinking 1 liter of the drink.
Set_Vessel_Value(int value)
sets the value of the empty vessel. If a player buys or
sells a full vessel, the value of the drink (which is
calculated as described above) is added to this value.
Set_Vessel_Weight(int weight)
sets the weight of the empty vessel (in grams). If the
vessel is filled, the weight of the drink is added to
the weight of the vessel.
Set_Vessel_Volume(int volume)
sets the volume of the vessel (in milliliters). From this
value the weight of a full vessel and the "soaking units"
are calculated. It also influences the value of the drink
(together with the healing power and the alcohol content).
The long description of the vessel can be set by using SetLong()
which is described in the documentation for /std/thing.
To build a room where a vessel can be refilled you only have to
set an additional property P_REFILL in this room. This property
is currently defined only in /std/drink, but it should move soon
to /sys/health.h or /sys/properties.h as well.
This property must be set to the kind of liquid which may be
refilled in the room. E.g. if you want to write a spring you
might want to make it possible to refill bottles with water
there. Then you should include in the create() function of
your room file a line like the following one:
SetProp(P_REFILL,"water");
BUGS
The P_VESSEL_NAME is used both for generating the P_SHORT and
as P_ID. For things like 'wooden cup's this breaks as the
resulting object can't be referenced as 'cup', only as 'wooden
cup'.
The whole object should be rewritten, e.g. to take advantage
of the /std/thing's new abilities to distinguish the short
description and modifications hereof ('a cup' vs. 'a cup
filled with Jin Tonyx').
INHERITANCE TREE
drink
|
`-thing
|...
EXAMPLES
/d/archwiz/common/health/exdrink1.c is a non-bottled drink,
created with /std/food
/d/archwiz/common/health/exdrink2.c was created with /std/drink
/d/archwiz/common/health/exroom1.c example room where empty
vessels may be refilled
SEE ALSO
thing(S), food(S), health(C)