Mercurial > parpg-source
comparison components/equip.py @ 75:9e03f7816061
(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 | 783dc57eca7c |
children | 939984cff702 |
comparison
equal
deleted
inserted
replaced
74:c9818290bbe7 | 75:9e03f7816061 |
---|---|
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 |