Skip to content

Commit 84f0e23

Browse files
committedFeb 23, 2014
Add worldedit_shortcommands, which adds aliases to commonly used chat 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`.
1 parent be913e6 commit 84f0e23

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed
 

‎Chat Commands.md

+21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@ Chat Commands
22
-------------
33
For more information, see the [README](README.md).
44

5+
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:
6+
7+
| Short Name | Original Name |
8+
|:-----------|:-------------------|
9+
| `//i` | `//inspect` |
10+
| `//rst` | `//reset` |
11+
| `//mk` | `//mark` |
12+
| `//umk` | `//unmark` |
13+
| `//1` | `//pos1` |
14+
| `//2` | `//pos2` |
15+
| `//fp` | `//fixedpos` |
16+
| `//v` | `//volume` |
17+
| `//s` | `//set` |
18+
| `//r` | `//replace` |
19+
| `//ri` | `//replaceinverse` |
20+
| `//hspr` | `//hollowsphere` |
21+
| `//spr` | `//sphere` |
22+
| `//hdo` | `//hollowdome` |
23+
| `//do` | `//dome` |
24+
| `//hcyl` | `//hollowcylinder` |
25+
526
### `//about`
627

728
Get information about the mod.

‎worldedit_shortcommands/depends.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
worldedit_commands

‎worldedit_shortcommands/init.lua

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
--provides shorter names for the commands in `worldedit_commands`
2+
3+
--returns true if command could not be aliased, false otherwise
4+
worldedit.alias_chatcommand = function(alias, original_command)
5+
if not minetest.chatcommands[original_command] then
6+
minetest.log("error", "worldedit_shortcommands: original command " .. original_command .. " does not exist")
7+
return true
8+
end
9+
if minetest.chatcommands[alias] then
10+
minetest.log("error", "worldedit_shortcommands: alias " .. alias .. " already exists")
11+
return true
12+
end
13+
minetest.register_chatcommand(alias, minetest.chatcommands[original_command])
14+
return false
15+
end
16+
17+
worldedit.alias_chatcommand("/i", "/inspect")
18+
worldedit.alias_chatcommand("/rst", "/reset")
19+
worldedit.alias_chatcommand("/mk", "/mark")
20+
worldedit.alias_chatcommand("/umk", "/unmark")
21+
worldedit.alias_chatcommand("/1", "/pos1")
22+
worldedit.alias_chatcommand("/2", "/pos2")
23+
worldedit.alias_chatcommand("/fp", "/fixedpos")
24+
worldedit.alias_chatcommand("/v", "/volume")
25+
worldedit.alias_chatcommand("/s", "/set")
26+
worldedit.alias_chatcommand("/r", "/replace")
27+
worldedit.alias_chatcommand("/ri", "/replaceinverse")
28+
worldedit.alias_chatcommand("/hspr", "/hollowsphere")
29+
worldedit.alias_chatcommand("/spr", "/sphere")
30+
worldedit.alias_chatcommand("/hdo", "/hollowdome")
31+
worldedit.alias_chatcommand("/do", "/dome")
32+
worldedit.alias_chatcommand("/hcyl", "/hollowcylinder")
33+
worldedit.alias_chatcommand("/cyl", "/cylinder")
34+
worldedit.alias_chatcommand("/pyr", "/pyramid")
35+
worldedit.alias_chatcommand("/spl", "/spiral")
36+
worldedit.alias_chatcommand("/m", "/move")
37+
worldedit.alias_chatcommand("/c", "/copy")
38+
worldedit.alias_chatcommand("/stk", "/stack")
39+
worldedit.alias_chatcommand("/sch", "/stretch")
40+
worldedit.alias_chatcommand("/tps", "/transpose")
41+
worldedit.alias_chatcommand("/fl", "/flip")
42+
worldedit.alias_chatcommand("/rot", "/rotate")
43+
worldedit.alias_chatcommand("/ort", "/orient")
44+
worldedit.alias_chatcommand("/hi", "/hide")
45+
worldedit.alias_chatcommand("/sup", "/suppress")
46+
worldedit.alias_chatcommand("/hlt", "/highlight")
47+
worldedit.alias_chatcommand("/rsr", "/restore")
48+
worldedit.alias_chatcommand("/l", "/lua")
49+
worldedit.alias_chatcommand("/lt", "/luatransform")
50+
worldedit.alias_chatcommand("/clro", "/clearobjects")

0 commit comments

Comments
 (0)