Lots of debug messages.

This commit is contained in:
Griatch 2016-10-11 21:49:52 +02:00
parent cc76de348e
commit 1981f8073f
3 changed files with 14 additions and 4 deletions

View file

@ -272,30 +272,39 @@ def get_and_merge_cmdsets(caller, session, player, obj, callertype):
except AttributeError:
returnValue(((None, None, None), []))
print "callertype:", callertype
local_obj_cmdsets = []
if callertype == "session":
# we are calling the command from the session level
report_to = session
current, cmdsets = yield _get_cmdsets(session)
print "session cmdsets:", len(cmdsets)
if player: # this automatically implies logged-in
pcurrent, player_cmdsets = yield _get_cmdsets(player)
print "player cmdsets:", len(player_cmdsets)
cmdsets += player_cmdsets
current = current + pcurrent
if obj:
ocurrent, obj_cmdsets = yield _get_cmdsets(obj)
print "obj_cmdsets:", len(obj_cmdsets), [cmdset.key for cmdset in obj_cmdsets]
current = current + ocurrent
cmdsets += obj_cmdsets
if not current.no_objs:
local_obj_cmdsets = yield _get_local_obj_cmdsets(obj)
print "local_obj_cmdsets:", len(local_obj_cmdsets), [cmdset.key for cmdset in local_obj_cmdsets]
if current.no_exits:
# filter out all exits
local_obj_cmdsets = [cmdset for cmdset in local_obj_cmdsets if cmdset.key != "ExitCmdSet"]
cmdsets += local_obj_cmdsets
if not current.no_channels:
# also objs may have channels
cmdsets += yield _get_channel_cmdset(obj)
channel_cmdsets = yield _get_channel_cmdset(obj)
print "obj channel cmdsets:", len(channel_cmdsets), [cmdset.key for cmdset in channel_cmdsets]
cmdsets += channel_cmdsets
if not current.no_channels:
cmdsets += yield _get_channel_cmdset(player)
channel_cmdsets = yield _get_channel_cmdset(obj)
print "player channel cmdsets:", len(channel_cmdsets), [cmdset.key for cmdset in channel_cmdsets]
cmdsets += channel_cmdsets
elif callertype == "player":
# we are calling the command from the player level
@ -343,6 +352,7 @@ def get_and_merge_cmdsets(caller, session, player, obj, callertype):
if cmdsets:
# faster to do tuple on list than to build tuple directly
mergehash = tuple([id(cmdset) for cmdset in cmdsets])
print "len(mergehash):", len(mergehash)
if mergehash in _CMDSET_MERGE_CACHE:
# cached merge exist; use that
cmdset = _CMDSET_MERGE_CACHE[mergehash]
@ -372,7 +382,6 @@ def get_and_merge_cmdsets(caller, session, player, obj, callertype):
_CMDSET_MERGE_CACHE[mergehash] = cmdset
else:
cmdset = None
for cset in (cset for cset in local_obj_cmdsets if cset):
cset.duplicates = cset.old_duplicates
returnValue(cmdset)

View file

@ -68,6 +68,7 @@ class CmdLook(COMMAND_DEFAULT_CLASS):
target = self.caller.search(self.args)
if not target:
return
print "cmdlook:", id(self), id(self.cmdset)
self.msg(self.caller.at_look(target))

View file

@ -42,7 +42,7 @@ command definition too) with function defintions:
# code
return text, options
def node_with_other_namen(caller, input_string):
def node_with_other_name(caller, input_string):
# code
return text, options
```