Mercurial > parpg-core
comparison src/parpg/components/equip.py @ 105:7829eb185d6f
(Re)added setting of inventory and equipment in the object files.
author | KarstenBock@gmx.net |
---|---|
date | Thu, 22 Sep 2011 16:18:07 +0200 |
parents | 3d9b6405bd86 |
children | 3564a46544bc |
comparison
equal
deleted
inserted
replaced
104:de741e83a422 | 105:7829eb185d6f |
---|---|
52 @returns The equipable that was at the given slot, or None""" | 52 @returns The equipable that was at the given slot, or None""" |
53 if equipable.wearer: | 53 if equipable.wearer: |
54 raise AlreadyEquippedError | 54 raise AlreadyEquippedError |
55 if slot in equipable.possible_slots: | 55 if slot in equipable.possible_slots: |
56 try: | 56 try: |
57 old_item = getattr(wearer, slot) | 57 old_item = getattr(wearer, slot) if hasattr(wearer, slot) else None |
58 setattr(wearer, slot, equipable) | 58 setattr(wearer, slot, equipable) |
59 equipable.in_slot = slot | 59 equipable.in_slot = slot |
60 equipable.wearer = wearer | 60 equipable.wearer = wearer |
61 if old_item: | 61 if old_item: |
62 old_item.in_slot = None | 62 old_item.in_slot = None |