diff options
author | Jeija <norrepli@gmail.com> | 2012-12-11 19:49:55 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2012-12-11 19:49:55 +0100 |
commit | de46729b971b5e59394834b8a01d4a7005318114 (patch) | |
tree | 5a2cf1f18b485ddefa8e255ac6d6a600ef2e2e12 /mesecons_switch | |
parent | 31f3c99288355193dc68a6e83dfc63140fd02fa0 (diff) | |
parent | 5540fcbcb31eb32003fa0391113ed3b1dea25e47 (diff) | |
download | mesecons-de46729b971b5e59394834b8a01d4a7005318114.tar mesecons-de46729b971b5e59394834b8a01d4a7005318114.tar.gz mesecons-de46729b971b5e59394834b8a01d4a7005318114.tar.bz2 mesecons-de46729b971b5e59394834b8a01d4a7005318114.tar.xz mesecons-de46729b971b5e59394834b8a01d4a7005318114.zip |
Merge branch 'mesecons_in_nodedef'
Conflicts:
mesecons/internal.lua
Diffstat (limited to 'mesecons_switch')
-rw-r--r-- | mesecons_switch/init.lua | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/mesecons_switch/init.lua b/mesecons_switch/init.lua index a8b3415..0519e03 100644 --- a/mesecons_switch/init.lua +++ b/mesecons_switch/init.lua @@ -3,32 +3,30 @@ minetest.register_node("mesecons_switch:mesecon_switch_off", { tiles = {"jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_off.png"}, paramtype2="facedir", - groups = {dig_immediate=2, mesecon = 2}, - description="Switch", + groups = {dig_immediate=2}, + description="Switch", + mesecons = {receptor = { + state = mesecon.state.off + }}, + on_punch = function(pos, node) + mesecon:swap_node(pos, "mesecons_switch:mesecon_switch_on") + mesecon:receptor_on(pos) + end }) minetest.register_node("mesecons_switch:mesecon_switch_on", { tiles = {"jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_on.png"}, paramtype2="facedir", - groups = {dig_immediate=2,not_in_creative_inventory=1, mesecon = 2}, + groups = {dig_immediate=2,not_in_creative_inventory=1}, drop='"mesecons_switch:mesecon_switch_off" 1', - description="Switch", -}) - -mesecon:register_receptor("mesecons_switch:mesecon_switch_on", "mesecons_switch:mesecon_switch_off") - -minetest.register_on_punchnode(function(pos, node, puncher) - if node.name == "mesecons_switch:mesecon_switch_on" then - minetest.env:add_node(pos, {name="mesecons_switch:mesecon_switch_off", param2=node.param2}) - nodeupdate(pos) + mesecons = {receptor = { + state = mesecon.state.on + }}, + on_punch = function(pos, node) + mesecon:swap_node(pos, "mesecons_switch:mesecon_switch_off") mesecon:receptor_off(pos) end - if node.name == "mesecons_switch:mesecon_switch_off" then - minetest.env:add_node(pos, {name="mesecons_switch:mesecon_switch_on", param2=node.param2}) - nodeupdate(pos) - mesecon:receptor_on(pos) - end -end) +}) minetest.register_craft({ output = '"mesecons_switch:mesecon_switch_off" 2', |