From 4200757ba3ac7f450a6b51592339aa62af905f0e Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Mon, 4 Jun 2012 22:20:04 -0400 Subject: Remove deprecated API functions "register_on_placenode" and "register_on_dignode" where possible. --- mesecons_detector/init.lua | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'mesecons_detector') 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") -- cgit v1.2.3