From fe5336ce6630c2ab2a19e56889944e9a6a2db5d6 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 7 Jul 2014 21:56:56 -0500 Subject: [PATCH] start of limited range chat feature --- mods/chat/init.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/mods/chat/init.lua b/mods/chat/init.lua index 7e7e54c..4248289 100644 --- a/mods/chat/init.lua +++ b/mods/chat/init.lua @@ -7,13 +7,15 @@ end) ]] chat.local_chat = function(pos,text,radius) - if radius == nil then - radius = 25 - end - local oir = minetest.get_objects_inside_radius(pos, radius) - for _,p in pairs(oir) do - if p:is_player() then - minetest.chat_send_player(p:get_player_name(),text) - end - end + if radius == nil then + radius = 25 + end + if pos ~= nil then + local oir = minetest.get_objects_inside_radius(pos, radius) + for _,p in pairs(oir) do + if p:is_player() then + minetest.chat_send_player(p:get_player_name(),text) + end + end + end end \ No newline at end of file