Some bugfixes and cleanup.

This commit is contained in:
Griatch 2010-11-21 20:01:52 +00:00
parent 502ebff1a2
commit b091cde574
4 changed files with 20 additions and 16 deletions

View file

@ -459,8 +459,7 @@ class CmdPuppet(MuxCommand):
if player.swap_character(new_character): if player.swap_character(new_character):
new_character.msg("You now control %s." % new_character.name) new_character.msg("You now control %s." % new_character.name)
else: else:
caller.msg("You couldn't control %s." % new_character.name) caller.msg("You cannot control %s." % new_character.name)
class CmdWall(MuxCommand): class CmdWall(MuxCommand):
""" """

View file

@ -1111,7 +1111,8 @@ class CmdTypeclass(MuxCommand):
Switch: Switch:
reset - clean out *all* the attributes on the object - reset - clean out *all* the attributes on the object -
basically making this a new clean object. basically making this a new clean object.
force - change to the typeclass also if the object
already has a typeclass of the same name.
Example: Example:
@type button = examples.red_button.RedButton @type button = examples.red_button.RedButton
@ -1174,18 +1175,20 @@ class CmdTypeclass(MuxCommand):
reset = "reset" in self.switches reset = "reset" in self.switches
old_typeclass = obj.typeclass old_typeclass = obj.typeclass_path
obj.swap_typeclass(typeclass, clean_attributes=reset) if old_typeclass == typeclass and not 'force' in self.switches:
new_typeclass = obj.typeclass string = "%s already has the typeclass '%s'." % (obj.name, typeclass)
else:
string = "%s's type is now %s (instead of %s).\n\r" % (obj.name, obj.swap_typeclass(typeclass, clean_attributes=reset)
new_typeclass, new_typeclass = obj.typeclass
old_typeclass) string = "%s's type is now %s (instead of %s).\n\r" % (obj.name,
if reset: new_typeclass,
string += "All attributes where reset." old_typeclass)
else: if reset:
string += "Note that the new class type could have overwritten " string += "All attributes where reset."
string += "same-named attributes on the existing object." else:
string += "Note that the new class type could have overwritten "
string += "same-named attributes on the existing object."
caller.msg(string) caller.msg(string)

View file

@ -39,6 +39,7 @@ PERMS = [
'typeclass', 'typeclass',
'debug', 'debug',
'puppet', 'puppet',
'typeclass',
'batchcommands', 'batchcommands',
'batchcodes', 'batchcodes',
@ -79,6 +80,7 @@ GROUPS = {
'reload', 'reload',
'service', 'service',
'perm', 'perm',
'typeclass',
'batchcommands', 'batchcommands',
'batchcodes']], 'batchcodes']],

View file

@ -417,7 +417,7 @@ def create_player(name, email, password,
new_user = User.objects.create_user(name, email, password) new_user = User.objects.create_user(name, email, password)
# create the associated Player for this User, and tie them together # create the associated Player for this User, and tie them together
new_player = PlayerDB(db_key=name, user=new_user, db_typeclass_path=typeclass) new_player = PlayerDB(db_key=name, user=new_user)
new_player.save() new_player.save()
# assign mud permissions # assign mud permissions