Ignore:
Timestamp:
10/24/09 06:17:27 (10 years ago)
Author:
b0rland_parpg
Message:

Ticket #107: patch by b0rland

  • Wrote initial version of the inventory storage class
  • Added some useful utility functions into container class and its derivatives
  • Created several combined classes for carryable containers
  • Extended tests and of course made new ones
  • Renamed old Inventory class to be InventoryGUI

Note: InventoryGUI still works the old way and doesn't use Inventory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/objects/base.py

    r315 r346  
    208208        except AttributeError : 
    209209            pass 
    210          
    211 class Inventory (object): 
    212     """Aggregate class for things that have multiple Containers""" 
    213     def __init__ (self, **kwargs): 
    214         self.is_inventory = True 
    215         self.containers = [] 
    216      
     210 
     211    def count (self): 
     212        return len(self.items) 
     213 
     214         
    217215class Living (object): 
    218216    def __init__ (self, **kwargs): 
     
    247245         
    248246class Wearable (object): 
    249     def __init__ (self, **kwargs): 
     247    def __init__ (self, slots, **kwargs): 
    250248        """Allows the object to be worn somewhere on the body (e.g. pants)""" 
    251249        self.is_wearable = True 
     250        if isinstance(slots,tuple) : 
     251            self.slots = slots 
     252        else : 
     253            self.slots = (slots,) 
    252254     
    253255class Usable (object): 
Note: See TracChangeset for help on using the changeset viewer.