2013-06-05 06:40:53 +02:00
|
|
|
mesecon.on_placenode = function (pos, node)
|
2012-12-15 18:45:51 +01:00
|
|
|
if mesecon:is_receptor_on(node.name) then
|
|
|
|
mesecon:receptor_on(pos, mesecon:receptor_get_rules(node))
|
|
|
|
elseif mesecon:is_powered(pos) then
|
2012-12-26 22:54:28 +01:00
|
|
|
if mesecon:is_conductor(node.name) then
|
|
|
|
mesecon:turnon (pos)
|
2013-06-20 04:38:34 +02:00
|
|
|
--mesecon:receptor_on (pos, mesecon:conductor_get_rules(node))
|
2012-12-15 18:45:51 +01:00
|
|
|
else
|
2013-06-05 06:40:53 +02:00
|
|
|
mesecon:changesignal(pos, node, mesecon:effector_get_rules(node), "on")
|
2012-12-15 18:45:51 +01:00
|
|
|
mesecon:activate(pos, node)
|
2012-08-13 11:58:04 +02:00
|
|
|
end
|
2014-01-04 14:15:41 +01:00
|
|
|
elseif mesecon:is_conductor_on(node) then
|
|
|
|
minetest.swap_node(pos, {name = mesecon:get_conductor_off(node)})
|
2012-12-16 11:58:43 +01:00
|
|
|
elseif mesecon:is_effector_on (node.name) then
|
|
|
|
mesecon:deactivate(pos, node)
|
2012-08-13 11:58:04 +02:00
|
|
|
end
|
2012-12-15 18:45:51 +01:00
|
|
|
end
|
2012-08-13 11:58:04 +02:00
|
|
|
|
2012-12-15 18:45:51 +01:00
|
|
|
mesecon.on_dignode = function (pos, node)
|
2014-01-04 14:15:41 +01:00
|
|
|
if mesecon:is_conductor_on(node) then
|
2014-01-10 22:29:18 +01:00
|
|
|
mesecon:receptor_off(pos, mesecon:conductor_get_rules(node))
|
2012-12-15 18:45:51 +01:00
|
|
|
elseif mesecon:is_receptor_on(node.name) then
|
|
|
|
mesecon:receptor_off(pos, mesecon:receptor_get_rules(node))
|
2012-08-13 08:50:10 +02:00
|
|
|
end
|
2012-12-15 18:45:51 +01:00
|
|
|
end
|
|
|
|
|
2013-06-05 06:45:19 +02:00
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"group:overheat"},
|
|
|
|
interval = 1.0,
|
|
|
|
chance = 1,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
2013-12-01 04:13:00 +01:00
|
|
|
local meta = minetest.get_meta(pos)
|
2013-06-05 06:45:19 +02:00
|
|
|
meta:set_int("heat",0)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2012-12-15 18:45:51 +01:00
|
|
|
minetest.register_on_placenode(mesecon.on_placenode)
|
|
|
|
minetest.register_on_dignode(mesecon.on_dignode)
|