dissallow to send a mesage to a block, which is outside radius
This commit is contained in:
parent
30ba9dc988
commit
f1599d4857
@ -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
|
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 = minetest.get_node(to_pos)
|
||||||
local node_def = minetest.registered_nodes[node.name]
|
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
|
if node_def.rc and node_def.rc.receive then
|
||||||
node_def.rc.receive(to_pos, msg, sender)
|
node_def.rc.receive(to_pos, msg, sender)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user