summaryrefslogtreecommitdiff
path: root/mesecons_solarpanel
diff options
context:
space:
mode:
Diffstat (limited to 'mesecons_solarpanel')
-rw-r--r--mesecons_solarpanel/depends.txt2
-rw-r--r--mesecons_solarpanel/doc/solarpanel/description.html1
-rw-r--r--mesecons_solarpanel/doc/solarpanel/preview.pngbin0 -> 56933 bytes
-rw-r--r--mesecons_solarpanel/doc/solarpanel/recipe.pngbin0 -> 3721 bytes
-rw-r--r--mesecons_solarpanel/init.lua95
-rw-r--r--mesecons_solarpanel/textures/jeija_solar_panel.pngbin0 -> 652 bytes
6 files changed, 98 insertions, 0 deletions
diff --git a/mesecons_solarpanel/depends.txt b/mesecons_solarpanel/depends.txt
new file mode 100644
index 0000000..bc7b062
--- /dev/null
+++ b/mesecons_solarpanel/depends.txt
@@ -0,0 +1,2 @@
+mesecons
+mesecons_materials
diff --git a/mesecons_solarpanel/doc/solarpanel/description.html b/mesecons_solarpanel/doc/solarpanel/description.html
new file mode 100644
index 0000000..f8e7450
--- /dev/null
+++ b/mesecons_solarpanel/doc/solarpanel/description.html
@@ -0,0 +1 @@
+Solar Panel are light receptors: they turn on if there is enough light.
diff --git a/mesecons_solarpanel/doc/solarpanel/preview.png b/mesecons_solarpanel/doc/solarpanel/preview.png
new file mode 100644
index 0000000..b773195
--- /dev/null
+++ b/mesecons_solarpanel/doc/solarpanel/preview.png
Binary files differ
diff --git a/mesecons_solarpanel/doc/solarpanel/recipe.png b/mesecons_solarpanel/doc/solarpanel/recipe.png
new file mode 100644
index 0000000..3a3d799
--- /dev/null
+++ b/mesecons_solarpanel/doc/solarpanel/recipe.png
Binary files differ
diff --git a/mesecons_solarpanel/init.lua b/mesecons_solarpanel/init.lua
new file mode 100644
index 0000000..bc5a408
--- /dev/null
+++ b/mesecons_solarpanel/init.lua
@@ -0,0 +1,95 @@
+-- Solar Panel
+minetest.register_node("mesecons_solarpanel:solar_panel_on", {
+ drawtype = "nodebox",
+ tiles = { "jeija_solar_panel.png", },
+ inventory_image = "jeija_solar_panel.png",
+ wield_image = "jeija_solar_panel.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ walkable = false,
+ is_ground_content = true,
+ node_box = {
+ type = "wallmounted",
+ wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
+ wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
+ wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
+ },
+ selection_box = {
+ type = "wallmounted",
+ wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
+ wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
+ wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
+ },
+ drop = "mesecons_solarpanel:solar_panel_off",
+ groups = {dig_immediate=3, not_in_creative_inventory = 1},
+ sounds = default.node_sound_glass_defaults(),
+ mesecons = {receptor = {
+ state = mesecon.state.on
+ }}
+})
+
+-- Solar Panel
+minetest.register_node("mesecons_solarpanel:solar_panel_off", {
+ drawtype = "nodebox",
+ tiles = { "jeija_solar_panel.png", },
+ inventory_image = "jeija_solar_panel.png",
+ wield_image = "jeija_solar_panel.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ walkable = false,
+ is_ground_content = true,
+ node_box = {
+ type = "wallmounted",
+ wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
+ wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
+ wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
+ },
+ selection_box = {
+ type = "wallmounted",
+ wall_bottom = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
+ wall_top = { -7/16, 7/16, -7/16, 7/16, 8/16, 7/16 },
+ wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 },
+ },
+ groups = {dig_immediate=3},
+ description="Solar Panel",
+ sounds = default.node_sound_glass_defaults(),
+ mesecons = {receptor = {
+ state = mesecon.state.off
+ }}
+})
+
+minetest.register_craft({
+ output = "mesecons_solarpanel:solar_panel_off 1",
+ recipe = {
+ {"mesecons_materials:silicon", "mesecons_materials:silicon"},
+ {"mesecons_materials:silicon", "mesecons_materials:silicon"},
+ }
+})
+
+minetest.register_abm(
+ {nodenames = {"mesecons_solarpanel:solar_panel_off"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ 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)
+ end
+ end,
+})
+
+minetest.register_abm(
+ {nodenames = {"mesecons_solarpanel:solar_panel_on"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ 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)
+ end
+ end,
+})
diff --git a/mesecons_solarpanel/textures/jeija_solar_panel.png b/mesecons_solarpanel/textures/jeija_solar_panel.png
new file mode 100644
index 0000000..a7b0f75
--- /dev/null
+++ b/mesecons_solarpanel/textures/jeija_solar_panel.png
Binary files differ