Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @equips_to.setter
- # No default on slot so the caller MUST supply something.
- # Default of the equippable flag is True, because the
- # caller will eithe rwant to set or clear that status.
- def equips_to(self, slot, is_equippable=True):
- # assume self._equips_to is already initialized to
- # a valid set by being loaded, or set to an empty
- # set in __init__.
- if type(slot) is set:
- if is_equippable:
- # When will self ever NOT be an item?
- #if self.is_item:
- self._equips_to |= slot
- else:
- self._equips_to -= slot
- elif type(slot) is str:
- if slot in equips_to_strings.keys():
- if is_equippable:
- self._equips_to.add(slot)
- else:
- self._equips_to.discard(slot)
- else:
- raise ValueError('Invalid slot name %r for %r' % (slot, self))
- else:
- raise TypeError('slot must be a set or a string, not %r' % type(slot))
Advertisement
Add Comment
Please, Sign In to add comment