diff --git a/src/commands/default/building.py b/src/commands/default/building.py index c45ed0ff32..94e60424de 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -1331,20 +1331,20 @@ class CmdTypeclass(MuxCommand): caller.msg("This object cannot have a type at all!") return - is_same = obj.is_typeclass(typeclass) + is_same = obj.is_typeclass(typeclass, exact=True) if is_same and not 'force' in self.switches: string = "%s already has the typeclass '%s'. Use /force to override." % (obj.name, typeclass) else: reset = "reset" in self.switches - old_typeclass_path = obj.typeclass.path + old_typeclass_path = obj.typeclass_path ok = obj.swap_typeclass(typeclass, clean_attributes=reset) if ok: if is_same: string = "%s updated its existing typeclass (%s).\n" % (obj.name, obj.typeclass.path) else: - string = "%s's changed typeclass from %s to %s.\n" % (obj.name, + string = "%s changed typeclass from %s to %s.\n" % (obj.name, old_typeclass_path, - obj.typeclass.path) + obj.typeclass_path) string += "Creation hooks were run." if reset: string += " All old attributes where deleted before the swap." @@ -1356,7 +1356,6 @@ class CmdTypeclass(MuxCommand): string += "\nCould not swap '%s' (%s) to typeclass '%s'." % (obj.name, old_typeclass_path, typeclass) - caller.msg(string) diff --git a/src/commands/default/tests.py b/src/commands/default/tests.py index b35820cb38..615c577d65 100644 --- a/src/commands/default/tests.py +++ b/src/commands/default/tests.py @@ -229,8 +229,8 @@ class TestBuilding(CommandTest): self.call(building.CmdUnLink(), "TestExit1", "Former exit TestExit1 no longer links anywhere.") self.call(building.CmdSetHome(), "Obj6 = Room6b", "Obj6's home location was changed from Room6") self.call(building.CmdListCmdSets(), "", ":") - self.call(building.CmdTypeclass(), "Obj6 = src.objects.objects.Character", - "Obj6's changed typeclass from src.commands.default.tests.TestObjectClass to src.objects.objects.Character") + self.call(building.CmdTypeclass(), "Obj6 = src.objects.objects.Exit", + "Obj6 changed typeclass from src.commands.default.tests.TestObjectClass to src.objects.objects.Exit") self.call(building.CmdLock(), "Obj6 = test:perm(Immortals)", "Added lock 'test:perm(Immortals)' to Obj6.") self.call(building.CmdExamine(), "Obj6", "Name/key: Obj6") self.call(building.CmdFind(), "TestRoom1", "One Match") diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index 3dcc97b3f2..2106ac4049 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -766,7 +766,6 @@ class TypedObject(SharedMemoryModel): # # - # these are identifiers for fast Attribute access and caching _typeclass_paths = settings.OBJECT_TYPECLASS_PATHS def __eq__(self, other): @@ -1001,7 +1000,7 @@ class TypedObject(SharedMemoryModel): logger.log_trace() return typeclass - def is_typeclass(self, typeclass, exact=False): + def is_typeclass(self, typeclass, exact=True): """ Returns true if this object has this type OR has a typeclass which is an subclass of