Skip to content

Commit

Permalink
Add worldedit_shortcommands, which adds aliases to commonly used ch…
Browse files Browse the repository at this point in the history
…at commands that allow users to type in long command names faster. Idea is courtesy of @electricface.

For example, `//move ? 5` can now be written as `//m ? 5`.
  • Loading branch information
Uberi committed Feb 23, 2014
1 parent be913e6 commit 84f0e23
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Chat Commands.md
Expand Up @@ -2,6 +2,27 @@ Chat Commands
-------------
For more information, see the [README](README.md).

Many commands also have shorter names that can be typed faster. For example, if we wanted to use `//move ? 5`, we could instead type `//m ? 5`. All shortened names are listed below:

| Short Name | Original Name |
|:-----------|:-------------------|
| `//i` | `//inspect` |
| `//rst` | `//reset` |
| `//mk` | `//mark` |
| `//umk` | `//unmark` |
| `//1` | `//pos1` |
| `//2` | `//pos2` |
| `//fp` | `//fixedpos` |
| `//v` | `//volume` |
| `//s` | `//set` |
| `//r` | `//replace` |
| `//ri` | `//replaceinverse` |
| `//hspr` | `//hollowsphere` |
| `//spr` | `//sphere` |
| `//hdo` | `//hollowdome` |
| `//do` | `//dome` |
| `//hcyl` | `//hollowcylinder` |

### `//about`

Get information about the mod.
Expand Down
1 change: 1 addition & 0 deletions worldedit_shortcommands/depends.txt
@@ -0,0 +1 @@
worldedit_commands
50 changes: 50 additions & 0 deletions worldedit_shortcommands/init.lua
@@ -0,0 +1,50 @@
--provides shorter names for the commands in `worldedit_commands`

--returns true if command could not be aliased, false otherwise
worldedit.alias_chatcommand = function(alias, original_command)
if not minetest.chatcommands[original_command] then
minetest.log("error", "worldedit_shortcommands: original command " .. original_command .. " does not exist")
return true
end
if minetest.chatcommands[alias] then
minetest.log("error", "worldedit_shortcommands: alias " .. alias .. " already exists")
return true
end
minetest.register_chatcommand(alias, minetest.chatcommands[original_command])
return false
end

worldedit.alias_chatcommand("/i", "/inspect")
worldedit.alias_chatcommand("/rst", "/reset")
worldedit.alias_chatcommand("/mk", "/mark")
worldedit.alias_chatcommand("/umk", "/unmark")
worldedit.alias_chatcommand("/1", "/pos1")
worldedit.alias_chatcommand("/2", "/pos2")
worldedit.alias_chatcommand("/fp", "/fixedpos")
worldedit.alias_chatcommand("/v", "/volume")
worldedit.alias_chatcommand("/s", "/set")
worldedit.alias_chatcommand("/r", "/replace")
worldedit.alias_chatcommand("/ri", "/replaceinverse")
worldedit.alias_chatcommand("/hspr", "/hollowsphere")
worldedit.alias_chatcommand("/spr", "/sphere")
worldedit.alias_chatcommand("/hdo", "/hollowdome")
worldedit.alias_chatcommand("/do", "/dome")
worldedit.alias_chatcommand("/hcyl", "/hollowcylinder")
worldedit.alias_chatcommand("/cyl", "/cylinder")
worldedit.alias_chatcommand("/pyr", "/pyramid")
worldedit.alias_chatcommand("/spl", "/spiral")
worldedit.alias_chatcommand("/m", "/move")
worldedit.alias_chatcommand("/c", "/copy")
worldedit.alias_chatcommand("/stk", "/stack")
worldedit.alias_chatcommand("/sch", "/stretch")
worldedit.alias_chatcommand("/tps", "/transpose")
worldedit.alias_chatcommand("/fl", "/flip")
worldedit.alias_chatcommand("/rot", "/rotate")
worldedit.alias_chatcommand("/ort", "/orient")
worldedit.alias_chatcommand("/hi", "/hide")
worldedit.alias_chatcommand("/sup", "/suppress")
worldedit.alias_chatcommand("/hlt", "/highlight")
worldedit.alias_chatcommand("/rsr", "/restore")
worldedit.alias_chatcommand("/l", "/lua")
worldedit.alias_chatcommand("/lt", "/luatransform")
worldedit.alias_chatcommand("/clro", "/clearobjects")

0 comments on commit 84f0e23

Please sign in to comment.