[ Package Index | Mudlib Index | Effect Index ]

File /obj/cont_medium.c

Continuous Medium Object. amount: current quantity of medium in arbitrary units continuous: 1 for continuous (default), reset to 0 for normal object behaviour collective: 1 for collective, 0 for normal behaviour. weight_unit: ({ a, b }) means that b units have weight a value_scale (float): if set & continuous, value is ::query_value() * amount * value_scale; else value is ::query_value() medium_alias: used for identification - choose something with capitals (e.g. "ChalkDust") so players can't use it as a valid alias by accident pile_name: "pile", "collection", "puddle", etc. amount_types: ([ "pinch": ({ 1, "pinches" }), "handful": ({ 50, "handfuls" }) ]) pile_types: ({ 50, "small", 100, "medium", 150, "large", "huge" }); Added by Jeremy, 4-Nov-95: ground, longs, shorts, medium_aliases The above were removed by Jeremy, 18-Jun-97. Hopefully no one will miss them.

Written by Jeremy Additions for collective objects: Since "a" and "an" will be replaced with the number of objects, "$a" and "$an" can be used if there should be a non-changing "a" or "an" in the long. For verbs you can use $V$. Example: $Vglows$glow If there are any words which should be pluralized, place a $P in front of it, like $Pleaf or $Pword Finally you can use $A if you want "a word" in for one object and "words" for more than one.


Inherits

This class inherits the following classes /std/object.c

Includes

This class includes the following files /include/obj_parser.h, /include/parse_command.h and /include/move_failures.h

Method index

 o adjust_amount(int)
This method changes the amount of stuff.
 o amount_size(int)
This method returns a string which tells us how much stuff we have.
 o amount_size_short()
This method returns a string which tells us how much stuff we have.
 o dest_old_env(object)
This method destructs the temporary container.
 o make_medium_clone(int)
This method makes a duplicate of ourselves at a different size.
 o merge()
 o merge_criteria(object)
 o new_collective(int)
 o no_env_move(object, object)
This method checks to see if we are still in our silly little container and if we are, moves us back.
 o pile_size()
This method returns a string describing how big the pile is.
 o query_amount()
This method returns the amount of the stuff there is.
 o query_amount_types()
This method returns the types of the different amounts.
 o query_collective()
This method tests to see if this object is a collective or not.
 o query_continuous()
This method tests to see if this object is continuous or not.
 o query_how_many()
This returns as an integer 'how many' we have of a particular type.
 o query_max_seen()
This method returns the maximum number of piles of the object that can be seen.
 o query_medium_alias()
This method returns the medium alias.
 o query_merger()
This method returns 1 if the object is available for mergin.
 o query_no_join()
This method checks to see if we are allowed to join with other objects when we encounter them.
 o query_parse_id(mixed *)
 o query_pile_name()
This method returns the name we give the piles of this stuff.
 o query_pile_types()
This method returns the array of pile types.
 o query_value()
This method returns the value of the object.
 o query_value_scale()
This method returns the current value scale.
 o query_weight_unit()
This method returns the weight units used for this type of unit.
 o reset_collective()
This method removes the collective property from the object.
 o reset_continuous()
This method removes the continuous property from the object.
 o reset_no_join()
This method lets this object joining with other objects when we encounter them.
 o set_amount(int)
This method sets the amount of the stuff there is.
 o set_amount_types(mapping)
This method sets the sizes of the piles and their names.
 o set_collective()
 o set_continuous()
This method makes the object continuous.
 o set_medium_alias(string)
This method sets the medium alias for the object.
 o set_no_env_move(object)
This method is for dealing with the object when bits are shaved off.
 o set_no_join()
This method stops this object joining with other objects when we encounter them.
 o set_pile_name(string)
This method returns the name we give the piles of this stuff.
 o set_pile_types(mixed *)
This method sets the name of the piles given the different amounts of piles available.
 o set_value_scale(float)
This method sets the amount by which to scale the value of a continuous object.
 o set_weight_unit(int *)
This method sets the weight units used for this type of stuff.

Public Functions

These are functions that everyone can access.

.
 * adjust_amount
void adjust_amount(int number)
This method changes the amount of stuff.

Parameters:
number - the amount to change it by
 * amount_size
varargs string amount_size(int exact)
This method returns a string which tells us how much stuff we have.

Returns:
string representing the amount of stuff we have
 * amount_size_short
string amount_size_short()
This method returns a string which tells us how much stuff we have.

Returns:
string representing the amount of stuff we have
 * dest_old_env
void dest_old_env(object place)
This method destructs the temporary container.

Parameters:
place - the object to destroy
 * make_medium_clone
object make_medium_clone(int number)
This method makes a duplicate of ourselves at a different size.

Parameters:
number - the new size of the object
Returns:
the new object
 * merge
void merge()
 * merge_criteria
int merge_criteria(object ob)
 * new_collective
object new_collective(int number)
 * no_env_move
void no_env_move(object dest,
                 object place)
This method checks to see if we are still in our silly little container and if we are, moves us back. We always dest the old container

Parameters:
dest - where we are going to
place - the temporary container
 * pile_size
string pile_size()
This method returns a string describing how big the pile is.

Returns:
the size of this pile of stuff
 * query_amount
int query_amount()
This method returns the amount of the stuff there is. This is a volume measurement.

Returns:
the amount of stuff
 * query_amount_types
mapping query_amount_types()
This method returns the types of the different amounts. argument is a mapping which contains the name of the pile and value is an array, the first element is the amount needed for the name and the second element is the plural of the pile name.

Returns:
the amount types mapping
 * query_collective
int query_collective()
This method tests to see if this object is a collective or not.

Returns:
1 if it is continuous, 0 if not.
 * query_continuous
int query_continuous()
This method tests to see if this object is continuous or not.

Returns:
1 if it is continuous, 0 if not
 * query_how_many
int query_how_many()
This returns as an integer 'how many' we have of a particular type.

Returns:
int representing the amount of a particular pile.
 * query_max_seen
int query_max_seen()
This method returns the maximum number of piles of the object that can be seen. Any more than this turns into 'many'.

Returns:
the maximum number of piles that can be seen
 * query_medium_alias
string query_medium_alias()
This method returns the medium alias. This should be a unique alias for the medium, it is used when joining to see if we can join or not It it used for identification - choose something with capitals (e.g. "ChalkDust") so players can't use it as a valid alias by accident.

Returns:
the medium alias
 * query_merger
int query_merger()
This method returns 1 if the object is available for mergin.

Returns:
1 if we can merge
 * query_no_join
int query_no_join()
This method checks to see if we are allowed to join with other objects when we encounter them. A join will occur if we end up in same environment and the medium aliases match.

Returns:
1 if they cannot join, 0 if they can
 * query_parse_id
object query_parse_id(mixed * args)
 * query_pile_name
string query_pile_name()
This method returns the name we give the piles of this stuff. This is the name given to piles of the object.

Returns:
the name of the pile
 * query_pile_types
mixed query_pile_types()
This method returns the array of pile types. The pile types array starts with a number, the number is the cut off amount to get the size name in the next array element. The numbers and strings alternate and the last element is the the default size.

Returns:
the array of pile types
 * query_value
int query_value()
This method returns the value of the object. If the object is not continuous, or the value_scale has not been set, the value is the value set with set_value(), as usual. Otherwise, the value is scaled by value_scale and multiplied by the current amount.

Returns:
the value of the object
See also:
set_value(), set_value_scale() and query_value_scale()
 * query_value_scale
float query_value_scale()
This method returns the current value scale.

Returns:
the value scale
See also:
set_value_scale() and query_value()
 * query_weight_unit
int * query_weight_unit()
This method returns the weight units used for this type of unit. The weight unit is an array ({ a, b }) which means that b units of stuff have weight a.

Returns:
the weight array
 * reset_collective
void reset_collective()
This method removes the collective property from the object.

 * reset_continuous
void reset_continuous()
This method removes the continuous property from the object.

 * reset_no_join
void reset_no_join()
This method lets this object joining with other objects when we encounter them. A join will occur if we end up in same environment and the medium aliases match.

 * set_amount
void set_amount(int number)
This method sets the amount of the stuff there is.

Parameters:
number - the amount to set it to
 * set_amount_types
void set_amount_types(mapping map)
This method sets the sizes of the piles and their names. The argument is a mapping which contains the name of the pile and value is an array, the first element is the amount needed for the name and the second element is the plural of the pile name.

Parameters:
map - the amount types mapping
Example:
set_amount_types( ([ "pinch": ({ 1, "pinches" }),
                 "handful": ({ 50, "handfuls" }) ]));
 * set_collective
void set_collective()
 * set_continuous
void set_continuous()
This method makes the object continuous.

 * set_medium_alias
void set_medium_alias(string word)
This method sets the medium alias for the object. This should be a unique alias for the medium, it is used when joining to see if we can join or not It it used for identification - choose something with capitals (e.g. "ChalkDust") so players can't use it as a valid alias by accident. & @param word the medium alias

 * set_no_env_move
void set_no_env_move(object dest)
This method is for dealing with the object when bits are shaved off. If it is split up by someone referencing it we are moved into a special environment so we do not interfer with the old pile. The property "medium dest" will be used as the place to go, otherwise the environment will be used. This method sticks it into a special on the fly created container.

Parameters:
dest - the place to move too (this will be the "medium dest" or the environment()
 * set_no_join
void set_no_join()
This method stops this object joining with other objects when we encounter them. A join will occur if we end up in same environment and the medium aliases match.

 * set_pile_name
void set_pile_name(string word)
This method returns the name we give the piles of this stuff.

Parameters:
word - the name of the pile
Example:
set_pile_name("puddle");
 * set_pile_types
void set_pile_types(mixed * args)
This method sets the name of the piles given the different amounts of piles available. The last pile type in the list is the size to use for anything larger. The pile sizes must be in order.

Parameters:
args - the pile types
Example:
set_pile_types(({ 50, "small", 100, "medium", 150, "large", "huge" }));
 * set_value_scale
void set_value_scale(float f)
This method sets the amount by which to scale the value of a continuous object. If not set, the value will be that set with set_value().

Parameters:
f - the value scale
See also:
query_value_scale() and query_value()
 * set_weight_unit
void set_weight_unit(int * numbers)
This method sets the weight units used for this type of stuff. The weight unit is an array ({ a, b }) which means that b units of stuff have weight a.

Parameters:
numbers - the new weight unit

Discworld MUD's distribution world wide web pages.
brought to you by
Cut Me Own Throat Dibbler's Sensational Sausages; buy one while they are hot.
File last modified: Thu, 18 Sep 2003 18:02:38 GMT

Lost? Try Discworld's home page.