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.
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)
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', ''},
}
})
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()
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
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")
--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")
--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
}
})
+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",
}
})
+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",
--- /dev/null
+-- 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")
--- /dev/null
+-- 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")
--- /dev/null
+-- 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")
+-- 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"},
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,
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)
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'},
}
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)