#1904 is_typeclass to default exact=False

This commit is contained in:
trhr 2020-03-07 21:24:15 -06:00
parent d10f9b7320
commit e552663eea
3 changed files with 15 additions and 15 deletions

View file

@ -6,7 +6,7 @@
defaults to True for backwards-compatibility in 0.9, will be False in 1.0 defaults to True for backwards-compatibility in 0.9, will be False in 1.0
### Already in master ### Already in master
- `is_typeclass(obj (Object), exact (bool))` now defaults to exact=False
- `py` command now reroutes stdout to output results in-game client. `py` - `py` command now reroutes stdout to output results in-game client. `py`
without arguments starts a full interactive Python console. without arguments starts a full interactive Python console.
- Webclient default to a single input pane instead of two. Now defaults to no help-popup. - Webclient default to a single input pane instead of two. Now defaults to no help-popup.

View file

@ -933,7 +933,7 @@ class CmdWield(Command):
weapon = self.caller.search(self.args, candidates=self.caller.contents) weapon = self.caller.search(self.args, candidates=self.caller.contents)
if not weapon: if not weapon:
return return
if not weapon.is_typeclass("evennia.contrib.turnbattle.tb_equip.TBEWeapon"): if not weapon.is_typeclass("evennia.contrib.turnbattle.tb_equip.TBEWeapon", exact=True):
self.caller.msg("That's not a weapon!") self.caller.msg("That's not a weapon!")
# Remember to update the path to the weapon typeclass if you move this module! # Remember to update the path to the weapon typeclass if you move this module!
return return
@ -1012,7 +1012,7 @@ class CmdDon(Command):
armor = self.caller.search(self.args, candidates=self.caller.contents) armor = self.caller.search(self.args, candidates=self.caller.contents)
if not armor: if not armor:
return return
if not armor.is_typeclass("evennia.contrib.turnbattle.tb_equip.TBEArmor"): if not armor.is_typeclass("evennia.contrib.turnbattle.tb_equip.TBEArmor", exact=True):
self.caller.msg("That's not armor!") self.caller.msg("That's not armor!")
# Remember to update the path to the armor typeclass if you move this module! # Remember to update the path to the armor typeclass if you move this module!
return return

View file

@ -458,7 +458,7 @@ class TypedObject(SharedMemoryModel):
# Object manipulation methods # Object manipulation methods
# #
def is_typeclass(self, typeclass, exact=True): def is_typeclass(self, typeclass, exact=False):
""" """
Returns true if this object has this type OR has a typeclass Returns true if this object has this type OR has a typeclass
which is an subclass of the given typeclass. This operates on which is an subclass of the given typeclass. This operates on