From 9dc3f8de8d178b629852c6a6cdbbfc81214e09b8 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 25 Dec 2019 21:52:02 +0000 Subject: [PATCH] Relocate choose_gender menu function Move the action logic for the choose_gender state from its corresponding facet to the menu module, hiding it behind a consistently-named entry point. --- mudpy/menu.py | 5 +++++ share/menu.yaml | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mudpy/menu.py b/mudpy/menu.py index e67dd04..b385198 100644 --- a/mudpy/menu.py +++ b/mudpy/menu.py @@ -29,3 +29,8 @@ def checking_new_account_name_action_d(user): def checking_new_account_name_action_g(user): """Destroy the new account, the user asked to go back to name entry.""" return user.account.destroy() + + +def choose_gender_action(user): + """Set the avatar's gender to the selected value.""" + return user.avatar.set("gender", user.menu_choices[user.choice]) diff --git a/share/menu.yaml b/share/menu.yaml index 5e8b344..37edaf0 100644 --- a/share/menu.yaml +++ b/share/menu.yaml @@ -40,8 +40,7 @@ menu.checking_password.echo: false menu.checking_password.error_incorrect: Incorrect password, please try again... menu.checking_password.prompt: "Password:" -menu.choose_gender.action: user.avatar.set("gender", - user.menu_choices[user.choice]) +menu.choose_gender.action: mudpy.menu.choose_gender_action(user) menu.choose_gender.branch: choose_name menu.choose_gender.choice_f: female menu.choose_gender.choice_m: male -- 2.11.0