Merge pull request #2074 from trhr/bugfixes

Defaulting is_typeclass to exact=False
This commit is contained in:
Griatch 2020-03-17 10:27:47 +01:00 committed by GitHub
commit 1024cb6f52
4 changed files with 17 additions and 17 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

@ -2529,10 +2529,10 @@ class DefaultExit(DefaultObject):
[ [
"puppet:false()", # would be weird to puppet an exit ... "puppet:false()", # would be weird to puppet an exit ...
"traverse:all()", # who can pass through exit by default "traverse:all()", # who can pass through exit by default
"get:false()", "get:false()", # noone can pick up the exit
] ]
) )
) # noone can pick up the exit )
# an exit should have a destination (this is replaced at creation time) # an exit should have a destination (this is replaced at creation time)
if self.location: if self.location:

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