diff components/equip.py @ 71:8f1edcab5602

Functions in equip.py will now correctly set the equipable's attributes.
author KarstenBock@gmx.net
date Wed, 21 Sep 2011 17:39:07 +0200
parents c1959525efda
children 783dc57eca7c
line wrap: on
line diff
--- a/components/equip.py	Wed Sep 21 17:37:30 2011 +0200
+++ b/components/equip.py	Wed Sep 21 17:39:07 2011 +0200
@@ -37,6 +37,8 @@
         try:
             old_item = getattr(wearer, slot)
             setattr(wearer, slot, equipable)
+            equipable.in_slot = slot
+            equipable.wearer = wearer
             return old_item
         except AttributeError:
             raise SlotInvalidError(slot)
@@ -53,7 +55,10 @@
 def take_equipable(wearer, slot):
     """Remove equipable from the given slot and return it"""
     item = get_equipable(wearer, slot)
-    setattr(wearer, slot, None)    
+    setattr(wearer, slot, None)
+    if item:
+        item.in_slot = None
+        item.wearer = None
     return item
     
     
\ No newline at end of file