From 977864c649103520f68c8c89bf3e09cb001882f0 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Tue, 5 Dec 2006 23:38:57 +0000 Subject: [PATCH] Changing command functions from do_ to cmd_. Reads a little easier. --- evennia/trunk/cmdhandler.py | 8 ++++---- evennia/trunk/commands_general.py | 14 +++++++------- evennia/trunk/commands_staff.py | 12 ++++++------ evennia/trunk/commands_unloggedin.py | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/evennia/trunk/cmdhandler.py b/evennia/trunk/cmdhandler.py index 7fa558366..747410492 100755 --- a/evennia/trunk/cmdhandler.py +++ b/evennia/trunk/cmdhandler.py @@ -19,7 +19,7 @@ def handle(cdat): command, or return an invalid command error. We're basically grabbing the player's command by tacking - their input on to 'do_' and looking it up in the GenCommands + their input on to 'cmd_' and looking it up in the GenCommands class. """ session = cdat['session'] @@ -50,12 +50,12 @@ def handle(cdat): if session.logged_in: # If it's prefixed by an '@', it's a staff command. if parsed_input['root_cmd'][0] != '@': - cmd = getattr(commands_general, 'do_%s' % (parsed_input['root_cmd'],), None ) + cmd = getattr(commands_general, 'cmd_%s' % (parsed_input['root_cmd'],), None ) else: parsed_input['root_cmd'] = parsed_input['root_cmd'][1:] - cmd = getattr(commands_staff, 'do_%s' % (parsed_input['root_cmd'],), None ) + cmd = getattr(commands_staff, 'cmd_%s' % (parsed_input['root_cmd'],), None ) else: - cmd = getattr(commands_unloggedin, 'do_%s' % (parsed_input['root_cmd'],), None ) + cmd = getattr(commands_unloggedin, 'cmd_%s' % (parsed_input['root_cmd'],), None ) if callable(cmd): cdat['uinput'] = parsed_input diff --git a/evennia/trunk/commands_general.py b/evennia/trunk/commands_general.py index e59ca9e8e..df0bdb8fb 100644 --- a/evennia/trunk/commands_general.py +++ b/evennia/trunk/commands_general.py @@ -9,7 +9,7 @@ Generic command module. Pretty much every command should go here for now. """ -def do_look(cdat): +def cmd_look(cdat): """ Handle looking at objects. """ @@ -67,7 +67,7 @@ def do_look(cdat): for exit in con_exits: session.msg('%s(#%s)' %(exit.name, exit.id,)) -def do_quit(cdat): +def cmd_quit(cdat): """ Gracefully disconnect the user as per his own request. """ @@ -75,7 +75,7 @@ def do_quit(cdat): session.msg("Quitting!") session.handle_close() -def do_who(cdat): +def cmd_who(cdat): """ Generic WHO command. """ @@ -105,7 +105,7 @@ def do_who(cdat): session.msg(retval) -def do_say(cdat): +def cmd_say(cdat): """ Room-based speech command. """ @@ -120,7 +120,7 @@ def do_say(cdat): session.msg(retval) -def do_version(cdat): +def cmd_version(cdat): """ Version info command. """ @@ -130,14 +130,14 @@ def do_version(cdat): retval += "-"*50 session.msg(retval) -def do_time(cdat): +def cmd_time(cdat): """ Server local time. """ session = cdat['session'] session.msg('Current server time : %s' % (time.strftime('%a %b %d %H:%M %Y (%Z)', time.localtime(),))) -def do_uptime(cdat): +def cmd_uptime(cdat): """ Server uptime and stats. """ diff --git a/evennia/trunk/commands_staff.py b/evennia/trunk/commands_staff.py index 29a50e9da..1465da4d0 100644 --- a/evennia/trunk/commands_staff.py +++ b/evennia/trunk/commands_staff.py @@ -7,7 +7,7 @@ import cmdhandler Restricted staff commands. """ -def do_dig(cdat): +def cmd_dig(cdat): """ Digs a new room out. """ @@ -22,7 +22,7 @@ def do_dig(cdat): newroom.name = roomname newroom.type = "Room" -def do_nextfree(cdat): +def cmd_nextfree(cdat): """ Returns the next free object number. """ @@ -34,7 +34,7 @@ def do_nextfree(cdat): session.msg(retval) -def do_teleport(cdat): +def cmd_teleport(cdat): """ Teleports an object somewhere. """ @@ -104,11 +104,11 @@ def do_teleport(cdat): return session.msg("Teleported.") pobject.move_to(server, results[0]) - commands_general.do_look(cdat) + commands_general.cmd_look(cdat) #session.msg("Args: %s\n\rEqargs: %s" % (args, eq_args,)) -def do_find(cdat): +def cmd_find(cdat): """ Searches for an object of a particular name. """ @@ -133,7 +133,7 @@ def do_find(cdat): else: session.msg("No name matches found for: %s" % (searchstring,)) -def do_shutdown(cdat): +def cmd_shutdown(cdat): """ Shut the server down gracefully. """ diff --git a/evennia/trunk/commands_unloggedin.py b/evennia/trunk/commands_unloggedin.py index cf7cf9a4e..fc1027a96 100644 --- a/evennia/trunk/commands_unloggedin.py +++ b/evennia/trunk/commands_unloggedin.py @@ -5,7 +5,7 @@ import functions_db Commands that are available from the connect screen. """ -def do_connect(cdat): +def cmd_connect(cdat): """ This is the connect command at the connection screen. Fairly simple, uses the Django database API and User model to make it extremely simple. @@ -26,7 +26,7 @@ def do_connect(cdat): uname = user.username session.login(user) -def do_create(cdat): +def cmd_create(cdat): """ Handle the creation of new accounts. """ @@ -45,7 +45,7 @@ def do_create(cdat): else: functions_db.create_user(cdat, uname, email, password) -def do_quit(cdat): +def cmd_quit(cdat): """ We're going to maintain a different version of the quit command here for unconnected users for the sake of simplicity. The logged in