From b37bdbf55cf6d3205d5dd7a2491a8bd855cbbd76 Mon Sep 17 00:00:00 2001 From: Jeija Date: Sun, 9 Dec 2012 00:42:30 +0100 Subject: Port a lot more (basically everything apart from gates, pistons and extrawire crossing) to the new nodedef system. There are some problems with wall button and wall lever (in the way they visually connect to wires) --- mesecons_random/init.lua | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'mesecons_random') diff --git a/mesecons_random/init.lua b/mesecons_random/init.lua index 4011217..4fc2f6e 100644 --- a/mesecons_random/init.lua +++ b/mesecons_random/init.lua @@ -3,12 +3,16 @@ minetest.register_node("mesecons_random:removestone", { tiles = {"jeija_removestone.png"}, inventory_image = minetest.inventorycube("jeija_removestone_inv.png"), - groups = {cracky=3, mesecon=2}, + groups = {cracky=3}, description="Removestone", + mesecons = {effector = { + action_on = function (pos, node) + minetest.env:remove_node(pos) + mesecon:update_autoconnect(pos) + end + }} }) -mesecon:register_effector(nil, "mesecons_random:removestone") - minetest.register_craft({ output = 'mesecons_random:removestone 4', recipe = { @@ -18,12 +22,6 @@ minetest.register_craft({ } }) -mesecon:register_on_signal_on(function(pos, node) - if node.name == "mesecons_random:removestone" then - minetest.env:remove_node(pos) - end -end) - -- GHOSTSTONE minetest.register_node("mesecons_random:ghoststone", { @@ -31,8 +29,13 @@ minetest.register_node("mesecons_random:ghoststone", { tiles = {"jeija_ghoststone.png"}, is_ground_content = true, inventory_image = minetest.inventorycube("jeija_ghoststone_inv.png"), - groups = {cracky=3, mesecon=2}, + groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), + mesecons = {effector = { + action_on = function (pos, node) + minetest.env:add_node(pos, {name="mesecons_random:ghoststone_active"}) + end + }} }) minetest.register_node("mesecons_random:ghoststone_active", { @@ -41,10 +44,13 @@ minetest.register_node("mesecons_random:ghoststone_active", { walkable = false, diggable = false, sunlight_propagates = true, - groups = {mesecon=2}, + mesecons = {effector = { + action_off = function (pos, node) + minetest.env:add_node(pos, {name="mesecons_random:ghoststone"}) + end + }} }) -mesecon:register_effector("mesecons_random:ghoststone_active", "mesecons_random:ghoststone") minetest.register_craft({ output = 'mesecons_random:ghoststone 4', @@ -54,17 +60,3 @@ minetest.register_craft({ {"default:steel_ingot", "default:cobble", "default:steel_ingot"}, } }) - -mesecon:register_on_signal_on(function(pos, node) - if node.name == "mesecons_random:ghoststone" then - minetest.env:add_node(pos, {name="mesecons_random:ghoststone_active"}) - nodeupdate(pos) - end -end) - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "mesecons_random:ghoststone_active" then - minetest.env:add_node(pos, {name="mesecons_random:ghoststone"}) - nodeupdate(pos) - end -end) \ No newline at end of file -- cgit v1.2.3