Added solar arrays for all voltage tiers.
authorkpoppel <poulsen.kim@gmail.com>
Mon, 3 Jun 2013 21:37:04 +0000 (23:37 +0200)
committerkpoppel <poulsen.kim@gmail.com>
Mon, 3 Jun 2013 21:37:04 +0000 (23:37 +0200)
Added transformers for all voltage tiers.
I changed the recipes for solar panels to make them less expensive.
I also changed the output of the individual panel and made the arrays provie the real "oomph" :-)
Solar panels and arrays are dependent on light level, time of day and height abive ground (0) for output and cheating with torches and stuff.
Textures added.
Fixed bugs in the hv battery box. It was not working at all. I don't understand the hv box top texture though???
I have a sense that all machines connected to the battery boxes are taking the same amount of juice from the box.
A method of taking a little or a lot would be nice.

30 files changed:
technic/alloy_furnaces_commons.lua
technic/battery_box_hv.lua
technic/init.lua
technic/items.lua
technic/solar_array_hv.lua [new file with mode: 0644]
technic/solar_array_lv.lua [new file with mode: 0644]
technic/solar_array_mv.lua [new file with mode: 0644]
technic/solar_panel.lua
technic/textures/technic_hv_solar_array_bottom.png [new file with mode: 0644]
technic/textures/technic_hv_solar_array_side.png [new file with mode: 0644]
technic/textures/technic_hv_solar_array_top.png [new file with mode: 0644]
technic/textures/technic_hv_transformer.png [new file with mode: 0644]
technic/textures/technic_lv_solar_array_bottom.png [new file with mode: 0644]
technic/textures/technic_lv_solar_array_side.png [new file with mode: 0644]
technic/textures/technic_lv_solar_array_top.png [new file with mode: 0644]
technic/textures/technic_lv_transformer.png [new file with mode: 0644]
technic/textures/technic_mv_solar_array_bottom.png [new file with mode: 0644]
technic/textures/technic_mv_solar_array_side.png [new file with mode: 0644]
technic/textures/technic_mv_solar_array_top.png [new file with mode: 0644]
technic/textures/technicx32/technic_hv_solar_array_bottom.png [new file with mode: 0644]
technic/textures/technicx32/technic_hv_solar_array_side.png [new file with mode: 0644]
technic/textures/technicx32/technic_hv_solar_array_top.png [new file with mode: 0644]
technic/textures/technicx32/technic_hv_transformer.png [new file with mode: 0644]
technic/textures/technicx32/technic_lv_solar_array_bottom.png [new file with mode: 0644]
technic/textures/technicx32/technic_lv_solar_array_side.png [new file with mode: 0644]
technic/textures/technicx32/technic_lv_solar_array_top.png [new file with mode: 0644]
technic/textures/technicx32/technic_lv_transformer.png [new file with mode: 0644]
technic/textures/technicx32/technic_mv_solar_array_bottom.png [new file with mode: 0644]
technic/textures/technicx32/technic_mv_solar_array_side.png [new file with mode: 0644]
technic/textures/technicx32/technic_mv_solar_array_top.png [new file with mode: 0644]

index 559d00212cd899469185d1c2b6fa1e64496566c3..9c9c42a97cfd90f35c24222a9b101834d4c006cc 100644 (file)
@@ -36,4 +36,4 @@ register_alloy_recipe ("default:steel_ingot",3, "technic:chromium_ingot",1, "tec
 register_alloy_recipe ("technic:copper_dust",2, "technic:zinc_dust",1, "technic:brass_dust",3)
 register_alloy_recipe ("moreores:copper_ingot",2, "technic:zinc_ingot",1, "technic:brass_ingot",3)
 register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1)
-register_alloy_recipe ("technic:silicon_wafer",1, "technic:mithril_dust",1, "technic:doped_silicon_wafer",1)
+register_alloy_recipe ("technic:silicon_wafer",1, "technic:gold_dust",1, "technic:doped_silicon_wafer",1)
index 05166ebfe5a82d833c6554acad8f6107978e3577..e565d4cf3993e186929d6fa1cf810bdf8a0f8825 100644 (file)
@@ -13,7 +13,7 @@ minetest.register_craft({
        output = 'technic:hv_battery_box 1',
        recipe = {
                {'technic:mv_battery_box', 'technic:mv_battery_box', 'mv_technic:battery_box'},
-               {'technic:mv_battery_box', 'technic:transformer', 'mv_technic:battery_box'},
+               {'technic:mv_battery_box', 'technic:hv_transformer', 'mv_technic:battery_box'},
                {'', 'technic:hv_cable', ''},
        }
 }) 
@@ -78,7 +78,7 @@ minetest.register_node("technic:hv_battery_box"..i, {
        drop="technic:hv_battery_box",
        on_construct = function(pos)
                local meta = minetest.env:get_meta(pos)
-               meta:set_string("infotext", "hv Battery box")
+               meta:set_string("infotext", "HV Battery box")
                meta:set_float("technic_hv_power_machine", 1)
                meta:set_string("formspec", battery_box_formspec)
                local inv = meta:get_inventory()
@@ -342,7 +342,7 @@ end
 
 function check_HV_node_subp (PR_nodes,RE_nodes,HV_nodes,pos1)
 meta = minetest.env:get_meta(pos1)
-if meta:get_float("HV_cablelike")==1 then new_node_added=add_new_HVcable_node(HV_nodes,pos1) end
+if meta:get_float("hv_cablelike")==1 then new_node_added=add_new_HVcable_node(HV_nodes,pos1) end
 for i in ipairs(HV_machines) do
        if minetest.env:get_node(pos1).name == HV_machines[i].machine_name then 
                if HV_machines[i].machine_type == "PR" then
index eabf48ecf1d22b23bf6e045b6f9d4495b8368534..3cc73becf52dcaea540e42edd273387a52832d5a 100644 (file)
@@ -20,6 +20,7 @@ dofile(modpath.."/battery_box.lua")
 dofile(modpath.."/alloy_furnaces_commons.lua")
 dofile(modpath.."/alloy_furnace.lua")
 dofile(modpath.."/solar_panel.lua")
+dofile(modpath.."/solar_array_lv.lua")
 dofile(modpath.."/geothermal.lua")
 dofile(modpath.."/water_mill.lua")
 dofile(modpath.."/electric_furnace.lua")
@@ -34,7 +35,7 @@ dofile(modpath.."/cnc_nodes.lua")
 --MV machines
 dofile(modpath.."/wires_mv.lua")
 dofile(modpath.."/battery_box_mv.lua")
-dofile(modpath.."/solar_panel_mv.lua")
+dofile(modpath.."/solar_array_mv.lua")
 dofile(modpath.."/electric_furnace_mv.lua")
 dofile(modpath.."/alloy_furnace_mv.lua")
 dofile(modpath.."/forcefield.lua")
@@ -42,6 +43,7 @@ dofile(modpath.."/forcefield.lua")
 --HV machines
 dofile(modpath.."/wires_hv.lua")
 dofile(modpath.."/battery_box_hv.lua")
+dofile(modpath.."/solar_array_hv.lua")
 
 --Tools
 if technic.config:getBool("enable_mining_drill") then dofile(modpath.."/mining_drill.lua") end
index 7d18570533e2994d6f2d89ae4da6fb59d3211f66..66c5c85a4b0ed9d4bedc04e278a2f8ee27d97fc3 100644 (file)
@@ -160,6 +160,21 @@ minetest.register_craft({
        }
 })
 
+minetest.register_craftitem( "technic:lv_transformer", {
+       description = "Low Voltage Transformer",
+       inventory_image = "technic_lv_transformer.png",
+       on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craft({
+       output = 'technic:lv_transformer',
+       recipe = {
+               {'default:iron_lump',   'default:iron_lump', 'default:iron_lump'},
+               {'technic:copper_coil', 'default:iron_lump', 'technic:copper_coil'},
+               {'default:iron_lump',   'default:iron_lump', 'default:iron_lump'},
+       }
+})
+
 minetest.register_craftitem( "technic:mv_transformer", {
        description = "Medium Voltage Transformer",
        inventory_image = "technic_mv_transformer.png",
@@ -175,6 +190,21 @@ minetest.register_craft({
        }
 })
 
+minetest.register_craftitem( "technic:hv_transformer", {
+       description = "High Voltage Transformer",
+       inventory_image = "technic_hv_transformer.png",
+       on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craft({
+       output = 'technic:hv_transformer',
+       recipe = {
+               {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
+               {'technic:copper_coil',           'technic:stainless_steel_ingot', 'technic:copper_coil'},
+               {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
+       }
+})
+
 minetest.register_craftitem( "technic:control_logic_unit", {
        description = "Control Logic Unit",
        inventory_image = "technic_control_logic_unit.png",
diff --git a/technic/solar_array_hv.lua b/technic/solar_array_hv.lua
new file mode 100644 (file)
index 0000000..89f5d1b
--- /dev/null
@@ -0,0 +1,93 @@
+-- The high voltage solar array is an assembly of medium voltage arrays.
+-- The assembly can deliver high voltage levels and is a 20% less efficient
+-- compared to 5 individual medium voltage arrays due to losses in the transformer.
+-- However high voltage is supplied.
+-- Solar arrays are not able to store large amounts of energy.
+minetest.register_node("technic:solar_array_hv", {
+       tiles = {"technic_hv_solar_array_top.png", "technic_hv_solar_array_bottom.png", "technic_hv_solar_array_side.png",
+                "technic_hv_solar_array_side.png", "technic_hv_solar_array_side.png", "technic_hv_solar_array_side.png"},
+       groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
+       sounds = default.node_sound_wood_defaults(),
+       description="HV Solar Array",
+       active = false,
+       technic_hv_power_machine=1,
+       internal_EU_buffer=0;
+       internal_EU_buffer_size=3000;
+       drawtype = "nodebox",
+       paramtype = "light",
+       is_ground_content = true,       
+       node_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+               selection_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+       on_construct = function(pos)
+               local meta = minetest.env:get_meta(pos)
+               meta:set_float("technic_hv_power_machine", 1)
+               meta:set_float("internal_EU_buffer", 0)
+               meta:set_float("internal_EU_buffer_size", 3000)
+
+               meta:set_string("infotext", "HV Solar Array")
+               meta:set_float("active", false)
+       end,
+})
+
+minetest.register_craft({
+       output = 'technic:solar_array_hv 1',
+       recipe = {
+               {'technic:solar_array_mv', 'technic:solar_array_mv','technic:solar_array_mv'},
+               {'technic:solar_array_mv', 'technic:hv_transformer','technic:solar_array_mv'},
+               {'', 'technic:hv_cable',''},
+
+       }
+})
+
+minetest.register_abm(
+       {nodenames = {"technic:solar_array_hv"},
+       interval   = 1,
+       chance     = 1,
+       action = function(pos, node, active_object_count, active_object_count_wider)
+               -- The action here is to make the solar array produce power
+               -- Power is dependent on the light level and the height above ground
+               -- 130m and above is optimal as it would be above cloud level.
+                -- Height gives 1/4 of the effect, light 3/4. Max. effect is 2880EU for the array.
+                -- There are many ways to cheat by using other light sources like lamps.
+                -- As there is no way to determine if light is sunlight that is just a shame.
+                -- To take care of some of it solar panels do not work outside daylight hours or if
+                -- built below -10m
+               local pos1={}
+               pos1.y=pos.y+1
+               pos1.x=pos.x
+               pos1.z=pos.z
+
+               local light = minetest.env:get_node_light(pos1, nil)
+               local time_of_day = minetest.env:get_timeofday()
+               local meta = minetest.env:get_meta(pos)
+               if light == nil then light = 0 end
+               -- turn on array only during day time and if sufficient light
+                -- I know this is counter intuitive when cheating by using other light sources.
+               if light >= 12 and time_of_day>=0.24 and time_of_day<=0.76 and pos.y > -10 then
+                       local internal_EU_buffer      = meta:get_float("internal_EU_buffer")
+                       local internal_EU_buffer_size = meta:get_float("internal_EU_buffer_size")
+                       local charge_to_give          = math.floor(light*(light*9.6+pos1.y/130*48))
+                       if charge_to_give<0   then charge_to_give=0 end
+                       if charge_to_give>2880 then charge_to_give=2880 end
+                       if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then
+                          charge_to_give=internal_EU_buffer_size-internal_EU_buffer
+                       end
+                       meta:set_string("infotext", "Solar Array is active ("..charge_to_give.."EU)")
+                       meta:set_float("active",1)
+                       internal_EU_buffer=internal_EU_buffer+charge_to_give
+                       meta:set_float("internal_EU_buffer",internal_EU_buffer)
+                       
+               else
+                       meta:set_string("infotext", "Solar Array is inactive");
+                       meta:set_float("active",0)
+               end
+       end,
+}) 
+
+register_HV_machine ("technic:solar_array_hv","PR")
diff --git a/technic/solar_array_lv.lua b/technic/solar_array_lv.lua
new file mode 100644 (file)
index 0000000..f657814
--- /dev/null
@@ -0,0 +1,94 @@
+-- The solar array is an assembly of panels into a powerful array
+-- The assembly can deliver more energy than the individual panel because
+-- of the transformer unit which converts the panel output variations into
+-- a stable supply.
+-- Solar arrays are not able to store large amounts of energy.
+-- The LV arrays are used to make medium voltage arrays.
+minetest.register_node("technic:solar_array_lv", {
+       tiles = {"technic_lv_solar_array_top.png", "technic_lv_solar_array_bottom.png", "technic_lv_solar_array_side.png",
+               "technic_lv_solar_array_side.png", "technic_lv_solar_array_side.png", "technic_lv_solar_array_side.png"},
+       groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
+       sounds = default.node_sound_wood_defaults(),
+       description="LV Solar Array",
+       active = false,
+       technic_power_machine=1,
+       internal_EU_buffer=0;
+       internal_EU_buffer_size=1000;
+       drawtype = "nodebox",
+       paramtype = "light",
+       is_ground_content = true,       
+       node_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+               selection_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+       on_construct = function(pos)
+               local meta = minetest.env:get_meta(pos)
+               meta:set_float("technic_power_machine", 1)
+               meta:set_float("internal_EU_buffer", 0)
+               meta:set_float("internal_EU_buffer_size", 1000)
+
+               meta:set_string("infotext", "LV Solar Array")
+               meta:set_float("active", false)
+       end,
+})
+
+minetest.register_craft({
+       output = 'technic:solar_array_lv 1',
+       recipe = {
+               {'technic:solar_panel', 'technic:solar_panel',    'technic:solar_panel'},
+               {'technic:solar_panel', 'technic:lv_transformer', 'technic:solar_panel'},
+               {'default:steel_ingot', 'technic:lv_cable',       'default:steel_ingot'},
+
+       }
+})
+
+minetest.register_abm(
+       {nodenames = {"technic:solar_array_lv"},
+       interval   = 1,
+       chance     = 1,
+       action = function(pos, node, active_object_count, active_object_count_wider)
+               -- The action here is to make the solar array produce power
+               -- Power is dependent on the light level and the height above ground
+               -- 130m and above is optimal as it would be above cloud level.
+                -- Height gives 1/4 of the effect, light 3/4. Max. effect is 160EU for the array.
+                -- There are many ways to cheat by using other light sources like lamps.
+                -- As there is no way to determine if light is sunlight that is just a shame.
+                -- To take care of some of it solar arrays do not work outside daylight hours or if
+                -- built below -10m
+               local pos1={}
+               pos1.y=pos.y+1
+               pos1.x=pos.x
+               pos1.z=pos.z
+
+               local light = minetest.env:get_node_light(pos1, nil)
+               local time_of_day = minetest.env:get_timeofday()
+               local meta = minetest.env:get_meta(pos)
+               if light == nil then light = 0 end
+               -- turn on array only during day time and if sufficient light
+                -- I know this is counter intuitive when cheating by using other light sources.
+               if light >= 12 and time_of_day>=0.24 and time_of_day<=0.76 and pos.y > -10 then
+                       local internal_EU_buffer      = meta:get_float("internal_EU_buffer")
+                       local internal_EU_buffer_size = meta:get_float("internal_EU_buffer_size")
+                       local charge_to_give          = math.floor(light*(light*0.5333+pos1.y/130*2.6667))
+                       if charge_to_give<0   then charge_to_give=0 end
+                       if charge_to_give>160 then charge_to_give=160 end
+                       if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then
+                          charge_to_give=internal_EU_buffer_size-internal_EU_buffer
+                       end
+                       meta:set_string("infotext", "Solar Array is active ("..charge_to_give.."EU)")
+                       meta:set_float("active",1)
+                       internal_EU_buffer=internal_EU_buffer+charge_to_give
+                       meta:set_float("internal_EU_buffer",internal_EU_buffer)
+                       
+               else
+                       meta:set_string("infotext", "Solar Array is inactive");
+                       meta:set_float("active",0)
+               end
+       end,
+}) 
+
+register_LV_machine ("technic:solar_array_lv","PR")
diff --git a/technic/solar_array_mv.lua b/technic/solar_array_mv.lua
new file mode 100644 (file)
index 0000000..73fe85a
--- /dev/null
@@ -0,0 +1,94 @@
+-- The medium voltage solar array is an assembly of low voltage arrays.
+-- The assembly can deliver medium voltage levels and is a 10% less efficient
+-- compared to 5 individual low voltage arrays due to losses in the transformer.
+-- However medium voltage is supplied.
+-- Solar arrays are not able to store large amounts of energy.
+-- The MV arrays are used to make high voltage arrays.
+minetest.register_node("technic:solar_array_mv", {
+       tiles = {"technic_mv_solar_array_top.png", "technic_mv_solar_array_bottom.png", "technic_mv_solar_array_side.png",
+                "technic_mv_solar_array_side.png", "technic_mv_solar_array_side.png", "technic_mv_solar_array_side.png"},
+       groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
+       sounds = default.node_sound_wood_defaults(),
+       description="MV Solar Array",
+       active = false,
+       technic_mv_power_machine=1,
+       internal_EU_buffer=0;
+       internal_EU_buffer_size=1000;
+       drawtype = "nodebox",
+       paramtype = "light",
+       is_ground_content = true,       
+       node_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+               selection_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+       on_construct = function(pos)
+               local meta = minetest.env:get_meta(pos)
+               meta:set_float("technic_mv_power_machine", 1)
+               meta:set_float("internal_EU_buffer", 0)
+               meta:set_float("internal_EU_buffer_size", 1000)
+
+               meta:set_string("infotext", "MV Solar Array")
+               meta:set_float("active", false)
+       end,
+})
+
+minetest.register_craft({
+       output = 'technic:solar_array_mv 1',
+       recipe = {
+               {'technic:solar_array_lv', 'technic:solar_array_lv','technic:solar_array_lv'},
+               {'technic:solar_array_lv', 'technic:mv_transformer','technic:solar_array_lv'},
+               {'', 'technic:mv_cable',''},
+
+       }
+})
+
+minetest.register_abm(
+       {nodenames = {"technic:solar_array_mv"},
+       interval   = 1,
+       chance     = 1,
+       action = function(pos, node, active_object_count, active_object_count_wider)
+               -- The action here is to make the solar array produce power
+               -- Power is dependent on the light level and the height above ground
+               -- 130m and above is optimal as it would be above cloud level.
+                -- Height gives 1/4 of the effect, light 3/4. Max. effect is 720EU for the array.
+                -- There are many ways to cheat by using other light sources like lamps.
+                -- As there is no way to determine if light is sunlight that is just a shame.
+                -- To take care of some of it solar panels do not work outside daylight hours or if
+                -- built below -10m
+               local pos1={}
+               pos1.y=pos.y+1
+               pos1.x=pos.x
+               pos1.z=pos.z
+
+               local light = minetest.env:get_node_light(pos1, nil)
+               local time_of_day = minetest.env:get_timeofday()
+               local meta = minetest.env:get_meta(pos)
+               if light == nil then light = 0 end
+               -- turn on array only during day time and if sufficient light
+                -- I know this is counter intuitive when cheating by using other light sources.
+               if light >= 12 and time_of_day>=0.24 and time_of_day<=0.76 and pos.y > -10 then
+                       local internal_EU_buffer      = meta:get_float("internal_EU_buffer")
+                       local internal_EU_buffer_size = meta:get_float("internal_EU_buffer_size")
+                       local charge_to_give          = math.floor(light*(light*2.4+pos1.y/130*12))
+                       if charge_to_give<0   then charge_to_give=0 end
+                       if charge_to_give>720 then charge_to_give=720 end
+                       if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then
+                          charge_to_give=internal_EU_buffer_size-internal_EU_buffer
+                       end
+                       meta:set_string("infotext", "Solar Array is active ("..charge_to_give.."EU)")
+                       meta:set_float("active",1)
+                       internal_EU_buffer=internal_EU_buffer+charge_to_give
+                       meta:set_float("internal_EU_buffer",internal_EU_buffer)
+                       
+               else
+                       meta:set_string("infotext", "Solar Array is inactive");
+                       meta:set_float("active",0)
+               end
+       end,
+}) 
+
+register_MV_machine ("technic:solar_array_mv","PR")
index 93f2b63873ffd3f9d3dc254a3a49599285891b5e..5b53f5fbee3e24aa4f2c852d6195f324e2dfbb14 100644 (file)
@@ -1,3 +1,6 @@
+-- Solar panels are the building blocks of LV solar arrays
+-- They can however also be used separately but with reduced efficiency due to the missing transformer.
+-- Individual panels are 20% less efficient than when the panels are combined into full arrays.
 minetest.register_node("technic:solar_panel", {
        tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
                "technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"},
@@ -7,7 +10,7 @@ minetest.register_node("technic:solar_panel", {
        active = false,
        technic_power_machine=1,
        internal_EU_buffer=0;
-       internal_EU_buffer_size=1000;
+       internal_EU_buffer_size=160;
        drawtype = "nodebox",
        paramtype = "light",
        is_ground_content = true,       
@@ -23,7 +26,7 @@ minetest.register_node("technic:solar_panel", {
                local meta = minetest.env:get_meta(pos)
                meta:set_float("technic_power_machine", 1)
                meta:set_float("internal_EU_buffer", 0)
-               meta:set_float("internal_EU_buffer_size", 1000)
+               meta:set_float("internal_EU_buffer_size", 160)
 
                meta:set_string("infotext", "Solar Panel")
                meta:set_float("active", false)
@@ -34,7 +37,7 @@ minetest.register_craft({
        output = 'technic:solar_panel 1',
        recipe = {
                {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'},
-               {'technic:doped_silicon_wafer', 'moreores:copper_ingot','technic:doped_silicon_wafer'},
+               {'technic:doped_silicon_wafer', 'technic:lv_cable',           'technic:doped_silicon_wafer'},
                {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'},
 
        }
@@ -42,29 +45,39 @@ minetest.register_craft({
 
 minetest.register_abm(
        {nodenames = {"technic:solar_panel"},
-       interval = 1,
-       chance = 1,
+       interval   = 1,
+       chance     = 1,
        action = function(pos, node, active_object_count, active_object_count_wider)
-               
+               -- The action here is to make the solar panel prodice power
+               -- Power is dependent on the light level and the height above ground
+               -- 130m and above is optimal as it would be above cloud level.
+                -- Height gives 1/4 of the effect, light 3/4. Max. effect is 26EU.
+                -- There are many ways to cheat by using other light sources like lamps.
+                -- As there is no way to determine if light is sunlight that is just a shame.
+                -- To take care of some of it solar panels do not work outside daylight hours or if
+                -- built below -10m
                local pos1={}
                pos1.y=pos.y+1
                pos1.x=pos.x
                pos1.z=pos.z
 
                local light = minetest.env:get_node_light(pos1, nil)
+               local time_of_day = minetest.env:get_timeofday()
                local meta = minetest.env:get_meta(pos)
                if light == nil then light = 0 end
-               if light >= 12 then
-                       meta:set_string("infotext", "Solar Panel is active ")
-                       meta:set_float("active",1)
+               -- turn on panel only during day time and if sufficient light
+                -- I know this is counter intuitive when cheating by using other light sources underground.
+               if light >= 12 and time_of_day>=0.24 and time_of_day<=0.76 and pos.y > -10 then
                        local internal_EU_buffer=meta:get_float("internal_EU_buffer")
                        local internal_EU_buffer_size=meta:get_float("internal_EU_buffer_size")
-                       local charge_to_give=40+(pos1.y/250*40) -- make solar energy depending on height
+                       local charge_to_give=math.floor(light*(light*0.0867+pos1.y/130*0.4333))
                        if charge_to_give<0 then charge_to_give=0 end
-                       if charge_to_give>160 then charge_to_give=160 end
+                       if charge_to_give>26 then charge_to_give=26 end
                        if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then
-                       charge_to_give=internal_EU_buffer_size-internal_EU_buffer
+                          charge_to_give=internal_EU_buffer_size-internal_EU_buffer
                        end
+                       meta:set_string("infotext", "Solar Panel is active ("..charge_to_give.."EU)")
+                       meta:set_float("active",1)
                        internal_EU_buffer=internal_EU_buffer+charge_to_give
                        meta:set_float("internal_EU_buffer",internal_EU_buffer)
                        
diff --git a/technic/textures/technic_hv_solar_array_bottom.png b/technic/textures/technic_hv_solar_array_bottom.png
new file mode 100644 (file)
index 0000000..596e79a
Binary files /dev/null and b/technic/textures/technic_hv_solar_array_bottom.png differ
diff --git a/technic/textures/technic_hv_solar_array_side.png b/technic/textures/technic_hv_solar_array_side.png
new file mode 100644 (file)
index 0000000..a3aa8c7
Binary files /dev/null and b/technic/textures/technic_hv_solar_array_side.png differ
diff --git a/technic/textures/technic_hv_solar_array_top.png b/technic/textures/technic_hv_solar_array_top.png
new file mode 100644 (file)
index 0000000..b7f0b43
Binary files /dev/null and b/technic/textures/technic_hv_solar_array_top.png differ
diff --git a/technic/textures/technic_hv_transformer.png b/technic/textures/technic_hv_transformer.png
new file mode 100644 (file)
index 0000000..e1d4c98
Binary files /dev/null and b/technic/textures/technic_hv_transformer.png differ
diff --git a/technic/textures/technic_lv_solar_array_bottom.png b/technic/textures/technic_lv_solar_array_bottom.png
new file mode 100644 (file)
index 0000000..9e888e3
Binary files /dev/null and b/technic/textures/technic_lv_solar_array_bottom.png differ
diff --git a/technic/textures/technic_lv_solar_array_side.png b/technic/textures/technic_lv_solar_array_side.png
new file mode 100644 (file)
index 0000000..b22447e
Binary files /dev/null and b/technic/textures/technic_lv_solar_array_side.png differ
diff --git a/technic/textures/technic_lv_solar_array_top.png b/technic/textures/technic_lv_solar_array_top.png
new file mode 100644 (file)
index 0000000..cabd315
Binary files /dev/null and b/technic/textures/technic_lv_solar_array_top.png differ
diff --git a/technic/textures/technic_lv_transformer.png b/technic/textures/technic_lv_transformer.png
new file mode 100644 (file)
index 0000000..613b196
Binary files /dev/null and b/technic/textures/technic_lv_transformer.png differ
diff --git a/technic/textures/technic_mv_solar_array_bottom.png b/technic/textures/technic_mv_solar_array_bottom.png
new file mode 100644 (file)
index 0000000..596e79a
Binary files /dev/null and b/technic/textures/technic_mv_solar_array_bottom.png differ
diff --git a/technic/textures/technic_mv_solar_array_side.png b/technic/textures/technic_mv_solar_array_side.png
new file mode 100644 (file)
index 0000000..917b9ed
Binary files /dev/null and b/technic/textures/technic_mv_solar_array_side.png differ
diff --git a/technic/textures/technic_mv_solar_array_top.png b/technic/textures/technic_mv_solar_array_top.png
new file mode 100644 (file)
index 0000000..cdb7cf7
Binary files /dev/null and b/technic/textures/technic_mv_solar_array_top.png differ
diff --git a/technic/textures/technicx32/technic_hv_solar_array_bottom.png b/technic/textures/technicx32/technic_hv_solar_array_bottom.png
new file mode 100644 (file)
index 0000000..94c8222
Binary files /dev/null and b/technic/textures/technicx32/technic_hv_solar_array_bottom.png differ
diff --git a/technic/textures/technicx32/technic_hv_solar_array_side.png b/technic/textures/technicx32/technic_hv_solar_array_side.png
new file mode 100644 (file)
index 0000000..d39d3d8
Binary files /dev/null and b/technic/textures/technicx32/technic_hv_solar_array_side.png differ
diff --git a/technic/textures/technicx32/technic_hv_solar_array_top.png b/technic/textures/technicx32/technic_hv_solar_array_top.png
new file mode 100644 (file)
index 0000000..3e1b9e0
Binary files /dev/null and b/technic/textures/technicx32/technic_hv_solar_array_top.png differ
diff --git a/technic/textures/technicx32/technic_hv_transformer.png b/technic/textures/technicx32/technic_hv_transformer.png
new file mode 100644 (file)
index 0000000..7794644
Binary files /dev/null and b/technic/textures/technicx32/technic_hv_transformer.png differ
diff --git a/technic/textures/technicx32/technic_lv_solar_array_bottom.png b/technic/textures/technicx32/technic_lv_solar_array_bottom.png
new file mode 100644 (file)
index 0000000..94c8222
Binary files /dev/null and b/technic/textures/technicx32/technic_lv_solar_array_bottom.png differ
diff --git a/technic/textures/technicx32/technic_lv_solar_array_side.png b/technic/textures/technicx32/technic_lv_solar_array_side.png
new file mode 100644 (file)
index 0000000..d39d3d8
Binary files /dev/null and b/technic/textures/technicx32/technic_lv_solar_array_side.png differ
diff --git a/technic/textures/technicx32/technic_lv_solar_array_top.png b/technic/textures/technicx32/technic_lv_solar_array_top.png
new file mode 100644 (file)
index 0000000..3d8c7ab
Binary files /dev/null and b/technic/textures/technicx32/technic_lv_solar_array_top.png differ
diff --git a/technic/textures/technicx32/technic_lv_transformer.png b/technic/textures/technicx32/technic_lv_transformer.png
new file mode 100644 (file)
index 0000000..99ac927
Binary files /dev/null and b/technic/textures/technicx32/technic_lv_transformer.png differ
diff --git a/technic/textures/technicx32/technic_mv_solar_array_bottom.png b/technic/textures/technicx32/technic_mv_solar_array_bottom.png
new file mode 100644 (file)
index 0000000..94c8222
Binary files /dev/null and b/technic/textures/technicx32/technic_mv_solar_array_bottom.png differ
diff --git a/technic/textures/technicx32/technic_mv_solar_array_side.png b/technic/textures/technicx32/technic_mv_solar_array_side.png
new file mode 100644 (file)
index 0000000..d39d3d8
Binary files /dev/null and b/technic/textures/technicx32/technic_mv_solar_array_side.png differ
diff --git a/technic/textures/technicx32/technic_mv_solar_array_top.png b/technic/textures/technicx32/technic_mv_solar_array_top.png
new file mode 100644 (file)
index 0000000..e4999d5
Binary files /dev/null and b/technic/textures/technicx32/technic_mv_solar_array_top.png differ