Home

[Package Index | Mudlib Index | Effect Index]

File /std/container.c

The basic container inheritable, please note this is *not* a container like a bucket. This now allows things inside the container to inform us that they should be used as part of the inventory of this object. This means the contents of containers will look like they are not inside containers to the outside world.

See also:
/obj/container.c, /obj/baggage.c, /obj/vessel.c and /obj/clothing.c

Written by Pinkfish

Inherits

This class inherits the following classes /std/basic/cute_look.c, /std/basic/export_inventory.c, /global/auto_load.c and /std/object.c

Includes

This class includes the following files /include/player.h, /include/playtesters.h, /include/player_handler.h and /include/move_failures.h

Method index

  • add_tracked_items(int)
    This method handles the addition of tracked items.
  • add_weight(int)
    This method is called in the move functions, it adds extra weight onto the object when something is moved inside it.
  • can_find_match_recurse_into(object)
    This method allows the container to have stuff inside it checked.
  • can_find_match_reference_inside_object(object, object)
    This method checks to see if the find match code can actually reference this object inside us.
  • disable_item_tracking()
    This method disables item tracking
  • do_restore_inventory_error(object, int)
    This method handles the case where the return of the move flag is not MOVE_OK.
  • enable_item_tracking()
    This method enables item tracking
  • event_container_move(object, mixed, mixed)
    This method handles the movement of the containers of this object.
  • event_move_object(mixed, mixed)
    This method is called from move to notify any tracked items contained of the move using event_container_moved.
  • find_inv_match(string, object)
    This method finds the matching objects inside this object that are visible to the looker.
  • handle_restore_inventory(object)
    This method handles moving objects into the inventory from an auto load.
  • query_complete_weight()
    This method returns the complete weight of the object.
  • query_fullness(int)
    This method returns the fullness of the container based on a number from 0 to the passed in number.
  • query_loc_weight()
    This method returns the current local weight in this container.
  • query_max_items()
    This method returns the maximum number of items that can be carried in this container.
  • query_max_weight()
    This method returns the maximum amount of weight that can be carried in this container.
  • query_ownership()
    This returns who owns the container, if it set to 0 then no one owns it.
  • query_player()
    This method returns the player who is loading the container during the autoload sequence.
  • query_prevent_insert()
    If this is true, this container cannot be put into other containers.
  • query_tracked_items()
    This method returns the number of tracked item contained.
  • remove_tracked_items(int)
    This method handles the removal of tracked items.
  • reset_prevent_insert()
    This allows this container to be put into other containers (default).
  • set_max_items(int)
    This method sets the maximum number of items that can be carried in this container.
  • set_max_weight(int)
    This method sets the maximum amount of weight that can be carried in this container.
  • set_ownership(string)
    This sets who owns the container, if it set to 0 then no one owns it.
  • set_player(object)
    This method is used in the auto loading sequence to set the player who is loading the container.
  • set_prevent_insert()
    items21 stops this container from being put into other containers.
  • set_tracked_item_status_reason(string)
    This method is called to adjust the status reason.
  • test_add(object, int)
    This method allows things to be added into us.
  • test_item_limit(int)
    This method verifies to make sure that the max item container limit is not broken.
  • test_remove(object, int, mixed)
    This method checks to see if the object can be taken out of us.
  • update_loc_weight()
    This method determins the current local weight from all the objects inside the container

Public Functions

These are functions that everyone can access.

.

    add_tracked_items
    nomask void add_tracked_items(int n_items)
    

    This method handles the addition of tracked items. Tracked items want to be notified if the container moves.
    • Parameters:
      n_items - the number of tracked items added
    • See also:
      remove_tracked_items.c and event_container_move .c
    add_weight
    int add_weight(int n)
    

    This method is called in the move functions, it adds extra weight onto the object when something is moved inside it.
    • Parameters:
      n - the amount to add
    • Returns:
      1 if successfuly added
    • See also:
      /std/basic/misc->query_weight()
        can_find_match_recurse_into
        int can_find_match_recurse_into(object looker)
        

        This method allows the container to have stuff inside it checked.
        • Parameters:
          looker - the person doing the checking
        • Returns:
          1 on success, 0 on failur
            can_find_match_reference_inside_object
            int can_find_match_reference_inside_object(object thing,
                                                       object looker)
            

            This method checks to see if the find match code can actually reference this object inside us.
            • Parameters:
              thing - the thing to reference
              looker - the person looking at it
            • Returns:
              1 if they can, 0 if they cannot
                disable_item_tracking
                nomask void disable_item_tracking()
                

                This method disables item tracking
                • See also:
                  event_enter_tracked_item.c and enable_item_tracking .c
                    do_restore_inventory_error
                    int do_restore_inventory_error(object ob,
                                                   int move_flag)
                    

                    This method handles the case where the return of the move flag is not MOVE_OK. This can do whatever we want to make it work in a more useful fashion.
                      enable_item_tracking
                      nomask void enable_item_tracking()
                      

                      This method enables item tracking
                      • See also:
                        event_enter_tracked_item.c and disable_item_tracking .c
                          event_container_move
                          nomask void event_container_move(object mover,
                                                           mixed from,
                                                           mixed to)
                          

                          This method handles the movement of the containers of this object. Tracked items want to be notified if the container moves or anything containing it does. The movement of the outmost moving container is propagated down to all tracked items.
                          • Parameters:
                            mover - The outermost container object that moved
                            from - The start environment of the outermost container
                            to - The destination of the outermost container
                          • See also:
                            event_enter_tracked_item .c
                              event_move_object
                              void event_move_object(mixed from,
                                                     mixed to)
                              

                              This method is called from move to notify any tracked items contained of the move using event_container_moved.
                              • Parameters:
                                from - start
                                to - destination
                                  find_inv_match
                                  object * find_inv_match(string words,
                                                          object looker)
                                  

                                  This method finds the matching objects inside this object that are visible to the looker. This will also use the registered containers and add them into the array returned (if visible and contained in the object).
                                  • Parameters:
                                    words - the words matched on
                                    looker - who is looking
                                  • See also:
                                    /secure/simul_efun->find_match() and add_inventory_container()
                                      query_complete_weight
                                      int query_complete_weight()
                                      

                                      This method returns the complete weight of the object. This is the weight of the container itself, plus the weight of the things inside it
                                      • Returns:
                                        the complete_weight()
                                      • See also:
                                        /std/basic/misc->query_weight() and query_loc_weight()
                                          query_fullness
                                          int query_fullness(int number)
                                          

                                          This method returns the fullness of the container based on a number from 0 to the passed in number.
                                          • Parameters:
                                            number - the maximum number
                                          • Returns:
                                            the fullness number
                                              query_loc_weight
                                              int query_loc_weight()
                                              

                                              This method returns the current local weight in this container.
                                              • Returns:
                                                the local weight
                                                  query_max_items
                                                  int query_max_items()
                                                  

                                                  This method returns the maximum number of items that can be carried in this container.
                                                  • Returns:
                                                    the maximum number of items
                                                  • See also:
                                                    set_max_items()
                                                      query_max_weight
                                                      int query_max_weight()
                                                      

                                                      This method returns the maximum amount of weight that can be carried in this container.
                                                      • Returns:
                                                        the maximum weight
                                                      • See also:
                                                        set_max_weight()
                                                          query_ownership
                                                          string query_ownership()
                                                          

                                                          This returns who owns the container, if it set to 0 then no one owns it. This is used in the theft determination for the object.
                                                          • Returns:
                                                            who owns the container
                                                          • See also:
                                                            set_ownership()
                                                              query_player
                                                              object query_player()
                                                              

                                                              This method returns the player who is loading the container during the autoload sequence.
                                                              • Returns:
                                                                the player who loaded the object
                                                                  query_prevent_insert
                                                                  int query_prevent_insert()
                                                                  

                                                                  If this is true, this container cannot be put into other containers.
                                                                  • See also:
                                                                    reset_prevent_insert() and set_prevent_insert()
                                                                      query_tracked_items
                                                                      nomask int query_tracked_items()
                                                                      

                                                                      This method returns the number of tracked item contained. Tracked items want to be notified if the container moves.
                                                                      • See also:
                                                                        add_tracked_items.c and event_container_move .c
                                                                          remove_tracked_items
                                                                          nomask void remove_tracked_items(int n_items)
                                                                          

                                                                          This method handles the removal of tracked items. Tracked items want to be notified if the container moves.
                                                                          • Parameters:
                                                                            n_items - the number of tracked items removed
                                                                          • See also:
                                                                            add_tracked_items.c and event_container_move .c
                                                                              reset_prevent_insert
                                                                              int reset_prevent_insert()
                                                                              

                                                                              This allows this container to be put into other containers (default).
                                                                              • See also:
                                                                                set_prevent_insert() and query_prevent_insert()
                                                                                  set_max_items
                                                                                  void set_max_items(int number)
                                                                                  

                                                                                  This method sets the maximum number of items that can be carried in this container.
                                                                                  • Parameters:
                                                                                    number - the new maximum number of items
                                                                                  • See also:
                                                                                    query_max_items()
                                                                                      set_max_weight
                                                                                      void set_max_weight(int number)
                                                                                      

                                                                                      This method sets the maximum amount of weight that can be carried in this container.
                                                                                      • Parameters:
                                                                                        number - the new maximum weight
                                                                                      • See also:
                                                                                        query_max_weight()
                                                                                          set_ownership
                                                                                          void set_ownership(string word)
                                                                                          

                                                                                          This sets who owns the container, if it set to 0 then no one owns it. This is used in the theft determination for the object.
                                                                                          • Parameters:
                                                                                            word - who owns the container
                                                                                          • See also:
                                                                                            query_ownership()
                                                                                              set_player
                                                                                              void set_player(object thing)
                                                                                              

                                                                                              This method is used in the auto loading sequence to set the player who is loading the container.
                                                                                              • Parameters:
                                                                                                thing - the player loading the container
                                                                                              • See also:
                                                                                                query_player()
                                                                                                  set_prevent_insert
                                                                                                  int set_prevent_insert()
                                                                                                  

                                                                                                  items21 stops this container from being put into other containers.
                                                                                                  • See also:
                                                                                                    reset_prevent_insert() and query_prevent_insert()
                                                                                                      set_tracked_item_status_reason
                                                                                                      nomask void set_tracked_item_status_reason(string reason)
                                                                                                      

                                                                                                      This method is called to adjust the status reason. occurences.
                                                                                                      • See also:
                                                                                                        event_buried .c, event_player_quit .c and event_enter_tracked_item .c
                                                                                                          test_add
                                                                                                          int test_add(object ob,
                                                                                                                       int flag)
                                                                                                          

                                                                                                          This method allows things to be added into us. If we have an environment check that for the ability to add into us.
                                                                                                          • Parameters:
                                                                                                            ob - the object being added
                                                                                                            flag - the add flags
                                                                                                          • See also:
                                                                                                            /std/basic/move.c
                                                                                                              test_item_limit
                                                                                                              int test_item_limit(int num)
                                                                                                              

                                                                                                              This method verifies to make sure that the max item container limit is not broken.
                                                                                                              • Returns:
                                                                                                                1 if the container is not full
                                                                                                                  test_remove
                                                                                                                  int test_remove(object thing,
                                                                                                                                  int flag,
                                                                                                                                  mixed dest)
                                                                                                                  

                                                                                                                  This method checks to see if the object can be taken out of us.
                                                                                                                  • Parameters:
                                                                                                                    thing - the object coming out
                                                                                                                    flag - the move flag
                                                                                                                    dest - the destination object
                                                                                                                  • Returns:
                                                                                                                    1 if it can be taken out, 0 if not.
                                                                                                                  • See also:
                                                                                                                    /std/basic/move.c
                                                                                                                      update_loc_weight
                                                                                                                      void update_loc_weight()
                                                                                                                      

                                                                                                                      This method determins the current local weight from all the objects inside the container
                                                                                                                      • See also:
                                                                                                                        query_loc_weight()

                                                                                                                        Protected Functions

                                                                                                                        These are functions that only objects inheriting the class can access.

                                                                                                                          handle_restore_inventory
                                                                                                                          int handle_restore_inventory(object ob)
                                                                                                                          

                                                                                                                          This method handles moving objects into the inventory from an auto load. This should be over ridden by things inheriting us to make sure that the objects can be moved into the inventory. It should handle the bypassing of open/close/locked etc flags.
                                                                                                                          • Parameters:
                                                                                                                            ob - the object to move into ourselves
Valid HTML 4.01 Transitional
Valid CSS!
Read More