[Package Index | Mudlib Index | Effect Index]

File /std/living/holding.c

New holding code! Because the old stuff wasn't OO enough for me.

Written by Pinkfish

Method index

Public Functions

These are functions that everyone can access.

query_free_limbs
int query_free_limbs()

This method returns the number of free limbs on the living object. A free limb! Yes, have a couple of free legs, beat the rush! Buy now!

Returns:
the number of free limbs

See also:
query_holding() and query_limbs()


query_holding
object * query_holding()

This method returns the current holding array of the living object. This has one element in the array for each object and a 0 is in the array if that limb is not holding anything. The positions correspond to the positions returned by the query_limbs() function.

Returns:
an array of held objects

See also:
query_holding(), query_free_limbs() and query_weapons()


query_holding_limbs
string * query_holding_limbs(object ob)

This method returns the list of limbs the object is being held in.

Parameters:
ob - the object to check the limbs for

Returns:
the limbs it is held in


query_limbs
string * query_limbs()

This method returns the an array of the names of the limbs on the living object.

Returns:
an array of limbs


query_using_array
string * query_using_array()
query_weapons
object * query_weapons()

This method returns the currently held weapons on the living object. This is an array of held items which are weapons and can be used in combat.

Returns:
the array of held weapons

See also:
query_holding()


set_hold
int * set_hold(object ob,
               mixed pos,
               int limbs)

This method sets the object as held. It will attempt to hold it starting at the given position in the limbs array.

The return array contains the index of the limbs from which the item was added, if the array is 0 size then no items were added.

Parameters:
ob - the object to hold
pos - the position in the limb array to start holding at
limbs - the number of limbs to be used (1 or 2 usually). leave as zero for default.

Returns:
a array of limb numbers

See also:
set_unhold() and query_limbs() Editors Note: I have changed set_hold so that it no longer automatically unholds objects. I am moving that functionality to the hold command. If you want your objects to be in a specific limb, you have to free it up yourself using set_unhold. If you don't care which limbs, you just have to free up enough limbs to hold it.


set_unhold
int * set_unhold(object ob)

This method sets the object as unheld. It will attempt to remove the object from a held limb.

The return array contains the index of the limbs from which the item was removed, if the array is 0 size then no items were removed.

Parameters:
ob - the object to unhold

Returns:
a array of limb numbers

See also:
set_hold() and query_limbs()