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

@ -218,10 +218,10 @@ def apply_damage(defender, damage):
def at_defeat(defeated): def at_defeat(defeated):
""" """
Announces the defeat of a fighter in combat. Announces the defeat of a fighter in combat.
Args: Args:
defeated (obj): Fighter that's been defeated. defeated (obj): Fighter that's been defeated.
Notes: Notes:
All this does is announce a defeat message by default, but if you All this does is announce a defeat message by default, but if you
want anything else to happen to defeated fighters (like putting them want anything else to happen to defeated fighters (like putting them
@ -903,10 +903,10 @@ class CmdCombatHelp(CmdHelp):
class CmdWield(Command): class CmdWield(Command):
""" """
Wield a weapon you are carrying Wield a weapon you are carrying
Usage: Usage:
wield <weapon> wield <weapon>
Select a weapon you are carrying to wield in combat. If Select a weapon you are carrying to wield in combat. If
you are already wielding another weapon, you will switch you are already wielding another weapon, you will switch
to the weapon you specify instead. Using this command in to the weapon you specify instead. Using this command in
@ -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
@ -955,10 +955,10 @@ class CmdWield(Command):
class CmdUnwield(Command): class CmdUnwield(Command):
""" """
Stop wielding a weapon. Stop wielding a weapon.
Usage: Usage:
unwield unwield
After using this command, you will stop wielding any After using this command, you will stop wielding any
weapon you are currently wielding and become unarmed. weapon you are currently wielding and become unarmed.
""" """
@ -986,12 +986,12 @@ class CmdUnwield(Command):
class CmdDon(Command): class CmdDon(Command):
""" """
Don armor that you are carrying Don armor that you are carrying
Usage: Usage:
don <armor> don <armor>
Select armor to wear in combat. You can't use this Select armor to wear in combat. You can't use this
command in the middle of a fight. Use the "doff" command in the middle of a fight. Use the "doff"
command to remove any armor you are wearing. command to remove any armor you are wearing.
""" """
@ -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
@ -1031,10 +1031,10 @@ class CmdDon(Command):
class CmdDoff(Command): class CmdDoff(Command):
""" """
Stop wearing armor. Stop wearing armor.
Usage: Usage:
doff doff
After using this command, you will stop wearing any After using this command, you will stop wearing any
armor you are currently using and become unarmored. armor you are currently using and become unarmored.
You can't use this command in combat. You can't use this command in combat.

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