diff options
Diffstat (limited to 'mesecons_solarpanel/init.lua')
-rw-r--r-- | mesecons_solarpanel/init.lua | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/mesecons_solarpanel/init.lua b/mesecons_solarpanel/init.lua index bc5a408..9981d95 100644 --- a/mesecons_solarpanel/init.lua +++ b/mesecons_solarpanel/init.lua @@ -24,8 +24,10 @@ 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, }) -- Solar Panel @@ -51,11 +53,13 @@ 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, }) minetest.register_craft({ @@ -74,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, }) @@ -88,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, }) |