summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2012-12-25 14:26:03 -0500
committerAnthony Zhang <azhang9@gmail.com>2012-12-25 14:26:03 -0500
commita9a2108d13af1fe06f5f91e841de4d057d363f56 (patch)
treedf9a115f15f9e796f879e5109544aa34908d53dc
parent973a9c650f72ce694bd31dfbc5d6030751ff7c05 (diff)
downloadmesecons-a9a2108d13af1fe06f5f91e841de4d057d363f56.tar
mesecons-a9a2108d13af1fe06f5f91e841de4d057d363f56.tar.gz
mesecons-a9a2108d13af1fe06f5f91e841de4d057d363f56.tar.bz2
mesecons-a9a2108d13af1fe06f5f91e841de4d057d363f56.tar.xz
mesecons-a9a2108d13af1fe06f5f91e841de4d057d363f56.zip
Implement /say and /tell commands to aid mapmakers using command blocks.
-rw-r--r--mesecons_commandblock/init.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/mesecons_commandblock/init.lua b/mesecons_commandblock/init.lua
index b61c85b..35eea25 100644
--- a/mesecons_commandblock/init.lua
+++ b/mesecons_commandblock/init.lua
@@ -1,3 +1,25 @@
+minetest.register_chatcommand("say", {
+ params = "<text>",
+ description = "Say <text> as the server",
+ privs = {server=true},
+ func = function(name, param)
+ minetest.chat_send_all(param)
+ end
+})
+
+minetest.register_chatcommand("tell", {
+ params = "<name> <text>",
+ description = "Say <text> to <name> privately",
+ func = function(name, param)
+ local found, _, target, message = param:find("^([^%s]+)%s+(.*)$")
+ if found == nil then
+ minetest.chat_send_player(name, "Invalid usage: " .. param)
+ return
+ end
+ minetest.chat_send_player(target, name .. " whispers: " .. message)
+ end
+})
+
local initialize_data = function(meta, player, command, param)
meta:set_string("formspec",
"invsize[9,6;]" ..