mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 01:36:32 +01:00
Finish up single-character aliases for pose, say, and pose/nospace.
This commit is contained in:
parent
4f67efb70a
commit
a1bc2375ef
2 changed files with 27 additions and 1 deletions
|
|
@ -63,12 +63,32 @@ def handle(cdat):
|
|||
return
|
||||
# If it's prefixed by an '@', it's a staff command.
|
||||
if parsed_input['root_cmd'][0] != '@':
|
||||
# Shortened say alias.
|
||||
if parsed_input['root_cmd'][0] == '"':
|
||||
parsed_input['splitted'].insert(0, "say")
|
||||
parsed_input['splitted'][1] = parsed_input['splitted'][1][1:]
|
||||
parsed_input['root_cmd'] = 'say'
|
||||
# Shortened pose alias.
|
||||
elif parsed_input['root_cmd'][0] == ':':
|
||||
parsed_input['splitted'].insert(0, "pose")
|
||||
parsed_input['splitted'][1] = parsed_input['splitted'][1][1:]
|
||||
parsed_input['root_cmd'] = 'pose'
|
||||
# Pose without space alias.
|
||||
elif parsed_input['root_cmd'][0] == ';':
|
||||
parsed_input['splitted'].insert(0, "pose/nospace")
|
||||
parsed_input['root_chunk'] = ['pose', 'nospace']
|
||||
parsed_input['splitted'][1] = parsed_input['splitted'][1][1:]
|
||||
parsed_input['root_cmd'] = 'pose'
|
||||
cmd = getattr(commands_general, 'cmd_%s' % (parsed_input['root_cmd'],), None )
|
||||
else:
|
||||
parsed_input['root_cmd'] = parsed_input['root_cmd'][1:]
|
||||
cmd = getattr(commands_privileged, 'cmd_%s' % (parsed_input['root_cmd'],), None )
|
||||
else:
|
||||
cmd = getattr(commands_unloggedin, 'cmd_%s' % (parsed_input['root_cmd'],), None )
|
||||
|
||||
# Debugging stuff.
|
||||
#session.msg("ROOT : %s" % (parsed_input['root_cmd'],))
|
||||
#session.msg("SPLIT: %s" % (parsed_input['splitted'],))
|
||||
|
||||
if callable(cmd):
|
||||
cdat['uinput'] = parsed_input
|
||||
|
|
|
|||
|
|
@ -355,6 +355,7 @@ def cmd_pose(cdat):
|
|||
Pose/emote command.
|
||||
"""
|
||||
session = cdat['session']
|
||||
switches = cdat['uinput']['root_chunk'][1:]
|
||||
|
||||
if not functions_general.cmd_check_num_args(session, cdat['uinput']['splitted'], 1, errortext="Do what?"):
|
||||
return
|
||||
|
|
@ -363,10 +364,15 @@ def cmd_pose(cdat):
|
|||
pobject = session.get_pobject()
|
||||
speech = ' '.join(cdat['uinput']['splitted'][1:])
|
||||
|
||||
if "nospace" in switches:
|
||||
sent_msg = "%s%s" % (pobject.get_name(show_dbref=False), speech)
|
||||
else:
|
||||
sent_msg = "%s %s" % (pobject.get_name(show_dbref=False), speech)
|
||||
|
||||
players_present = [player for player in session_list if player.get_pobject().get_location() == session.get_pobject().get_location()]
|
||||
|
||||
for player in players_present:
|
||||
player.msg("%s %s" % (pobject.get_name(show_dbref=False), speech))
|
||||
player.msg(sent_msg)
|
||||
|
||||
def cmd_help(cdat):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue