diff options
author | Jeija <norrepli@gmail.com> | 2012-12-09 00:42:30 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2012-12-09 00:42:30 +0100 |
commit | b37bdbf55cf6d3205d5dd7a2491a8bd855cbbd76 (patch) | |
tree | ffc05ac9f096fc635535701cd287d4e5ad6b5073 /mesecons_lamp/init.lua | |
parent | cf6080f7237af1c55a6d80bea4725dcb5c8cb1eb (diff) |
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)
Diffstat (limited to 'mesecons_lamp/init.lua')
-rw-r--r-- | mesecons_lamp/init.lua | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/mesecons_lamp/init.lua b/mesecons_lamp/init.lua index 553941c..d20236b 100644 --- a/mesecons_lamp/init.lua +++ b/mesecons_lamp/init.lua @@ -1,4 +1,7 @@ -- MESELAMPS +-- A lamp is "is an electrical device used to create artificial light" (wikipedia) +-- guess what? + minetest.register_node("mesecons_lamp:lamp_on", { drawtype = "nodebox", tiles = {"jeija_meselamp_on.png"}, @@ -20,8 +23,13 @@ minetest.register_node("mesecons_lamp:lamp_on", { wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125}, wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125}, }, - groups = {dig_immediate=3,not_in_creative_inventory=1, mesecon_effector_on = 1, mesecon = 2}, + groups = {dig_immediate=3,not_in_creative_inventory=1, mesecon_effector_on = 1}, drop='"mesecons_lamp:lamp_off" 1', + mesecons = {effector = { + action_off = function (pos, node) + mesecon:swap_node(pos, "mesecons_lamp:lamp_off") + end + }} }) minetest.register_node("mesecons_lamp:lamp_off", { @@ -45,8 +53,13 @@ minetest.register_node("mesecons_lamp:lamp_off", { wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125}, wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125}, }, - groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2}, + groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1}, description="Meselamp", + mesecons = {effector = { + action_on = function (pos, node) + mesecon:swap_node(pos, "mesecons_lamp:lamp_on") + end + }} }) minetest.register_craft({ @@ -57,19 +70,3 @@ minetest.register_craft({ {'', '"default:glass"', ''}, } }) - -mesecon:register_on_signal_on(function(pos, node) - if node.name == "mesecons_lamp:lamp_off" then - minetest.env:add_node(pos, {name="mesecons_lamp:lamp_on", param2 = node.param2}) - nodeupdate(pos) - end -end) - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "mesecons_lamp:lamp_on" then - minetest.env:add_node(pos, {name="mesecons_lamp:lamp_off", param2 = node.param2}) - nodeupdate(pos) - end -end) - -mesecon:register_effector("mesecons_lamp:lamp_on", "mesecons_lamp:lamp_off") |