summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpoppel <poulsen.kim@gmail.com>2013-06-03 23:37:04 +0200
committerkpoppel <poulsen.kim@gmail.com>2013-06-03 23:37:04 +0200
commitede3978965790f9683b96d12fc0bf80ba30824cd (patch)
treee64e9720caf07732e663150f613487a5c3058eed
parenta9a8f3be3404f08de2a1cc1f133f3985c18cccb3 (diff)
Added solar arrays for all voltage tiers.
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.
-rw-r--r--technic/alloy_furnaces_commons.lua2
-rw-r--r--technic/battery_box_hv.lua6
-rw-r--r--technic/init.lua4
-rw-r--r--technic/items.lua30
-rw-r--r--technic/solar_array_hv.lua93
-rw-r--r--technic/solar_array_lv.lua94
-rw-r--r--technic/solar_array_mv.lua94
-rw-r--r--technic/solar_panel.lua37
-rw-r--r--technic/textures/technic_hv_solar_array_bottom.pngbin0 -> 574 bytes
-rw-r--r--technic/textures/technic_hv_solar_array_side.pngbin0 -> 709 bytes
-rw-r--r--technic/textures/technic_hv_solar_array_top.pngbin0 -> 777 bytes
-rw-r--r--technic/textures/technic_hv_transformer.pngbin0 -> 1801 bytes
-rw-r--r--technic/textures/technic_lv_solar_array_bottom.pngbin0 -> 579 bytes
-rw-r--r--technic/textures/technic_lv_solar_array_side.pngbin0 -> 465 bytes
-rw-r--r--technic/textures/technic_lv_solar_array_top.pngbin0 -> 743 bytes
-rw-r--r--technic/textures/technic_lv_transformer.pngbin0 -> 1821 bytes
-rw-r--r--technic/textures/technic_mv_solar_array_bottom.pngbin0 -> 574 bytes
-rw-r--r--technic/textures/technic_mv_solar_array_side.pngbin0 -> 628 bytes
-rw-r--r--technic/textures/technic_mv_solar_array_top.pngbin0 -> 728 bytes
-rw-r--r--technic/textures/technicx32/technic_hv_solar_array_bottom.pngbin0 -> 2019 bytes
-rw-r--r--technic/textures/technicx32/technic_hv_solar_array_side.pngbin0 -> 1772 bytes
-rw-r--r--technic/textures/technicx32/technic_hv_solar_array_top.pngbin0 -> 2855 bytes
-rw-r--r--technic/textures/technicx32/technic_hv_transformer.pngbin0 -> 1789 bytes
-rw-r--r--technic/textures/technicx32/technic_lv_solar_array_bottom.pngbin0 -> 2019 bytes
-rw-r--r--technic/textures/technicx32/technic_lv_solar_array_side.pngbin0 -> 1772 bytes
-rw-r--r--technic/textures/technicx32/technic_lv_solar_array_top.pngbin0 -> 2728 bytes
-rw-r--r--technic/textures/technicx32/technic_lv_transformer.pngbin0 -> 1809 bytes
-rw-r--r--technic/textures/technicx32/technic_mv_solar_array_bottom.pngbin0 -> 2019 bytes
-rw-r--r--technic/textures/technicx32/technic_mv_solar_array_side.pngbin0 -> 1772 bytes
-rw-r--r--technic/textures/technicx32/technic_mv_solar_array_top.pngbin0 -> 2784 bytes
30 files changed, 343 insertions, 17 deletions
diff --git a/technic/alloy_furnaces_commons.lua b/technic/alloy_furnaces_commons.lua
index 559d002..9c9c42a 100644
--- a/technic/alloy_furnaces_commons.lua
+++ b/technic/alloy_furnaces_commons.lua
@@ -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)
diff --git a/technic/battery_box_hv.lua b/technic/battery_box_hv.lua
index 05166eb..e565d4c 100644
--- a/technic/battery_box_hv.lua
+++ b/technic/battery_box_hv.lua
@@ -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
diff --git a/technic/init.lua b/technic/init.lua
index eabf48e..3cc73be 100644
--- a/technic/init.lua
+++ b/technic/init.lua
@@ -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
diff --git a/technic/items.lua b/technic/items.lua
index 7d18570..66c5c85 100644
--- a/technic/items.lua
+++ b/technic/items.lua
@@ -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
index 0000000..89f5d1b
--- /dev/null
+++ b/technic/solar_array_hv.lua
@@ -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
index 0000000..f657814
--- /dev/null
+++ b/technic/solar_array_lv.lua
@@ -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
index 0000000..73fe85a
--- /dev/null
+++ b/technic/solar_array_mv.lua
@@ -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")
diff --git a/technic/solar_panel.lua b/technic/solar_panel.lua
index 93f2b63..5b53f5f 100644
--- a/technic/solar_panel.lua
+++ b/technic/solar_panel.lua
@@ -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
index 0000000..596e79a
--- /dev/null
+++ b/technic/textures/technic_hv_solar_array_bottom.png
Binary files 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
index 0000000..a3aa8c7
--- /dev/null
+++ b/technic/textures/technic_hv_solar_array_side.png
Binary files 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
index 0000000..b7f0b43
--- /dev/null
+++ b/technic/textures/technic_hv_solar_array_top.png
Binary files differ
diff --git a/technic/textures/technic_hv_transformer.png b/technic/textures/technic_hv_transformer.png
new file mode 100644
index 0000000..e1d4c98
--- /dev/null
+++ b/technic/textures/technic_hv_transformer.png
Binary files 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
index 0000000..9e888e3
--- /dev/null
+++ b/technic/textures/technic_lv_solar_array_bottom.png
Binary files 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
index 0000000..b22447e
--- /dev/null
+++ b/technic/textures/technic_lv_solar_array_side.png
Binary files 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
index 0000000..cabd315
--- /dev/null
+++ b/technic/textures/technic_lv_solar_array_top.png
Binary files differ
diff --git a/technic/textures/technic_lv_transformer.png b/technic/textures/technic_lv_transformer.png
new file mode 100644
index 0000000..613b196
--- /dev/null
+++ b/technic/textures/technic_lv_transformer.png
Binary files 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
index 0000000..596e79a
--- /dev/null
+++ b/technic/textures/technic_mv_solar_array_bottom.png
Binary files 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
index 0000000..917b9ed
--- /dev/null
+++ b/technic/textures/technic_mv_solar_array_side.png
Binary files 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
index 0000000..cdb7cf7
--- /dev/null
+++ b/technic/textures/technic_mv_solar_array_top.png
Binary files 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
index 0000000..94c8222
--- /dev/null
+++ b/technic/textures/technicx32/technic_hv_solar_array_bottom.png
Binary files 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
index 0000000..d39d3d8
--- /dev/null
+++ b/technic/textures/technicx32/technic_hv_solar_array_side.png
Binary files 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
index 0000000..3e1b9e0
--- /dev/null
+++ b/technic/textures/technicx32/technic_hv_solar_array_top.png
Binary files differ
diff --git a/technic/textures/technicx32/technic_hv_transformer.png b/technic/textures/technicx32/technic_hv_transformer.png
new file mode 100644
index 0000000..7794644
--- /dev/null
+++ b/technic/textures/technicx32/technic_hv_transformer.png
Binary files 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
index 0000000..94c8222
--- /dev/null
+++ b/technic/textures/technicx32/technic_lv_solar_array_bottom.png
Binary files 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
index 0000000..d39d3d8
--- /dev/null
+++ b/technic/textures/technicx32/technic_lv_solar_array_side.png
Binary files 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
index 0000000..3d8c7ab
--- /dev/null
+++ b/technic/textures/technicx32/technic_lv_solar_array_top.png
Binary files differ
diff --git a/technic/textures/technicx32/technic_lv_transformer.png b/technic/textures/technicx32/technic_lv_transformer.png
new file mode 100644
index 0000000..99ac927
--- /dev/null
+++ b/technic/textures/technicx32/technic_lv_transformer.png
Binary files 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
index 0000000..94c8222
--- /dev/null
+++ b/technic/textures/technicx32/technic_mv_solar_array_bottom.png
Binary files 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
index 0000000..d39d3d8
--- /dev/null
+++ b/technic/textures/technicx32/technic_mv_solar_array_side.png
Binary files 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
index 0000000..e4999d5
--- /dev/null
+++ b/technic/textures/technicx32/technic_mv_solar_array_top.png
Binary files differ