mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-11-15 23:00:32 +01:00
Update init.lua
This commit is contained in:
parent
73daf0f35e
commit
75d21863ae
|
@ -181,11 +181,17 @@ local node_detector_digiline = {
|
||||||
effector = {
|
effector = {
|
||||||
action = function(pos, node, channel, msg)
|
action = function(pos, node, channel, msg)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
|
local distance = meta:get_int("distance")
|
||||||
|
local distance_max = mesecon.setting("node_detector_distance_max", 10)
|
||||||
|
if distance < 0 then distance = 0 end
|
||||||
|
if distance > distance_max then distance = distance_max end
|
||||||
|
|
||||||
if channel ~= meta:get_string("digiline_channel") then return end
|
if channel ~= meta:get_string("digiline_channel") then return end
|
||||||
|
|
||||||
if msg == GET_COMMAND then
|
if msg == GET_COMMAND then
|
||||||
local nodename = minetest.get_node(
|
local nodename = minetest.get_node(
|
||||||
vector.subtract(pos, minetest.facedir_to_dir(node.param2))
|
vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance+1))
|
||||||
).name
|
).name
|
||||||
|
|
||||||
digiline:receptor_send(pos, digiline.rules.default, channel, nodename)
|
digiline:receptor_send(pos, digiline.rules.default, channel, nodename)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user