.-
add_eat_effect
int add_eat_effect(mixed word,
int number)
-
This adds an eat effect to the food. This will be added to
the player or NPC when the food is eaten.
The effect is added with a number as the argument. The number
is based on the amount which is eaten (in weight units), and
usually represents the strength of the effect.
If the object is continuous, the weight is calculated from
the amount and weight_unit array...
eff_num = (amount * number * weight_unit[0]) / weight_unit[1]
...where the number is passed into the add_eat_effect() function.
If the effect already exists, then the number is added onto
the existing number.
- Parameters:
- word - The file name of the effect to add.
- number - The number to set to the effect to.
- Returns:
- The current value of the effect in the mapping
- See also:
- /obj/cont_medium->set_weight_unit() and remove_eat_effect()
-
add_external_effect
int add_external_effect(string word,
int number)
-
This adds an external effect to the food. This will be added to
the player or NPC when the liquid is splashed, applied, or rubbed on them.
The effect is added with a number as the argument. The number
is based on the amount which is splashed (in weight units), and
usually represents the strength of the effect.
If the object is continuous, the weight is calculated from
the amount and weight_unit array...
eff_num = (amount * number * weight_unit[0]) / weight_unit[1]
...where the number is passed into the add_external_effect() function.
If the effect already exists, then the number is added onto
the existing number.
- Parameters:
- word - The file name of the effect to add.
- number - The number to set to the effect to.
- Returns:
- The current value of the effect in the mapping
- See also:
- /obj/cont_medium->set_weight_unit(), set_splashable(), unset_splashable(), set_applicable(), unset_applicable.c, remove_external_effect() and set_external_pk_check()
-
check_for_container
int check_for_container()
-
This checks the outside of us for a container and then destroys ourselves
if it is not a container.
-
check_sharp
int check_sharp(object weapon)
-
This checks to see if a weapon is sharp. This is used later
to determine whather an object can be cut up with the weapon.
- Parameters:
- weapon - The weapon to check to see if it is sharp.
- Returns:
- Return 1 if it is sharp, or 0 otherwise.
-
consume
varargs void consume(object consumer,
int amount,
string type)
-
This consumes some of the food.
- Parameters:
- consumer - The person doing the consumption.
- amount - The amount being consumed.
- type - Use "splash" or "apply" or "external" to use external
effects, anything else for eat effects.
-
do_apply
int do_apply(object * things)
-
This handles applying things
- Returns:
- Return 1 if it succeeded, or return 0 if it failed.
- See also:
- set_applicable() and consume(*).c
-
do_cure
int do_cure()
-
This is called by the pickling stick. It stops the food
object decaying.
- Returns:
- returns 1 for suceess and 0 for failure.
- See also:
- set_decay_speed()
-
do_cut
varargs int do_cut(int num_pieces)
-
This cuts the food up into bits. This is the command called
with add_command() and does the actual cutting up into bits. If
the num_pieces parameter is undefined, the food is cut in half.
If the food is continuous, the cutting is handled by
the state_change handler (all continuous objects must be cut this
way).
- Parameters:
- num_pieces - The number of pieces to cut the food into.
- Returns:
- 1 if it succeeded, 0 if not.
- See also:
- set_piece_description(), query_in_pieces(), query_piece_short(), query_piece_plural() and query_piece_substance()
-
do_drink
int do_drink()
-
This gives the appropriate message for drinking things.
- Returns:
- Return 1 if it succeeded, or return 0 if it failed.
- See also:
- do_eat(), consume(*).c and set_liquid()
-
do_dry
int do_dry()
-
This method dries the food. Dried food no longer decays.
- Returns:
- returns 1 for suceess and 0 for failure.
- See also:
- set_decay_speed()
-
do_eat
varargs int do_eat(int no_mess)
-
This is the eat command call. This is setup with add_command()
and does the actual eating.
- Parameters:
- no_mess - don't use success messages
- Returns:
- Return 1 on success, 2 on success + last bit eaten and return 0 on failure.
- See also:
- /global/new_parse->add_command(), /global/new_parse->add_succeeded_mess() and set_eat_mess()
-
do_mince
varargs int do_mince()
-
do_quaff
int do_quaff()
-
This gives the appropriate message for quaffing things. Its
rather like drinking but a lot of it gets splashed on you.
- Returns:
- Return 1 if it succeeded, or return 0 if it failed.
- See also:
- do_eat(), consume(*).c and set_liquid()
-
do_splash
int do_splash(object * things)
-
query_applicable
int query_applicable(object applier,
object appliee)
-
This queries applicability of the food. (rubbing on someone)
Note that the food can only be applied when
set_applicable() has been called
- Parameters:
- applier - - Who applies it
- appliee - - Who it is applied to.
- Returns:
- 1 if it can be applied, 0 if it can't
- See also:
- set_applicable(), unset_applicable(), set_external_pk_check()
-
query_bites_gone
int query_bites_gone()
-
This returns the number of bites that have been taken out
of the food object.
- Returns:
- The number of bites which have been taken from
the object.
- See also:
- set_bites_gone() and set_weight_per_bite()
-
query_cured
int query_cured()
-
This returns the cured state of the bit.
- Returns:
- 1 if it is cured, 0 if not
-
query_decay_divisor
float query_decay_divisor()
- This tells us the current divisor used to determine decay. This can
be modified with set_decay_speed.
- Returns:
- float the divisor
- See also:
- set_decay_speed(), query_decay_speed(), set_decay_level() and query_decay_level()
-
query_decay_level
int query_decay_level()
-
This returns the level of the decay. This will be a number
between 1 and 6.
- Returns:
- The level of decay, which is between 1 and 6.
- See also:
- set_decay_speed()
-
query_decay_speed
int query_decay_speed()
-
This returns the decay speed. If this is 0 then the object
is not decaying. This is the length of time it takes
for the whole object to decay.
- Returns:
- The decay speed.
- See also:
- set_decay_speed()
-
query_decays
int query_decays()
-
This query tells us whether the food decays. All objects
which decay should have this function on them.
- Returns:
- Return 1 if the object decays.
- See also:
- set_decay_speed()
-
query_dried
int query_dried()
-
This returns the dried state of the bit.
- Returns:
- 1 if it is dried, 0 if not
-
query_eat_effects
mapping query_eat_effects()
-
The eat effects of the food. The mapping contains a set of
strings (the effect) and a number associated with the
effect.
- Returns:
- A mapping containing the eat effects.
- See also:
- add_eat_effect()
-
query_eat_func
string query_eat_func()
-
This returns the name of the eat function to carry out
when the object is eaten.
- Returns:
- A string which is the name of the eat function.
- See also:
- set_eat_object(), set_eat_func() and set_eat_mess()
-
query_eat_mess
string query_eat_mess()
-
This returns the eat message of the object.
- Returns:
- A string of text which is the eat message.
- See also:
- set_eat_object(), set_eat_func() and set_eat_mess()
-
query_eat_object
string query_eat_object()
-
This returns the eat object on which the eat function
of the food of the food is stored.
- Returns:
- A string which is the the name of the eat object.
- See also:
- set_eat_object(), set_eat_func() and set_eat_mess()
-
query_edible
int query_edible()
-
This tells us if the food is edible (ie. can be
consumed using 'eat' instead of 'drink'. If it is
edible then it is not a liquid.
- Returns:
- Return 1 if the food is a liquid, and return 0 if it is not.
- See also:
- set_liquid() and query_liquid()
-
query_external_effects
mapping query_external_effects()
-
The external (splash,apply,rub) effects of the food. The
mapping contains a set of strings (the effect) and a number
associated with the effect.
- Returns:
- A mapping containing the external effects.
- See also:
- set_splashable(), set_applicable()
-
query_food_object
int query_food_object()
-
This method returns 1 if the item is a food object.
- Returns:
- 1 when it is a food object
-
query_in_pieces
int query_in_pieces()
-
If the food has been cut up (using the 'cut' command)
then this will return true.
- Returns:
- Return 1 if it is in pieces, and return 0 otherwise.
- See also:
- do_cut()
-
query_liquid
int query_liquid()
-
This function returns one if the food is a liquid.
- Returns:
- Return 1 if the food is a liquid, and return 0 if it is not.
-
query_long_decay_level
string query_long_decay_level()
-
This method returns the decay level for the object as a string,
it is used in the long() function.
-
query_long_eat_level
string query_long_eat_level()
-
This method returns how much of the item has been nibbled on.
- Returns:
- a string used in long().
-
query_piece_description
string query_piece_description()
-
This returns the long description of the food object when
it is cut up into pieces.
- Returns:
- A string of text which is the piece description.
- See also:
- set_piece_description() and query_in_pieces()
-
query_rotten
int query_rotten()
- This tells us if the food has started to rot
- Returns:
- Return 1 if the food has started to rot, 0 otherwise.
- See also:
- set_decay_speed(), query_decay_speed(), set_decay_level(), query_decay_level() and query_decay_divisor()
-
query_short_rotten_adjective
string query_short_rotten_adjective()
-
This method returns the current rotten adjective that's used
in the short description for decaying objects.
- Returns:
- a string like slightly rotten, mostly rotten, etc.
-
query_splashable
int query_splashable(object splasher,
object splashee)
-
This queries splashability of the food.
Note that the food can only be splashed when liquid and when
set_splashable() has been called
- Parameters:
- splasher - - Who splashes.
- splashee - - Who is splashed.
- Returns:
- 1 if it can splash, 0 if it can't
- See also:
- set_splashable(), unset_splashable(), set_liquid(),
set_external_pk_check()
-
query_weight_per_bite
int query_weight_per_bite()
-
This sets the weight of each bite of the food object.
This is used along with the total weight of the object
to calculate how many bites of the food can be taken.
- Returns:
- The weight of each bite.
- See also:
- /std/basic/misc->set_weight(), set_weight_per_bite() and weight.c
-
remove_eat_effect
void remove_eat_effect(string word)
-
This removes the eat effect of the given name.
- Parameters:
- word - The name of the effect to delete.
- See also:
- add_eat_effect()
-
remove_external_effect
void remove_external_effect(string word)
-
This removes the external effect of the given name.
- Parameters:
- word - The name of the effect to delete.
- See also:
- add_external_effect()
-
reset_liquid
void reset_liquid()
-
This changes the food object into a solid. Solids are not
'continuous' and the decay speed will be set back to the
default.
- See also:
- set_liquid() and set_decay_speed()
-
set_applicable
void set_applicable()
-
This sets it so the food can be applied.
Note this is the default case.
- See also:
- unset_applicable()
-
set_bites_gone
void set_bites_gone(int number)
-
This sets the number of bites gone. This helps determine
the total weight of the object.
- Parameters:
- number - The number of bites gone.
- See also:
- set_weight_per_bite()
-
set_decay_level
void set_decay_level(int level)
-
This sets the decay level. This should be anumber
between 1 and 6. It lets you make a food object seem
as though it is already decaying.
- Parameters:
- level - The new decay level.
- See also:
- query_decay_level() and set_decay_speed()
-
set_decay_speed
void set_decay_speed(int decay)
-
This sets the speed at which a food object decays. The
speed is set in seconds and is the total amount of time
before the food decays.
If the decay speed is set to 0, then the object will never decay.
- Parameters:
- speed - The speed at which the object will decays.
- See also:
- set_decay_level() and query_decay_speed()
- Example:
/* This will make the object decay totaly in 30 minutes */
set_decay_speed(1800);
/* This will stop the object from ever decsaying */
set_decay_speed(0);
-
set_eat_effects
void set_eat_effects(mapping map)
-
This sets all the eat effects. This function should NOT
be used. Please use add_eat_effect.
- Parameters:
- map - The eat effects mapping.
-
set_eat_func
void set_eat_func(string word)
-
This sets the eat function of the food. This is called when
the food is eaten.
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.
- Parameters:
- word - The function to set as the eat function.
- See also:
- set_eat_object() and set_eat_mess()
- Example:
See the example for set_eat_object()
-
set_eat_mess
void set_eat_mess(mixed word)
-
This sets the eat function of the food. The function is
carried out when the food is consumed. The eat message,
set with set_eat_mess(), is displayed when this function
is carried out.
The eat mess should be treated exactly the same as a
add_succeeded_mess(), as it is processed later as
add_succeeded_mess(eat_mess, ({ }));
- Parameters:
- word - The string or array to be used as
the add_succeeded_mess() when eating the food.
- See also:
- set_eat_object(), set_eat_func() and /global/new_parse->add_succeeded_mess()
-
set_eat_object
void set_eat_object(string word)
-
This sets the object on which the eat function is stored.
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.
- Parameters:
- word - The object containing the eat function.
- See also:
- set_eat_object() and set_eat_mess()
- Example:
void create_food() {
object food;
food = clone_object("/obj/food/apple.food");
food->set_eat_object(this_object());
food->set_eat_func("eat_apple");
} /* create_food() */
void eat_apple(object food, object eater) {
/* Do something wonderful! */
} /* eat_rabbit() */
-
set_external_effects
void set_external_effects(mapping map)
-
This sets all the external effects. This function should NOT
be used. Please use add_external_effect.
- Parameters:
- map - The external effects mapping.
-
set_external_pk_check
void set_external_pk_check()
-
This makes the external effects pk checked.
- See also:
- add_external_effect(), set_applicable(), set_splashable() and unset_external_pk_check()
-
set_in_pieces
void set_in_pieces(int number)
-
This sets the in_pieces flag. This allows you to make the
food seem as though it has already been cut into pieces.
- Parameters:
- number - The number of pieces.
- See also:
- query_in_pieces(), set_piece_description(), set_piece_short(), set_piece_plural() and set_piece_substance()
-
set_liquid
void set_liquid()
-
This changes the food object into a liquid. Liquids are
automatically a 'continuous' medium, which means it will
combine with other liquids of the same type.
This will automatically set the decay speed to 0. Liquids
do not decay.
- See also:
- reset_liquid(), set_decay_speed() and /obj/cont_medium->set_continuous()
-
set_piece_description
void set_piece_description(string word)
-
This sets the long description of the food when it is has
'cut' into pieces.
If this is set then the short of the object is changed
to 'piece of cake'. If the piece description is not
set the short description of the object is not changed.
- Parameters:
- word - The long description to use when cut into pieces.
- See also:
- query_in_pieces(), set_piece_short(), set_piece_plural() and set_piece_substance()
- Example:
set_piece_description("The brown, soft, moist cake looks "
"totally wonderful.\n");
-
set_piece_plural
void set_piece_plural(string plural)
-
This plural description used for the pieces. It is only
really of use if the piece short pluralises in an unusual
manner. If it is not set the piece plural is set to what
the pice short has been set to with an "s" stuck on the
end, for example, slice to slices.
- Parameters:
- word - The plural used for the 'pieces' when cut into
pieces.
- See also:
- query_in_pieces(), set_piece_description(), set_piece_short() and set_piece_substance()
- Example:
set_piece_plural("slices");
-
set_piece_short
void set_piece_short(string short)
-
This is the description used in the short for the pieces.
When the object is cut up this is used as part of the
short description. For example, it can change
'piece of cake' to 'slice of cake', 'piece of chocolate'
to 'square of chocolate', and so on. If this the piece
short has not been set it is set to the default which is
simply "piece".
- Parameters:
- word - The short to use for the 'piece' when cut into
pieces.
- See also:
- query_in_pieces(), set_piece_description(), set_piece_plural() and set_piece_substance()
- Example:
set_piece_short("slice");
-
set_piece_substance
void set_piece_substance(string substance)
-
This sets a new description for what there are pieces of.
For example, if you want the short of the food before it
is cut up to be 'bar of chocolate', without the piece
substance being set, when it is cut up it will become
'a piece of bar of chocolate'. If you set this in enables
you to change that unwieldly description to 'a piece of
chocolate'.
- Parameters:
- word - The description of what the 'piece' is of.
- See also:
- query_in_pieces(), set_piece_description(), set_piece_short() and set_piece_plural()
- Example:
set_piece_substance("goat cheese");
-
set_splashable
void set_splashable()
-
This sets it so the food can be splashed.
Note that the food can only be splashed when liquid in any case.
Note this is NOT the default case.
- See also:
- unset_splashable(), set_applicable(), unset_applicable(),
add_external_effect()
-
set_weight_per_bite
void set_weight_per_bite(int number)
-
This sets weight of each bite of the food object. This is
used along with the total weight of the object to calculate
how many bites of the food can be taken.
- Parameters:
- number - The weight each bite should be.
- See also:
- /std/basic/misc->set_weight() and weight.c
-
setup_eat
void setup_eat(string ob,
string func)
-
This sets up the eat object and function. This is used when
the food is eaten. The eat function is called on the eat
object. If successful the eat message is added to the player.
- Parameters:
- ob - The object to use.
- func - The function to use.
- See also:
- set_eat_object() and set_eat_func()
-
setup_eat_piece_messages
void setup_eat_piece_messages(mixed piece,
mixed amt,
mixed last)
-
This sets up the eat messages for pieces and stuff. The amount message
will replace the $amt$ string in the message with the amount_string().
- Parameters:
- piece - the eat piece message. This can be either a string or an
array, it is passed to add_succeeded_mess().
- amt - the amount messages
- last - the message to print out when the last bit gets eaten
-
unset_applicable
void unset_applicable()
-
This sets it so the food cannot be applied.
- See also:
- set_applicable()
-
unset_external_pk_check
void unset_external_pk_check()
-
This makes the external effects not pk checked.
- See also:
- add_external_effect(), set_applicable(), set_splashable() and set_external_pk_check()
-
unset_splashable
void unset_splashable()
-
This sets it so the food cannot be splashed.
Note that the food can only be splashed when liquid in any case.
- See also:
- set_splashable()