forked from minetest-mods/mesecons
Add mesecon:nodeupdate Function
This commit is contained in:
parent
55e74c04ed
commit
dd1921c03a
@ -384,6 +384,14 @@ function mesecon:check_if_turnon(pos)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function mesecon:updatenode(pos)
|
||||||
|
if mesecon:connected_to_pwr_src(pos) then
|
||||||
|
mesecon:turnon(pos, 0, 0, 0)
|
||||||
|
else
|
||||||
|
mesecon:turnoff(pos, 0, 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||||
if mesecon:check_if_turnon(pos) then
|
if mesecon:check_if_turnon(pos) then
|
||||||
if mesecon:is_conductor_off(newnode.name) then
|
if mesecon:is_conductor_off(newnode.name) then
|
||||||
|
Loading…
Reference in New Issue
Block a user