mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 16:26:30 +01:00
Cleaned up worst instability. Test suite does validate yet.
This commit is contained in:
parent
fa93c70e7f
commit
e36c7d5cc1
24 changed files with 134 additions and 300 deletions
|
|
@ -658,7 +658,7 @@ class ObjectDB(TypedObject):
|
|||
break
|
||||
return cmdhandler.cmdhandler(_GA(self, "typeclass"), raw_string, callertype="object", sessid=sessid)
|
||||
|
||||
def msg(self, text=None, **kwargs):#from_obj=None, data=None, sessid=0):
|
||||
def msg(self, text=None, from_obj=None, sessid=0, **kwargs):
|
||||
"""
|
||||
Emits something to a session attached to the object.
|
||||
|
||||
|
|
@ -670,22 +670,24 @@ class ObjectDB(TypedObject):
|
|||
If set to 0 (default), use either from_obj.sessid (if set) or self.sessid automatically
|
||||
If None, echo to all connected sessions
|
||||
"""
|
||||
if "data" in kwargs:
|
||||
from src.utils import logger
|
||||
logger.log_depmsg("ObjectDB.msg(): 'data'-dict keyword is deprecated. Use **kwargs instead.")
|
||||
data = kwargs.pop("data")
|
||||
if isinstance(data, dict):
|
||||
kwargs.update(data)
|
||||
|
||||
|
||||
if _GA(self, 'player'):
|
||||
# note that we must call the player *typeclass'* msg(), otherwise one couldn't overload it.
|
||||
if kwargs.get("sessid",0) == 0:
|
||||
sessid = None
|
||||
if "from_obj" in kwargs and hasattr(kwargs["from_obj"], "sessid"):
|
||||
kwargs["sessid"] = from_obj.sessid
|
||||
if not sessid:
|
||||
if from_obj and hasattr(from_obj, "sessid"):
|
||||
sessid = from_obj.sessid
|
||||
elif hasattr(self, "sessid"):
|
||||
kwargs["sessid"] = self.sessid
|
||||
_GA(_GA(self, 'player'), "typeclass").msg(text=text, **kwargs)#from_obj=from_obj, data=data, sessid=sessid)
|
||||
sessid = self.sessid
|
||||
_GA(_GA(self, 'player'), "typeclass").msg(text=text, from_obj=from_obj, sessid=sessid, **kwargs)
|
||||
|
||||
def emit_to(self, message, from_obj=None, data=None):
|
||||
"Deprecated. Alias for msg"
|
||||
logger.log_depmsg("emit_to() is deprecated. Use msg() instead.")
|
||||
_GA(self, "msg")(message, from_obj, data)
|
||||
|
||||
def msg_contents(self, message, exclude=None, from_obj=None, data=None):
|
||||
def msg_contents(self, message, exclude=None, from_obj=None, **kwargs):
|
||||
"""
|
||||
Emits something to all objects inside an object.
|
||||
|
||||
|
|
@ -697,12 +699,7 @@ class ObjectDB(TypedObject):
|
|||
contents = [obj for obj in contents
|
||||
if (obj not in exclude and obj not in exclude)]
|
||||
for obj in contents:
|
||||
obj.msg(message, from_obj=from_obj, data=data)
|
||||
|
||||
def emit_to_contents(self, message, exclude=None, from_obj=None, data=None):
|
||||
"Deprecated. Alias for msg_contents"
|
||||
logger.log_depmsg("emit_to_contents() is deprecated. Use msg_contents() instead.")
|
||||
self.msg_contents(message, exclude=exclude, from_obj=from_obj, data=data)
|
||||
obj.msg(message, from_obj=from_obj, **kwargs)
|
||||
|
||||
def move_to(self, destination, quiet=False,
|
||||
emit_to_obj=None, use_destination=True, to_none=False):
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ class Object(TypeClass):
|
|||
search(ostring, global_search=False, global_dbref=False, attribute_name=None,
|
||||
use_nicks=False, location=None, ignore_errors=False, player=False)
|
||||
execute_cmd(raw_string)
|
||||
msg(message, from_obj=None, data=None)
|
||||
msg_contents(message, exclude=None, from_obj=None, data=None)
|
||||
msg(message, **kwargs)
|
||||
msg_contents(message, exclude=None, from_obj=None, **kwargs)
|
||||
move_to(destination, quiet=False, emit_to_obj=None, use_destination=True, to_none=False)
|
||||
copy(new_key=None)
|
||||
delete()
|
||||
|
|
@ -222,7 +222,7 @@ class Object(TypeClass):
|
|||
"""
|
||||
return self.dbobj.execute_cmd(raw_string, sessid=sessid)
|
||||
|
||||
def msg(self, text=None, **kwargs):#message, from_obj=None, data=None, sessid=0):
|
||||
def msg(self, text=None, from_obj=None, sessid=None, **kwargs):
|
||||
"""
|
||||
Emits something to any sessions attached to the object.
|
||||
|
||||
|
|
@ -235,13 +235,13 @@ class Object(TypeClass):
|
|||
"""
|
||||
self.dbobj.msg(text=text, **kwargs)#message, from_obj=from_obj, data=data, sessid=0)
|
||||
|
||||
def msg_contents(self, message, exclude=None, from_obj=None, data=None):
|
||||
def msg_contents(self, text=None, exclude=None, from_obj=None, **kwargs):
|
||||
"""
|
||||
Emits something to all objects inside an object.
|
||||
|
||||
exclude is a list of objects not to send to. See self.msg() for more info.
|
||||
"""
|
||||
self.dbobj.msg_contents(message, exclude=exclude, from_obj=from_obj, data=data)
|
||||
self.dbobj.msg_contents(text, exclude=exclude, from_obj=from_obj, **kwargs)
|
||||
|
||||
def move_to(self, destination, quiet=False,
|
||||
emit_to_obj=None, use_destination=True, to_none=False):
|
||||
|
|
@ -653,7 +653,7 @@ class Object(TypeClass):
|
|||
"""
|
||||
pass
|
||||
|
||||
def at_msg_receive(self, text=None, **kwargs):#from_obj=None, data=None):
|
||||
def at_msg_receive(self, text=None, **kwargs):
|
||||
"""
|
||||
This hook is called whenever someone
|
||||
sends a message to this object.
|
||||
|
|
@ -674,7 +674,7 @@ class Object(TypeClass):
|
|||
"""
|
||||
return True
|
||||
|
||||
def at_msg_send(self, text=None, **kwargs):#msg, to_obj=None, data=None):
|
||||
def at_msg_send(self, text=None, to_obj=None, **kwargs):
|
||||
"""
|
||||
This is a hook that is called when /this/ object
|
||||
sends a message to another object with obj.msg()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue