Fixed character swap mechanisms. Created an example command @puppet for switching control between characters (note that it does not currently check permissions, nor make sure the target has the appropriate cmdsets).

This commit is contained in:
Griatch 2010-10-18 21:07:26 +00:00
parent 922a7d5064
commit 9459178c43
8 changed files with 107 additions and 56 deletions

View file

@ -75,6 +75,7 @@ class DefaultCmdSet(CmdSet):
self.add(objmanip.CmdDestroy())
self.add(objmanip.CmdExamine())
self.add(objmanip.CmdTypeclass())
self.add(objmanip.CmdPuppet())
# Comm commands
self.add(comms.CmdAddCom())

View file

@ -1635,3 +1635,35 @@ class CmdTypeclass(MuxCommand):
string += "same-named attributes on the existing object."
caller.msg(string)
class CmdPuppet(MuxCommand):
"""
Switch control to an object
Usage:
@puppet <character object>
This will attempt to "become" a different character. Note that this command does not check so that
the target object has the appropriate cmdset. You cannot puppet a character that is already "taken".
"""
key = "@puppet"
permissions = "cmd:puppet"
help_category = "Admin"
def func(self):
"""
Simple puppet method (does not check permissions)
"""
caller = self.caller
if not self.args:
caller.msg("Usage: @puppet <character>")
return
player = caller.player
new_character = caller.search(self.args)
if not new_character:
return
if player.swap_character(new_character):
new_character.msg("You now control %s." % new_character.name)
else:
caller.msg("You couldn't control %s." % new_character.name)