summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesecons/init.lua4
-rw-r--r--mesecons_blinkyplant/init.lua13
-rw-r--r--mesecons_button/init.lua38
-rw-r--r--mesecons_detector/init.lua19
-rw-r--r--mesecons_dev/mesecons_wireless/init.lua101
-rw-r--r--mesecons_noteblock/init.lua9
-rw-r--r--mesecons_pistons/init.lua28
-rw-r--r--mesecons_powerplant/init.lua20
-rw-r--r--mesecons_pressureplates/init.lua22
-rw-r--r--mesecons_switch/init.lua11
-rw-r--r--mesecons_temperest/init.lua93
-rw-r--r--mesecons_torch/init.lua54
-rw-r--r--mesecons_walllever/init.lua62
13 files changed, 198 insertions, 276 deletions
diff --git a/mesecons/init.lua b/mesecons/init.lua
index 8439bea..7450319 100644
--- a/mesecons/init.lua
+++ b/mesecons/init.lua
@@ -42,8 +42,8 @@
--
--
--!! If a receptor node is removed, the circuit should be recalculated. This means you have to
---send an mesecon:receptor_off signal to the api when the function in minetest.register_on_dignode
---is called.
+--send an mesecon:receptor_off signal to the api when the node is dug, using the
+--after_dig_node node property.
--
--EFFECTORS
--
diff --git a/mesecons_blinkyplant/init.lua b/mesecons_blinkyplant/init.lua
index 4797f6a..3e6adc2 100644
--- a/mesecons_blinkyplant/init.lua
+++ b/mesecons_blinkyplant/init.lua
@@ -21,7 +21,10 @@ minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
groups = {snappy=2},
drop='"mesecons_blinkyplant:blinky_plant_off" 1',
light_source = LIGHT_MAX-7,
- description="Blinky Plant",
+ description = "Blinky Plant",
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos)
+ end
})
minetest.register_craft({
@@ -59,11 +62,3 @@ minetest.register_abm({
mesecon:add_receptor_node("mesecons_blinkyplant:blinky_plant_on")
mesecon:add_receptor_node_off("mesecons_blinkyplant:blinky_plant_off")
-
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_blinkyplant:blinky_plant_on" then
- mesecon:receptor_off(pos)
- end
- end
-)
diff --git a/mesecons_button/init.lua b/mesecons_button/init.lua
index e0191f7..69f9777 100644
--- a/mesecons_button/init.lua
+++ b/mesecons_button/init.lua
@@ -10,30 +10,26 @@ minetest.register_node("mesecons_button:button_off", {
type = "wallmounted",
},
groups = {dig_immediate=2},
- description="Button",
+ description = "Button",
})
minetest.register_node("mesecons_button:button_on", {
- drawtype = "signlike",
- tile_images = {"jeija_wall_button_on.png"},
- paramtype = "light",
- paramtype2 = "wallmounted",
- legacy_wallmounted = true,
- walkable = false,
- selection_box = {
- type = "wallmounted",
- },
- groups = {dig_immediate=2},
- drop = '"mesecons_button:button_off" 1',
- description="Button",
+ drawtype = "signlike",
+ tile_images = {"jeija_wall_button_on.png"},
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ legacy_wallmounted = true,
+ walkable = false,
+ selection_box = {
+ type = "wallmounted",
+ },
+ groups = {dig_immediate=2},
+ drop = 'mesecons_button:button_off',
+ description = "Button",
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos, mesecon.button_get_rules(minetest.env:get_node(pos).param2))
+ end
})
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_button:button_on" then
- mesecon:receptor_off(pos, mesecon.button_get_rules(oldnode.param2))
- end
- end
-)
minetest.register_on_punchnode(function(pos, node, puncher)
if node.name == "mesecons_button:button_off" then
minetest.env:add_node(pos, {name="mesecons_button:button_on",param2=node.param2})
@@ -47,7 +43,7 @@ mesecon.button_turnoff = function (params)
if minetest.env:get_node(params.pos).name=="mesecons_button:button_on" then
minetest.env:add_node(params.pos, {name="mesecons_button:button_off", param2=params.param2})
local rules=mesecon.button_get_rules(param2)
- mesecon:receptor_off(params.pos, rules)
+ mesecon:receptor_off(params.pos, rules)
end
end
diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua
index 75e9b77..4fe90a2 100644
--- a/mesecons_detector/init.lua
+++ b/mesecons_detector/init.lua
@@ -12,12 +12,15 @@ minetest.register_node("mesecons_detector:object_detector_on", {
paramtype = "light",
walkable = true,
groups = {cracky=3},
- drop = '"mesecons_detector:object_detector_off" 1',
+ drop = 'mesecons_detector:object_detector_off',
description="Player Detector",
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
+ end
})
minetest.register_craft({
- output = '"mesecons_detector:object_detector_off" 1',
+ output = 'mesecons_detector:object_detector_off',
recipe = {
{"default:steelblock", '', "default:steelblock"},
{"default:steelblock", "mesecons_materials:ic", "default:steelblock"},
@@ -42,7 +45,7 @@ minetest.register_abm(
minetest.env:add_node(pos, {name="mesecons_detector:object_detector_on"})
mesecon:receptor_on(pos, mesecon:get_rules("pressureplate"))
end
- end
+ end
end,
})
@@ -65,7 +68,7 @@ minetest.register_abm(
objectfound=objectfound + 1
end
end
- end
+ end
if objectfound==0 then
minetest.env:add_node(pos, {name="mesecons_detector:object_detector_off"})
mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
@@ -73,13 +76,5 @@ minetest.register_abm(
end,
})
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_detector:object_detector_on" then
- mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
- end
- end
-)
-
mesecon:add_receptor_node("mesecons_detector:object_detector_on")
mesecon:add_receptor_node_off("mesecons_detector:object_detector_off")
diff --git a/mesecons_dev/mesecons_wireless/init.lua b/mesecons_dev/mesecons_wireless/init.lua
index 0d956e8..0a752e5 100644
--- a/mesecons_dev/mesecons_wireless/init.lua
+++ b/mesecons_dev/mesecons_wireless/init.lua
@@ -54,8 +54,8 @@ function mesecon:remove_wireless_receiver(pos)
local i = 1
while mesecon.wireless_receivers[i]~=nil do
if mesecon.wireless_receivers[i].pos.x==pos.x and
- mesecon.wireless_receivers[i].pos.y==pos.y and
- mesecon.wireless_receivers[i].pos.z==pos.z then
+ mesecon.wireless_receivers[i].pos.y==pos.y and
+ mesecon.wireless_receivers[i].pos.z==pos.z then
mesecon.wireless_receivers[i]=nil
break
end
@@ -84,8 +84,8 @@ function mesecon:get_wlre(pos)
local i=1
while mesecon.wireless_receivers[i]~=nil do
if mesecon.wireless_receivers[i].pos.x==pos.x and
- mesecon.wireless_receivers[i].pos.y==pos.y and
- mesecon.wireless_receivers[i].pos.z==pos.z then
+ mesecon.wireless_receivers[i].pos.y==pos.y and
+ mesecon.wireless_receivers[i].pos.z==pos.z then
return mesecon.wireless_receivers[i]
end
i=i+1
@@ -95,9 +95,9 @@ end
minetest.register_on_placenode(function(pos, newnode, placer)
pos.y=pos.y+1
if minetest.env:get_node(pos).name == "mesecons_wireless:wireless_receiver_off" or
- minetest.env:get_node(pos).name == "mesecons_wireless:wireless_receiver_on" or
- minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_off" or
- minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_on" then
+ minetest.env:get_node(pos).name == "mesecons_wireless:wireless_receiver_on" or
+ minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_off" or
+ minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_on" then
mesecon:set_wlre_channel(pos, newnode.name)
end
end)
@@ -107,17 +107,17 @@ minetest.register_on_dignode(
local channel
pos.y=pos.y+1
if minetest.env:get_node(pos).name == "mesecons_wireless:wireless_receiver_on" or
- minetest.env:get_node(pos).name == "mesecons_wireless:wireless_receiver_off" or
- minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_on" or
- minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_off" then
+ minetest.env:get_node(pos).name == "mesecons_wireless:wireless_receiver_off" or
+ minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_on" or
+ minetest.env:get_node(pos).name == "mesecons_wireless:wireless_inverter_off" then
mesecon:set_wlre_channel(pos, "air")
- end
+ end
end
)
minetest.register_abm(
{nodenames = {"mesecons_wireless:wireless_receiver_on", "mesecons_wireless:wireless_receiver_off",
- "mesecons_wireless:wireless_inverter_on", "mesecons_wireless:wireless_inverter_off"},
+ "mesecons_wireless:wireless_inverter_on", "mesecons_wireless:wireless_inverter_off"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
@@ -149,7 +149,14 @@ minetest.register_node("mesecons_wireless:wireless_receiver_off", {
tile_images = {"jeija_wireless_receiver_tb_off.png", "jeija_wireless_receiver_tb_off.png", "jeija_wireless_receiver_off.png", "jeija_wireless_receiver_off.png", "jeija_wireless_receiver_off.png", "jeija_wireless_receiver_off.png"},
inventory_image = minetest.inventorycube("jeija_wireless_receiver_off.png"),
groups = {choppy=2},
- description="Wireless Receiver",
+ description="Wireless Receiver",
+ after_place_node = function(pos)
+ mesecon:register_wireless_receiver(pos, 0)
+ end,
+ after_dig_node = function(pos)
+ mesecon:remove_wireless_receiver(pos)
+ mesecon:receptor_off(pos)
+ end
})
minetest.register_node("mesecons_wireless:wireless_receiver_on", {
@@ -157,7 +164,13 @@ minetest.register_node("mesecons_wireless:wireless_receiver_on", {
inventory_image = minetest.inventorycube("jeija_wireless_receiver_on.png"),
groups = {choppy=2},
drop = 'mesecons_wireless:wireless_receiver_off',
- description="Wireless Receiver",
+ description="Wireless Receiver",
+ after_place_node = function(pos)
+ mesecon:register_wireless_receiver(pos, 0)
+ end,
+ after_dig_node = function(pos)
+ mesecon:remove_wireless_receiver(pos)
+ end
})
minetest.register_craft({
@@ -169,24 +182,6 @@ minetest.register_craft({
}
})
-minetest.register_on_placenode(function(pos, newnode, placer)
- if newnode.name == "mesecons_wireless:wireless_receiver_off" then
- mesecon:register_wireless_receiver(pos, 0)
- end
-end)
-
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_wireless:wireless_receiver_on" then
- mesecon:remove_wireless_receiver(pos)
- mesecon:receptor_off(pos)
- end
- if oldnode.name == "mesecons_wireless:wireless_receiver_off" then
- mesecon:remove_wireless_receiver(pos)
- end
- end
-)
-
minetest.register_abm( -- SAVE WIRELESS RECEIVERS TO FILE
{nodenames = {"mesecons_wireless:wireless_receiver_off", "mesecons_wireless:wireless_receiver_on", "mesecons_wireless:wireless_inverter_on", "mesecons_wireless:wireless_inverter_off"},
interval = 10,
@@ -218,14 +213,29 @@ minetest.register_node("mesecons_wireless:wireless_inverter_off", {
inventory_image = minetest.inventorycube("jeija_wireless_inverter_off.png"),
groups = {choppy=2},
drop = 'mesecons_wireless:wireless_inverter_on',
- description="Wireless Inverter",
+ description = "Wireless Inverter",
+ after_place_node = function(pos)
+ mesecon:register_wireless_receiver(pos, 1)
+ mesecon:receptor_on(pos)
+ end,
+ after_dig_node = function(pos)
+ mesecon:remove_wireless_receiver(pos)
+ end
})
minetest.register_node("mesecons_wireless:wireless_inverter_on", {
tile_images = {"jeija_wireless_inverter_tb.png", "jeija_wireless_inverter_tb.png", "jeija_wireless_inverter_on.png", "jeija_wireless_inverter_on.png", "jeija_wireless_inverter_on.png", "jeija_wireless_inverter_on.png"},
inventory_image = minetest.inventorycube("jeija_wireless_inverter_on.png"),
groups = {choppy=2},
- description="Wireless Inverter",
+ description = "Wireless Inverter",
+ after_place_node = function(pos)
+ mesecon:register_wireless_receiver(pos, 1)
+ mesecon:receptor_on(pos)
+ end,
+ after_dig_node = function(pos)
+ mesecon:remove_wireless_receiver(pos)
+ mesecon:receptor_off(pos)
+ end
})
minetest.register_craft({
@@ -237,25 +247,6 @@ minetest.register_craft({
}
})
-minetest.register_on_placenode(function(pos, newnode, placer)
- if newnode.name == "mesecons_wireless:wireless_inverter_on" then
- mesecon:register_wireless_receiver(pos, 1)
- mesecon:receptor_on(pos)
- end
-end)
-
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_wireless:wireless_inverter_on" then
- mesecon:remove_wireless_receiver(pos)
- mesecon:receptor_off(pos)
- end
- if oldnode.name == "mesecons_wireless:wireless_inverter_off" then
- mesecon:remove_wireless_receiver(pos)
- end
- end
-)
-
mesecon:add_receptor_node("mesecons_wireless:wireless_inverter_on")
mesecon:add_receptor_node_off("mesecons_wireless:wireless_inverter_off")
@@ -280,14 +271,14 @@ minetest.register_node("mesecons_wireless:wireless_transmitter_on", {
inventory_image = minetest.inventorycube("jeija_wireless_transmitter_on.png"),
groups = {choppy=2},
drop = {'"mesecons_wireless:wireless_transmitter_off" 1'},
- description="Wireless Transmitter",
+ description="Wireless Transmitter",
})
minetest.register_node("mesecons_wireless:wireless_transmitter_off", {
tile_images = {"jeija_wireless_transmitter_tb.png", "jeija_wireless_transmitter_tb.png", "jeija_wireless_transmitter_off.png", "jeija_wireless_transmitter_off.png", "jeija_wireless_transmitter_off.png", "jeija_wireless_transmitter_off.png"},
inventory_image = minetest.inventorycube("jeija_wireless_transmitter_off.png"),
groups = {choppy=2},
- description="Wireless Transmitter",
+ description="Wireless Transmitter",
})
minetest.register_craft({
diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua
index 0b8cbee..7b363cb 100644
--- a/mesecons_noteblock/init.lua
+++ b/mesecons_noteblock/init.lua
@@ -5,13 +5,10 @@ minetest.register_node("mesecons_noteblock:noteblock", {
drawtype = "allfaces_optional",
visual_scale = 1.3,
paramtype="light",
-})
-
-minetest.register_on_placenode(function (pos, node)
- if node.name=="mesecons_noteblock:noteblock" then
- minetest.env:add_node(pos, {name=node.name, param2=0})
+ after_place_node = function(pos)
+ minetest.env:add_node(pos, {name="mesecons_noteblock:noteblock", param2=0})
end
-end)
+})
minetest.register_on_punchnode(function (pos, node)
if node.name=="mesecons_noteblock:noteblock" then
diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua
index 0bb391f..87c3fc1 100644
--- a/mesecons_pistons/init.lua
+++ b/mesecons_pistons/init.lua
@@ -5,6 +5,14 @@ minetest.register_node("mesecons_pistons:piston_normal", {
groups = {cracky=3},
paramtype2="facedir",
description="Piston",
+ after_dig_node = function(pos)
+ local objs = minetest.env:get_objects_inside_radius(pos, 2)
+ for k, obj in pairs(objs) do
+ if obj:get_entity_name() == "mesecons_pistons:piston_pusher_normal" then
+ obj:remove()
+ end
+ end
+ end
})
minetest.register_craft({
@@ -22,6 +30,14 @@ minetest.register_node("mesecons_pistons:piston_sticky", {
groups = {cracky=3},
paramtype2="facedir",
description="Sticky Piston",
+ after_dig_node = function(pos)
+ local objs = minetest.env:get_objects_inside_radius(pos, 2)
+ for k, obj in pairs(objs) do
+ if obj:get_entity_name() == "mesecons_pistons:piston_pusher_sticky" then
+ obj:remove()
+ end
+ end
+ end
})
minetest.register_craft({
@@ -260,15 +276,3 @@ end
minetest.register_entity("mesecons_pistons:piston_pusher_normal", PISTON_PUSHER_NORMAL)
minetest.register_entity("mesecons_pistons:piston_pusher_sticky", PISTON_PUSHER_STICKY)
-
-minetest.register_on_dignode(function(pos, node)
- if node.name=="mesecons_pistons:piston_normal" or node.name=="mesecons_pistons:piston_sticky" then
- local objs = minetest.env:get_objects_inside_radius(pos, 2)
- for k, obj in pairs(objs) do
- local obj_name = obj:get_entity_name()
- if obj_name == "mesecons_pistons:piston_pusher_normal" or obj_name == "mesecons_pistons:piston_pusher_sticky" then
- obj:remove()
- end
- end
- end
-end)
diff --git a/mesecons_powerplant/init.lua b/mesecons_powerplant/init.lua
index 346c076..b7e4cde 100644
--- a/mesecons_powerplant/init.lua
+++ b/mesecons_powerplant/init.lua
@@ -10,6 +10,12 @@ minetest.register_node("mesecons_powerplant:power_plant", {
groups = {snappy=3},
light_source = LIGHT_MAX-9,
description="Power Plant",
+ after_place_node = function(pos)
+ mesecon:receptor_on(pos)
+ end,
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos)
+ end
})
minetest.register_craft({
@@ -21,18 +27,4 @@ minetest.register_craft({
}
})
-minetest.register_on_placenode(function(pos, newnode, placer)
- if newnode.name == "mesecons_powerplant:power_plant" then
- mesecon:receptor_on(pos)
- end
-end)
-
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_powerplant:power_plant" then
- mesecon:receptor_off(pos)
- end
- end
-)
-
mesecon:add_receptor_node("mesecons_powerplant:power_plant")
diff --git a/mesecons_pressureplates/init.lua b/mesecons_pressureplates/init.lua
index 56a55c2..37b3ca8 100644
--- a/mesecons_pressureplates/init.lua
+++ b/mesecons_pressureplates/init.lua
@@ -26,6 +26,9 @@ minetest.register_node("mesecons_pressureplates:pressure_plate_wood_on", {
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3},
drop='"mesecons_pressureplates:pressure_plate_wood_off" 1',
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
+ end
})
minetest.register_craft({
@@ -64,14 +67,6 @@ minetest.register_abm(
end,
})
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_pressureplates:pressure_plate_wood_on" then
- mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
- end
- end
-)
-
mesecon:add_receptor_node("mesecons_pressureplates:pressure_plate_wood_on")
mesecon:add_receptor_node_off("mesecons_pressureplates:pressure_plate_wood_off")
@@ -103,6 +98,9 @@ minetest.register_node("mesecons_pressureplates:pressure_plate_stone_on", {
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3},
drop='"mesecons_pressureplates:pressure_plate_stone_off" 1',
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
+ end
})
minetest.register_craft({
@@ -141,14 +139,6 @@ minetest.register_abm(
end,
})
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_pressureplates:pressure_plate_stone_on" then
- mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
- end
- end
-)
-
mesecon:add_receptor_node("mesecons_pressureplates:pressure_plate_stone_on")
mesecon:add_receptor_node_off("mesecons_pressureplates:pressure_plate_stone_off")
diff --git a/mesecons_switch/init.lua b/mesecons_switch/init.lua
index d95178b..b61dd8c 100644
--- a/mesecons_switch/init.lua
+++ b/mesecons_switch/init.lua
@@ -13,6 +13,9 @@ minetest.register_node("mesecons_switch:mesecon_switch_on", {
groups = {dig_immediate=2},
drop='"mesecons_switch:mesecon_switch_off" 1',
description="Switch",
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos)
+ end
})
mesecon:add_receptor_node("mesecons_switch:mesecon_switch_on")
@@ -31,14 +34,6 @@ minetest.register_on_punchnode(function(pos, node, puncher)
end
end)
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_switch:mesecon_switch_on" then
- mesecon:receptor_off(pos)
- end
- end
-)
-
minetest.register_craft({
output = '"mesecons_switch:mesecon_switch_off" 2',
recipe = {
diff --git a/mesecons_temperest/init.lua b/mesecons_temperest/init.lua
index 3c31013..2bda111 100644
--- a/mesecons_temperest/init.lua
+++ b/mesecons_temperest/init.lua
@@ -1,20 +1,5 @@
--TEMPEREST-PLUG
-minetest.register_node("mesecons_temperest:mesecon_plug", {
- drawtype = "raillike",
- paramtype = "light",
- is_ground_content = true,
- tile_images = {"jeija_mesecon_plug.png"},
- inventory_image = "jeija_mesecon_plug.png",
- wield_image = "jeija_mesecon_plug.png",
- groups = {dig_immediate=2},
- walkable = false,
- selection_box = {
- type = "fixed",
- },
- description = "Plug",
-})
-
local set_node_on
local set_node_off
@@ -64,7 +49,8 @@ else
end
end
-local plug_on = function(pos, node)
+local plug_on = function(pos)
+ local node = minetest.env:get_node(pos)
if node.name=="mesecons_temperest:mesecon_plug" then
local lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
if lnode.name=="air" then set_node_on({x=pos.x-2, y=pos.y, z=pos.z}) end
@@ -86,7 +72,8 @@ local plug_on = function(pos, node)
end
end
-local plug_off = function(pos, node)
+local plug_off = function(pos)
+ local node = minetest.env:get_node(pos)
if node.name=="mesecons_temperest:mesecon_plug" then
lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
if lnode.name=="air" then set_node_off({x=pos.x-2, y=pos.y, z=pos.z}) end
@@ -111,15 +98,29 @@ end
mesecon:register_on_signal_on(plug_on)
mesecon:register_on_signal_off(plug_off)
-minetest.register_on_placenode(plug_off)
-minetest.register_on_dignode(plug_off)
+minetest.register_node("mesecons_temperest:mesecon_plug", {
+ drawtype = "raillike",
+ paramtype = "light",
+ is_ground_content = true,
+ tile_images = {"jeija_mesecon_plug.png"},
+ inventory_image = "jeija_mesecon_plug.png",
+ wield_image = "jeija_mesecon_plug.png",
+ groups = {dig_immediate=2},
+ walkable = false,
+ selection_box = {
+ type = "fixed",
+ },
+ description = "Plug",
+ after_place_node = plug_off,
+ after_dig_node = plug_off
+})
minetest.register_craft({
- output = 'node "mesecons_temperest:mesecon_plug" 2',
+ output = '"mesecons_temperest:mesecon_plug" 2',
recipe = {
- {'', 'node "mesecons:mesecon_off"', ''},
- {'node "mesecons:mesecon_off"', 'craft "default:steel_ingot"', 'node "mesecons:mesecon_off"'},
- {'', 'node "mesecons:mesecon_off"', ''},
+ {'', '"mesecons:mesecon_off"', ''},
+ {'"mesecons:mesecon_off"', '"default:steel_ingot"', '"mesecons:mesecon_off"'},
+ {'', '"mesecons:mesecon_off"', ''},
}
})
@@ -151,25 +152,20 @@ minetest.register_node("mesecons_temperest:mesecon_socket_on", {
type = "fixed",
},
drop='"mesecons_temperest:mesecon_socket_off" 1',
-})
-
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_temperest:mesecon_socket_on" then
- mesecon:receptor_off(pos)
- end
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos)
end
-)
+})
mesecon:add_receptor_node("mesecons_temperest:mesecon_socket_on")
mesecon:add_receptor_node_off("mesecons_temperest:mesecon_socket_off")
minetest.register_craft({
- output = 'node "mesecons_temperest:mesecon_socket_off" 2',
+ output = '"mesecons_temperest:mesecon_socket_off" 2',
recipe = {
- {'', 'craft "default:steel_ingot"', ''},
- {'craft "default:steel_ingot"', 'node "mesecons_temperest:mesecon_off"', 'craft "default:steel_ingot"'},
- {'', 'craft "default:steel_ingot"', ''},
+ {'', '"default:steel_ingot"', ''},
+ {'"default:steel_ingot"', '"mesecons_temperest:mesecon_off"', '"default:steel_ingot"'},
+ {'', '"default:steel_ingot"', ''},
}
})
@@ -201,32 +197,23 @@ if ENABLE_TEMPEREST==1 then
selection_box = {
type = "fixed",
},
- })
-
- minetest.register_on_placenode(function(pos, node)
- if node.name=="mesecons_temperest:mesecon_inverter_on" then
+ after_place_node = function(pos)
mesecon:receptor_on(pos)
+ end,
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos)
end
- end
- )
-
- minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_temperest:mesecon_inverter_on" then
- mesecon:receptor_off(pos)
- end
- end
- )
+ })
mesecon:add_receptor_node("mesecons_temperest:mesecon_inverter_on")
mesecon:add_receptor_node_off("mesecons_temperest:mesecon_inverter_off")
minetest.register_craft({
- output = 'node "mesecons_temperest:mesecon_inverter_on" 2',
+ output = '"mesecons_temperest:mesecon_inverter_on" 2',
recipe = {
- {'node "mesecons_temperest:mesecon_off"', 'craft "default:steel_ingot"', 'node "mesecons:mesecon_off"'},
- {'craft "default:steel_ingot"', '', 'craft "default:steel_ingot"'},
- {'node "mesecons:mesecon_off"', 'craft "default:steel_ingot"', 'node "mesecons:mesecon_off"'},
+ {'"mesecons_temperest:mesecon_off"', '"default:steel_ingot"', '"mesecons:mesecon_off"'},
+ {'"default:steel_ingot"', '', '"default:steel_ingot"'},
+ {'"mesecons:mesecon_off"', '"default:steel_ingot"', '"mesecons:mesecon_off"'},
}
})
end
diff --git a/mesecons_torch/init.lua b/mesecons_torch/init.lua
index 169eb64..f37ca31 100644
--- a/mesecons_torch/init.lua
+++ b/mesecons_torch/init.lua
@@ -22,27 +22,26 @@ minetest.register_node("mesecons_torch:mesecon_torch_off", {
})
minetest.register_node("mesecons_torch:mesecon_torch_on", {
- drawtype = "torchlike",
- tile_images = {"jeija_torches_on.png", "jeija_torches_on_ceiling.png", "jeija_torches_on_side.png"},
- inventory_image = "jeija_torches_on.png",
- wield_image = "jeija_torches_on.png",
- paramtype = "light",
- sunlight_propagates = true,
- walkable = false,
- paramtype2 = "wallmounted",
- legacy_wallmounted = true,
- groups = {dig_immediate=2},
- light_source = LIGHT_MAX-5,
- description="Mesecon Torch",
-})
-
---[[minetest.register_on_placenode(function(pos, newnode, placer)
- if (newnode.name=="mesecons_torch:mesecon_torch_off" or newnode.name=="mesecons_torch:mesecon_torch_on")
- and (newnode.param2==8 or newnode.param2==4) then
- minetest.env:remove_node(pos)
- --minetest.env:add_item(pos, "'mesecons_torch:mesecon_torch_on' 1")
+ drawtype = "torchlike",
+ tile_images = {"jeija_torches_on.png", "jeija_torches_on_ceiling.png", "jeija_torches_on_side.png"},
+ inventory_image = "jeija_torches_on.png",
+ wield_image = "jeija_torches_on.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ paramtype2 = "wallmounted",
+ legacy_wallmounted = true,
+ groups = {dig_immediate=2},
+ light_source = LIGHT_MAX-5,
+ description="Mesecon Torch",
+ after_place_node = function(pos)
+ local rules = mesecon.torch_get_rules(minetest.env:get_node(pos).param2)
+ mesecon:receptor_on(pos, rules)
+ end,
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos)
end
-end)]]
+})
minetest.register_abm({
nodenames = {"mesecons_torch:mesecon_torch_off","mesecons_torch:mesecon_torch_on"},
@@ -81,21 +80,6 @@ minetest.register_abm({
end
})
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_torch:mesecon_torch_on" then
- mesecon:receptor_off(pos)
- end
- end
-)
-
-minetest.register_on_placenode(function(pos, node, placer)
- if node.name == "mesecons_torch:mesecon_torch_on" then
- local rules=mesecon.torch_get_rules(minetest.env:get_node(pos).param2)
- mesecon:receptor_on(pos, rules)
- end
-end)
-
mesecon.torch_get_rules = function(param2)
local rules=mesecon:get_rules("mesecontorch")
if param2 == 5 then
diff --git a/mesecons_walllever/init.lua b/mesecons_walllever/init.lua
index 4e3401e..6f1c310 100644
--- a/mesecons_walllever/init.lua
+++ b/mesecons_walllever/init.lua
@@ -1,42 +1,38 @@
-- WALL LEVER
minetest.register_node("mesecons_walllever:wall_lever_off", {
- drawtype = "signlike",
- tile_images = {"jeija_wall_lever_off.png"},
- inventory_image = "jeija_wall_lever_off.png",
- wield_image = "jeija_wall_lever_off.png",
- paramtype = "light",
- paramtype2 = "wallmounted",
- legacy_wallmounted = true,
- walkable = false,
- selection_box = {
- type = "wallmounted",
- },
- groups = {dig_immediate=2},
- description="Lever",
+ drawtype = "signlike",
+ tile_images = {"jeija_wall_lever_off.png"},
+ inventory_image = "jeija_wall_lever_off.png",
+ wield_image = "jeija_wall_lever_off.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ legacy_wallmounted = true,
+ walkable = false,
+ selection_box = {
+ type = "wallmounted",
+ },
+ groups = {dig_immediate=2},
+ description="Lever",
})
minetest.register_node("mesecons_walllever:wall_lever_on", {
- drawtype = "signlike",
- tile_images = {"jeija_wall_lever_on.png"},
- inventory_image = "jeija_wall_lever_on.png",
- paramtype = "light",
- paramtype2 = "wallmounted",
- legacy_wallmounted = true,
- walkable = false,
- selection_box = {
- type = "wallmounted",
- },
- groups = {dig_immediate=2},
- drop = '"mesecons_walllever:wall_lever_off" 1',
- description="Lever",
+ drawtype = "signlike",
+ tile_images = {"jeija_wall_lever_on.png"},
+ inventory_image = "jeija_wall_lever_on.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ legacy_wallmounted = true,
+ walkable = false,
+ selection_box = {
+ type = "wallmounted",
+ },
+ groups = {dig_immediate=2},
+ drop = '"mesecons_walllever:wall_lever_off" 1',
+ description="Lever",
+ after_dig_node = function(pos)
+ mesecon:receptor_off(pos, mesecon.button_get_rules(minetest.env:get_node(pos).param2))
+ end
})
-minetest.register_on_dignode(
- function(pos, oldnode, digger)
- if oldnode.name == "mesecons_walllever:wall_lever_on" then
- mesecon:receptor_off(pos, mesecon.button_get_rules(oldnode.param2))
- end
- end
-)
minetest.register_on_punchnode(function(pos, node, puncher)
if node.name == "mesecons_walllever:wall_lever_off" then
minetest.env:add_node(pos, {name="mesecons_walllever:wall_lever_on",param2=node.param2})