Home

[Package Index | Mudlib Index | Effect Index]

File /std/basic/holdable.c

A nice file to allow you to setup an object as being holdable. To deal with this inheritable you only need to define the method held_this_item if you wish to do anything when the item is held.

Written by Pinkfish

Started Wed Feb 2 15:38:10 PST 2000

Includes

This class includes the following files /include/move_failures.h

Method index

  • held_this_item(int, object, mixed)
    This method is called by the inheritable when the object is change from being held to unheld, or vica versa.
  • hold_item(object, int)
    Attempts to free up enough limbs for this_object to be held.
  • move(mixed)
    This method should be called by the upper level moves.
  • query_holder()
    This method returns the person who is holding the object.
  • query_my_limb()
    This method returns the current limb the object is being held in.
  • query_no_limbs()
    This method returns the number of limbs that the object uses.
  • set_holder(object, int)
    This method is called from the living object when we are held or unheld.
  • set_no_limbs(int)
    This method sets the number of limbs the object uses when held.

Public Functions

These are functions that everyone can access.

.

    held_this_item
    int held_this_item(int held,
                       object holder,
                       mixed arg)
    

    This method is called by the inheritable when the object is change from being held to unheld, or vica versa. This should be used to turn on and off light sources and so on. The method will also be called with a 2 if the object was held and we are doing an initialisation sequence.
    • Parameters:
      held - 1 if the item is held, 0 if not, 2 if held on init
      holder - this is person already holding it when removed, new holder when held
      arg - an argument use in the autoloading, passed into init_dynamic_arg
    • Returns:
      1 if the hold/remove was successful
    hold_item
    varargs int * hold_item(object who,
                            int pos)
    

    Attempts to free up enough limbs for this_object to be held. If items are dropped to make this possible, who is notified. If enough limbs are freed, attempts to hold this_object. If the position is undefined (ie: not specified) then it will try and choose a limb by itself.

    The return numbers are the limb numbers that were used by holding the item.

    hold_item: As designed by Tannah!

    • Parameters:
      who - The living object trying to hold this one.
      pos - the position to hold the item in
    • Returns:
      the an (int *) if successful or ({ }) if not enough limbs are freed
        move
        int move(mixed ob)
        

        This method should be called by the upper level moves. The result needs to be check, if it is not MOVE_OK then the move should be stopped.
        • Parameters:
          ob - the object to move
            query_holder
            object query_holder()
            

            This method returns the person who is holding the object.
            • Returns:
              the person holding the object
                query_my_limb
                int query_my_limb()
                

                This method returns the current limb the object is being held in.
                • Returns:
                  the number limb the object is held in
                    query_no_limbs
                    int query_no_limbs()
                    

                    This method returns the number of limbs that the object uses.
                    • Returns:
                      the number of limbs the object uses when held
                        set_holder
                        int set_holder(object ob,
                                       int limb)
                        

                        This method is called from the living object when we are held or unheld.
                        • Parameters:
                          ob - the person holding us
                          limb - the limb we are being held in
                            set_no_limbs
                            void set_no_limbs(int num)
                            

                            This method sets the number of limbs the object uses when held.
                            • Parameters:
                              num - the number of limbs
Valid HTML 4.01 Transitional
Valid CSS!
Read More