summaryrefslogtreecommitdiff
path: root/mesecons_solarpanel
diff options
context:
space:
mode:
Diffstat (limited to 'mesecons_solarpanel')
-rw-r--r--mesecons_solarpanel/init.lua18
1 files changed, 11 insertions, 7 deletions
diff --git a/mesecons_solarpanel/init.lua b/mesecons_solarpanel/init.lua
index cbf8878..9981d95 100644
--- a/mesecons_solarpanel/init.lua
+++ b/mesecons_solarpanel/init.lua
@@ -24,7 +24,8 @@ minetest.register_node("mesecons_solarpanel:solar_panel_on", {
groups = {dig_immediate=3, not_in_creative_inventory = 1},
sounds = default.node_sound_glass_defaults(),
mesecons = {receptor = {
- state = mesecon.state.on
+ state = mesecon.state.on,
+ rules = mesecon.rules.wallmounted_get,
}},
on_blast = mesecon.on_blastnode,
})
@@ -52,10 +53,11 @@ minetest.register_node("mesecons_solarpanel:solar_panel_off", {
wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
},
groups = {dig_immediate=3},
- description="Solar Panel",
+ description = "Solar Panel",
sounds = default.node_sound_glass_defaults(),
mesecons = {receptor = {
- state = mesecon.state.off
+ state = mesecon.state.off,
+ rules = mesecon.rules.wallmounted_get,
}},
on_blast = mesecon.on_blastnode,
})
@@ -76,8 +78,9 @@ minetest.register_abm(
local light = minetest.get_node_light(pos, nil)
if light >= 12 then
- minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_on", param2=node.param2})
- mesecon.receptor_on(pos)
+ node.name = "mesecons_solarpanel:solar_panel_on"
+ minetest.swap_node(pos, node)
+ mesecon.receptor_on(pos, mesecon.rules.wallmounted_get(node))
end
end,
})
@@ -90,8 +93,9 @@ minetest.register_abm(
local light = minetest.get_node_light(pos, nil)
if light < 12 then
- minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2})
- mesecon.receptor_off(pos)
+ node.name = "mesecons_solarpanel:solar_panel_off"
+ minetest.swap_node(pos, node)
+ mesecon.receptor_off(pos, mesecon.rules.wallmounted_get(node))
end
end,
})