Make command actions implicit
authorJeremy Stanley <fungi@yuggoth.org>
Sun, 12 May 2019 13:22:42 +0000 (13:22 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Sun, 12 May 2019 13:22:42 +0000 (13:22 +0000)
If an action is not listed for a command, assume the action function
is named the same as the command itself.

mudpy/misc.py
share/command.yaml

index 045e6a5..e76b4dd 100644 (file)
@@ -1893,7 +1893,7 @@ def handler_active(user):
         if actor.can_run(command):
             # dereference the relative object path for the requested function
             action = mudpy
         if actor.can_run(command):
             # dereference the relative object path for the requested function
             action = mudpy
-            for component in command.get("action").split("."):
+            for component in command.get("action", command.key).split("."):
                 try:
                     action = getattr(action, component)
                     ran = True
                 try:
                     action = getattr(action, component)
                     ran = True
index fe78f1f..e5d113f 100644 (file)
@@ -7,7 +7,6 @@ _desc: This is the standard library of command definitions.
 
 _lock: true
 
 
 _lock: true
 
-command.chat.action: command.chat
 command.chat.description: Enter and leave chat mode.
 command.chat.help: The chat command toggles chat mode. When in chat mode, all
     input is passed as a parameter to the say command, unless prepended by an
 command.chat.description: Enter and leave chat mode.
 command.chat.help: The chat command toggles chat mode. When in chat mode, all
     input is passed as a parameter to the say command, unless prepended by an
@@ -15,46 +14,38 @@ command.chat.help: The chat command toggles chat mode. When in chat mode, all
     use:$(eol)$(eol)   !chat
 command.chat.see_also: say
 
     use:$(eol)$(eol)   !chat
 command.chat.see_also: say
 
-command.create.action: command.create
 command.create.administrative: true
 command.create.description: Create a new element in the universe.
 command.create.help: Ways to create an element:$(eol)$(eol)   create
     actor.avatar_fred_1$(eol)   create other.garply foo/bar/baz
 
 command.create.administrative: true
 command.create.description: Create a new element in the universe.
 command.create.help: Ways to create an element:$(eol)$(eol)   create
     actor.avatar_fred_1$(eol)   create other.garply foo/bar/baz
 
-command.delete.action: command.delete
 command.delete.administrative: true
 command.delete.description: Delete an existing facet from an element.
 command.delete.help: You can delete any facet of an element as
     follows:$(eol)$(eol)   delete area.boardroom terrain
 
 command.delete.administrative: true
 command.delete.description: Delete an existing facet from an element.
 command.delete.help: You can delete any facet of an element as
     follows:$(eol)$(eol)   delete area.boardroom terrain
 
-command.destroy.action: command.destroy
 command.destroy.administrative: true
 command.destroy.description: Destroy an existing element in the universe.
 command.destroy.help: You can destroy any element in the universe as
     follows:$(eol)$(eol)   destroy prop.dagger
 
 command.destroy.administrative: true
 command.destroy.description: Destroy an existing element in the universe.
 command.destroy.help: You can destroy any element in the universe as
     follows:$(eol)$(eol)   destroy prop.dagger
 
-command.halt.action: command.halt
 command.halt.administrative: true
 command.halt.description: Shut down the world.
 command.halt.help: This will save all active accounts, disconnect all clients
     and stop the entire program.
 
 command.halt.administrative: true
 command.halt.description: Shut down the world.
 command.halt.help: This will save all active accounts, disconnect all clients
     and stop the entire program.
 
-command.help.action: command.help
 command.help.description: List commands or get help on one.
 command.help.help: This will list all comand words available to you along with
     a brief description or, alternatively, give you detailed information on one
     command.
 
 command.help.description: List commands or get help on one.
 command.help.help: This will list all comand words available to you along with
     a brief description or, alternatively, give you detailed information on one
     command.
 
-command.look.action: command.look
 command.look.description: Look around.
 command.look.help: With the look command, you can see where you are.
 
 command.look.description: Look around.
 command.look.help: With the look command, you can see where you are.
 
-command.move.action: command.move
 command.move.description: Move in a specific direction.
 command.move.help: You move in a direction by entering:$(eol)$(eol)   move
     north
 
 command.move.description: Move in a specific direction.
 command.move.help: You move in a direction by entering:$(eol)$(eol)   move
     north
 
-command.preferences.action: command.preferences
 command.preferences.description: View or change your preferences.
 command.preferences.help: If invoked with no parameters, all your current
     preferences and their values are listed. If one parameter is supplied, the
 command.preferences.description: View or change your preferences.
 command.preferences.help: If invoked with no parameters, all your current
     preferences and their values are listed. If one parameter is supplied, the
@@ -64,18 +55,15 @@ command.preferences.help: If invoked with no parameters, all your current
     Examples:$(eol)$(eol)   preferences$(eol)   preferences
     prompt$(eol)   preferences prompt $_(time)>
 
     Examples:$(eol)$(eol)   preferences$(eol)   preferences
     prompt$(eol)   preferences prompt $_(time)>
 
-command.quit.action: command.quit
 command.quit.description: Leave the World.
 command.quit.help: This will deactivate your avatar and return you to the main
     menu.
 
 command.quit.description: Leave the World.
 command.quit.help: This will deactivate your avatar and return you to the main
     menu.
 
-command.reload.action: command.reload
 command.reload.administrative: true
 command.reload.description: Reload modules and data.
 command.reload.help: This will reload all python modules and read-only data
     files.
 
 command.reload.administrative: true
 command.reload.description: Reload modules and data.
 command.reload.help: This will reload all python modules and read-only data
     files.
 
-command.say.action: command.say
 command.say.description: State something out loud.
 command.say.help: This allows you to speak to other characters within the same
     area. If you end your sentence with punctuation, the message displayed will
 command.say.description: State something out loud.
 command.say.help: This allows you to speak to other characters within the same
     area. If you end your sentence with punctuation, the message displayed will
@@ -95,7 +83,6 @@ command.set.help: Invoke it like
     this:$(eol)$(eol)   set actor.avatar_dominique_0 description You see
     nothing special.
 
     this:$(eol)$(eol)   set actor.avatar_dominique_0 description You see
     nothing special.
 
-command.show.action: command.show
 command.show.administrative: true
 command.show.description: Show various data.
 command.show.help: Here are the possible incantations (<parameter> is required,
 command.show.administrative: true
 command.show.description: Show various data.
 command.show.help: Here are the possible incantations (<parameter> is required,