Fixing a bug in @ic if trying to puppet while already puppeting. Added sessid keyword to at_post_login hook in order to correctly relay login text only to the correct session. Removed the src.utils.debug module as well as the CmdDebug command which has not been supported for a good while.

This commit is contained in:
Griatch 2013-04-18 09:13:31 +02:00
parent a3f12a289d
commit 416d6e14bc
10 changed files with 22 additions and 316 deletions

View file

@ -6,14 +6,14 @@ Building and world design commands
from django.conf import settings
from src.objects.models import ObjectDB, ObjAttribute
from src.players.models import PlayerAttribute
from src.utils import create, utils, debug
from src.utils import create, utils
from src.utils.ansi import raw
from src.commands.default.muxcommand import MuxCommand
from src.commands.cmdhandler import get_and_merge_cmdsets
# limit symbol import for API
__all__ = ("ObjManipCommand", "CmdSetObjAlias", "CmdCopy",
"CmdCpAttr", "CmdMvAttr", "CmdCreate", "CmdDebug",
"CmdCpAttr", "CmdMvAttr", "CmdCreate",
"CmdDesc", "CmdDestroy", "CmdDig", "CmdTunnel", "CmdLink",
"CmdUnLink", "CmdSetHome", "CmdListCmdSets", "CmdName",
"CmdOpen", "CmdSetAttribute", "CmdTypeclass", "CmdWipe",
@ -426,49 +426,6 @@ class CmdCreate(ObjManipCommand):
if string:
caller.msg(string)
class CmdDebug(MuxCommand):
"""
Debug game entities
Usage:
@debug[/switch] <path to code>
Switches:
obj - debug an object
script - debug a script
Examples:
@debug/script game.gamesrc.scripts.myscript.MyScript
@debug/script myscript.MyScript
@debug/obj examples.red_button.RedButton
This command helps when debugging the codes of objects and scripts.
It creates the given object and runs tests on its hooks.
"""
key = "@debug"
locks = "cmd:perm(debug) or perm(Builders)"
help_category = "Building"
def func(self):
"Running the debug"
if not self.args or not self.switches:
self.caller.msg("Usage: @debug[/obj][/script] <path>")
return
path = self.args
if 'obj' in self.switches or 'object' in self.switches:
# create and debug the object
self.caller.msg(debug.debug_object(path, self.caller))
self.caller.msg(debug.debug_object_scripts(path, self.caller))
elif 'script' in self.switches:
self.caller.msg(debug.debug_syntax_script(path))
class CmdDesc(MuxCommand):
"""
@desc - describe an object or room

View file

@ -58,7 +58,6 @@ class CharacterCmdSet(CmdSet):
self.add(building.CmdTeleport())
self.add(building.CmdSetObjAlias())
self.add(building.CmdListCmdSets())
self.add(building.CmdDebug())
self.add(building.CmdWipe())
self.add(building.CmdSetAttribute())
self.add(building.CmdName())

View file

@ -237,7 +237,6 @@ class CmdIC(MuxPlayerCommand):
self.msg("{rYou may not become %s.{n" % new_character.name)
return
if player.puppet_object(sessid, new_character):
self.msg("\n{gYou become {c%s{n.\n" % new_character.name)
player.db._last_puppet = new_character
if not new_character.location:
# this might be due to being hidden away at logout; check
@ -245,10 +244,7 @@ class CmdIC(MuxPlayerCommand):
if not loc: # still no location; use home
loc = new_character.home
new_character.location = loc
if new_character.location:
new_character.location.msg_contents("%s has entered the game." % new_character.key, exclude=[new_character])
new_character.location.at_object_receive(new_character, new_character.location)
new_character.execute_cmd("look")
new_character.location.at_object_receive(new_character, new_character.location)
else:
self.msg("{rYou cannot become {C%s{n." % new_character.name)

View file

@ -96,7 +96,7 @@ class CmdUnconnectedConnect(MuxCommand):
# player.at_init() # always called when object is loaded from disk
# player.at_pre_login()
# player.at_first_login() # only once
# player.at_post_login()
# player.at_post_login(sessid=sessid)
session.sessionhandler.login(session, player)
class CmdUnconnectedCreate(MuxCommand):