diff options
author | Anthony Zhang <azhang9@gmail.com> | 2012-06-04 22:20:04 -0400 |
---|---|---|
committer | Anthony Zhang <azhang9@gmail.com> | 2012-06-04 22:20:04 -0400 |
commit | 4200757ba3ac7f450a6b51592339aa62af905f0e (patch) | |
tree | 178110c383ac9b629c53ffddb745deacde870375 /mesecons_torch | |
parent | 95a84dde468f91a112993f8c1379ebca0362d95f (diff) | |
download | mesecons-4200757ba3ac7f450a6b51592339aa62af905f0e.tar mesecons-4200757ba3ac7f450a6b51592339aa62af905f0e.tar.gz mesecons-4200757ba3ac7f450a6b51592339aa62af905f0e.tar.bz2 mesecons-4200757ba3ac7f450a6b51592339aa62af905f0e.tar.xz mesecons-4200757ba3ac7f450a6b51592339aa62af905f0e.zip |
Remove deprecated API functions "register_on_placenode" and "register_on_dignode" where possible.
Diffstat (limited to 'mesecons_torch')
-rw-r--r-- | mesecons_torch/init.lua | 54 |
1 files changed, 19 insertions, 35 deletions
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 |