From bc3ee2dd11df80f98cd391a094a17c20df322e7c Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 30 Dec 2019 17:52:01 +0000 Subject: [PATCH] Make sure all command functions return True Because recent adjustments to handler_active() rely on the call_handler_function() return value to determine whether something went wrong, we need command functions to return something which evaluates boolean True if they ran to completion and didn't raise an exception. Just return True from all of them for now, but they may see more dynamic result handling in the future. --- mudpy/command.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mudpy/command.py b/mudpy/command.py index d72e4e3..ea77939 100644 --- a/mudpy/command.py +++ b/mudpy/command.py @@ -23,6 +23,7 @@ def chat(actor, parameters): actor.send("Exiting chat mode.") else: actor.send("Sorry, but you're already busy with something else!") + return True def create(actor, parameters): @@ -57,6 +58,7 @@ def create(actor, parameters): elif len(arguments) > 2: message = "You can only specify an element and a filename." actor.send(message) + return True def delete(actor, parameters): @@ -84,6 +86,7 @@ def delete(actor, parameters): + '". Try "show element ' + element + '" for verification.') actor.send(message) + return True def destroy(actor, parameters): @@ -105,6 +108,7 @@ def destroy(actor, parameters): 6 ) actor.send(message) + return True def error(actor, input_data): @@ -127,6 +131,7 @@ def error(actor, input_data): mudpy.misc.log( 'Sending a command error to user %s raised exception...\n%s' % ( actor.owner.account.get("name"), traceback.format_exc())) + return True def halt(actor, parameters): @@ -147,6 +152,7 @@ def halt(actor, parameters): # set a flag to terminate the world actor.universe.terminate_flag = True + return True def help(actor, parameters): @@ -253,6 +259,7 @@ def help(actor, parameters): # send the accumulated output to the user actor.send(output) + return True def look(actor, parameters): @@ -261,6 +268,7 @@ def look(actor, parameters): actor.send("You can't look at or in anything yet.") else: actor.look_at(actor.get("location")) + return True def move(actor, parameters): @@ -271,6 +279,7 @@ def move(actor, parameters): actor.move_direction(portal) return(portal) actor.send("You cannot go that way.") + return True def preferences(actor, parameters): @@ -318,6 +327,7 @@ def preferences(actor, parameters): 'Preference "%s" cannot be set to type "%s".' % ( pref, type(value))) actor.send(message) + return True def quit(actor, parameters): @@ -325,6 +335,7 @@ def quit(actor, parameters): if actor.owner: actor.owner.state = "main_utility" actor.owner.deactivate_avatar() + return True def reload(actor, parameters): @@ -341,6 +352,7 @@ def reload(actor, parameters): # set a flag to reload actor.universe.reload_flag = True + return True def say(actor, parameters): @@ -424,6 +436,7 @@ def say(actor, parameters): # there was no message else: actor.send("What do you want to say?") + return True def c_set(actor, parameters): @@ -461,6 +474,7 @@ def c_set(actor, parameters): + '". Try "show element ' + element + '" for verification.') actor.send(message) + return True def show(actor, parameters): @@ -581,3 +595,4 @@ def show(actor, parameters): else: message = '''I don't know what "''' + parameters + '" is.' actor.send(message) + return True -- 2.11.0