dissallow to send a mesage to a block, which is outside radius

This commit is contained in:
cpdef 2017-03-14 17:33:05 +01:00
parent 30ba9dc988
commit f1599d4857

View File

@ -13,6 +13,8 @@ rc.send = function(radius, from_pos, to_pos, msg, sender)
if ((not is_valid_pos(from_pos)) or (not is_valid_pos(to_pos))) then return end
local node = minetest.get_node(to_pos)
local node_def = minetest.registered_nodes[node.name]
local distance = vector.distance(from_pos, to_pos)
if distance > radius then return end
if node_def.rc and node_def.rc.receive then
node_def.rc.receive(to_pos, msg, sender)
end