From the NannyMUD documentation

LAST CHANGE

2001-01-06

FUNCTION


NAME

        add_weight - add to local weight of an object or living

LOCATION

	/obj/living.c, /std/simple_container et al.

SYNTAX

	int add_weight(int weight);

DESCRIPTION

	add_weight is generally called when an object is going to be
	given to a monster or player, or inserted into a container.
	It is used both to test if the player or container can 
	carry more, and if so to add the weight of the given object
	to the player or container's total weight.

RETURN VALUES

	Non-zero value means that weight has been added to the object's
	total local weight.
        A return value of 0 means that the object is 'full' or at its
	'carrying capacity'.  

NOTE

	If you use move_object(E) to move an object to a container or
	especially to a player, be sure to call add_weight() or else
	their total carried weight will be flubbed up.  Likewise, if
	add_weight() returns 0, do not move the object to the container
	or player.

NOTE

	An alternative to the move_object / add_weight combination is
	the efun transfer(E) which automatically calls add_weight.
  

EXAMPLE

	The following example is from an imaginary shop:

	torch = clone_object("/obj/torch");
        if ( !this_player()->add_weight(torch->query_weight()) ) {
	    write("The shopkeeper says: You can't carry anymore!\n"+
	          "He lays it on the ground in front of you.\n");
	    move_object(torch, this_object());
	} else {
	    write("The shopkeeper hands you the torch.\n");
	    move_object(torch, this_player());
	}

SEE ALSO

        transfer in efun/object_related/transfer

SEE ALSO

        query_weight in lfun/living/living_functions

SEE ALSO

        can_put_and_get in lfun/basic/can_put_and_get
        can_put_and_get in lfun/living/living_functions