Lpc Manpages

OBJECT:
	unit


DESCRIPTION:
	The unit object can be used to implement larger amounts of simple
	objects like coins. The main concept is that it can be referred
	not only by name but by amount and name also. The id() of a money
	object may accept '3 gold coins' besides 'coins'. The move()
	function supports this naming, too, because the object 'remembers'
	how it was referred the last time. The move function can move
	part of the whole object, then a new clone with the rest of the
	unit is produced and the own amount is set to the amount requested
	to move. It will then move itself to the new place where it checks
	if there is already an object of the same type. If this is the case,
	the objects merges with the other object (effectively destructing
	the other object).

	The unit object supports several functions to configure it:

	SetAmount(int number)
	  Sets the number of units in the object. 

	SetValuePerUnit(int number)
	  Sets the value one unit has. The value of the whole object is
	  the number of units times the value per unit.

	SetWeightPerUnit(int number)
	  Sets the weight of one unit. The weight of the whole object is
	  the number of units times the weight per unit.

	SetUnitShort(string|string* short)
	  Sets the name of one unit. Optionally, you can give an array
	  containing singular and plural of the name. If you give only
	  a string, the plural is automatically generated. Rules are
	  currently (please report more general rules):
	  - add s to the singular.

	You should also use the functions AddId() and AddAdjective()
	from thing.c. 

	The characteristic values are stored in properties, those are
	(additionally to the thing properties):

	P_AMOUNT
	  The current amount of units

	P_VALUE_PER_UNIT
	  The current value per unit

	P_WEIGHT_PER_UNIT
	  The current weight per unit

	
INHERIT TREE:


SEE ALSO: