Ignore:
Timestamp:
12/14/09 07:48:48 (10 years ago)
Author:
b0rland_parpg
Message:

Ticket #107: patch by b0rland

  • Added bulk and capacity into Carryable and Containers
  • Slightly improved weight property
  • Replaced ValueError? with domain-specific exceptions
  • Added bulk limits processing into InventoryGUI
File:
1 edited

Legend:

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

    r424 r449  
    3838        Container.__init__(self,**kwargs) 
    3939        Carryable.__init__(self,**kwargs) 
    40         self.own_weight = 0 
    4140 
    4241    def getWeight(self): 
    43         """Total weight of all items in container + container's own weight""" 
     42        """Resulting weight of a container""" 
    4443        return sum((item.weight for item in self.items.values()), self.own_weight) 
    4544 
    4645 
    4746    def setWeight(self, weight): 
     47        """Set container's own weight. For compatibility with inherited methods""" 
    4848        self.own_weight = weight 
    4949 
    5050    weight = property(getWeight, setWeight, "Total weight of container") 
     51 
     52    def getBulk(self): 
     53        """Resulting bulk of container""" 
     54        return self.getContentsBulk()+self.own_bulk 
     55 
     56    def setBulk(self, bulk): 
     57        """Set container's own bulk. For compatibility with inherited methods""" 
     58        self.own_bulk = bulk 
     59 
     60    bulk = property(getBulk, setBulk, "Total bulk of container") 
    5161 
    5262    def __repr__(self): 
Note: See TracChangeset for help on using the changeset viewer.