Some minor edge-case fixes when using a session as caller.
This commit is contained in:
parent
f12c754225
commit
df74380155
2 changed files with 8 additions and 5 deletions
|
|
@ -434,15 +434,15 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
||||||
if "save" in self.switches:
|
if "save" in self.switches:
|
||||||
# save all options
|
# save all options
|
||||||
self.player.db._saved_protocol_flags = flags
|
self.caller.db._saved_protocol_flags = flags
|
||||||
self.msg("{gSaved all options. Use @option/clear to remove.{n")
|
self.msg("{gSaved all options. Use @option/clear to remove.{n")
|
||||||
if "clear" in self.switches:
|
if "clear" in self.switches:
|
||||||
# clear all saves
|
# clear all saves
|
||||||
self.player.db._saved_protocol_flags = {}
|
self.caller.db._saved_protocol_flags = {}
|
||||||
self.msg("{gCleared all saved options.")
|
self.msg("{gCleared all saved options.")
|
||||||
|
|
||||||
options = dict(flags) # make a copy of the flag dict
|
options = dict(flags) # make a copy of the flag dict
|
||||||
saved_options = dict(self.player.attributes.get("_saved_protocol_flags", default={}))
|
saved_options = dict(self.caller.attributes.get("_saved_protocol_flags", default={}))
|
||||||
|
|
||||||
if "SCREENWIDTH" in options:
|
if "SCREENWIDTH" in options:
|
||||||
if len(options["SCREENWIDTH"]) == 1:
|
if len(options["SCREENWIDTH"]) == 1:
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class NAttributeHandler(object):
|
||||||
"""
|
"""
|
||||||
return key in self._store
|
return key in self._store
|
||||||
|
|
||||||
def get(self, key):
|
def get(self, key, default=None):
|
||||||
"""
|
"""
|
||||||
Get the named key value.
|
Get the named key value.
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ class NAttributeHandler(object):
|
||||||
the value of the Nattribute.
|
the value of the Nattribute.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self._store.get(key, None)
|
return self._store.get(key, default)
|
||||||
|
|
||||||
def add(self, key, value):
|
def add(self, key, value):
|
||||||
"""
|
"""
|
||||||
|
|
@ -376,6 +376,9 @@ class ServerSession(Session):
|
||||||
for the protocol(s).
|
for the protocol(s).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# this can happen if this is triggered e.g. a command.msg
|
||||||
|
# that auto-adds the session, we'd get a kwarg collision.
|
||||||
|
kwargs.pop("session", None)
|
||||||
if text is not None:
|
if text is not None:
|
||||||
self.data_out(text=text, **kwargs)
|
self.data_out(text=text, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue