Added a missing execute_cmd on the Session. It got lost after the inputfunc changes.
This commit is contained in:
parent
8bf63885e2
commit
68e5c4d283
3 changed files with 26 additions and 6 deletions
|
|
@ -424,11 +424,10 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
||||||
|
|
||||||
def execute_cmd(self, raw_string, session=None, **kwargs):
|
def execute_cmd(self, raw_string, session=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Do something as this object. This method is a copy of the
|
Do something as this object. This is never called normally,
|
||||||
`execute_cmd` method on the session. This is never called
|
it's only used when wanting specifically to let an object be
|
||||||
normally, it's only used when wanting specifically to let an
|
the caller of a command. It makes use of nicks of eventual
|
||||||
object be the caller of a command. It makes use of nicks of
|
connected players as well.
|
||||||
eventual connected players as well.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
raw_string (string): Raw command input
|
raw_string (string): Raw command input
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ def text(session, *args, **kwargs):
|
||||||
else:
|
else:
|
||||||
text = session.player.nicks.nickreplace(text,
|
text = session.player.nicks.nickreplace(text,
|
||||||
categories=("inputline", "channels"), include_player=False)
|
categories=("inputline", "channels"), include_player=False)
|
||||||
cmdhandler(session, text, callertype="session", session=session)
|
kwargs.pop("options", None)
|
||||||
|
cmdhandler(session, text, callertype="session", session=session, **kwargs)
|
||||||
session.update_session_counters()
|
session.update_session_counters()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -381,6 +381,26 @@ class ServerSession(Session):
|
||||||
else:
|
else:
|
||||||
self.data_out(**kwargs)
|
self.data_out(**kwargs)
|
||||||
|
|
||||||
|
def execute_cmd(self, raw_string, **kwargs):
|
||||||
|
"""
|
||||||
|
Do something as this object. This method is normally never
|
||||||
|
called directly, instead incoming command instructions are
|
||||||
|
sent to the appropriate inputfunc already at the sessionhandler
|
||||||
|
level. This method allows Python code to inject commands into
|
||||||
|
this stream, and will lead to the text inputfunc be called.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
raw_string (string): Raw command input
|
||||||
|
Kwargs:
|
||||||
|
Other keyword arguments will be added to the found command
|
||||||
|
object instace as variables before it executes. This is
|
||||||
|
unused by default Evennia but may be used to set flags and
|
||||||
|
change operating paramaters for commands at run-time.
|
||||||
|
|
||||||
|
"""
|
||||||
|
# inject instruction into input stream
|
||||||
|
kwargs["text"] = ((raw_string,), {})
|
||||||
|
self.sessionhandler.data_in(self, **kwargs)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
"Handle session comparisons"
|
"Handle session comparisons"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue