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.
@ -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 ("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 ("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 ("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)
|
||||||
|
@ -13,7 +13,7 @@ minetest.register_craft({
|
|||||||
output = 'technic:hv_battery_box 1',
|
output = 'technic:hv_battery_box 1',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'technic:mv_battery_box', 'technic:mv_battery_box', 'mv_technic:battery_box'},
|
{'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', ''},
|
{'', 'technic:hv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -78,7 +78,7 @@ minetest.register_node("technic:hv_battery_box"..i, {
|
|||||||
drop="technic:hv_battery_box",
|
drop="technic:hv_battery_box",
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.env:get_meta(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_float("technic_hv_power_machine", 1)
|
||||||
meta:set_string("formspec", battery_box_formspec)
|
meta:set_string("formspec", battery_box_formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -342,7 +342,7 @@ end
|
|||||||
|
|
||||||
function check_HV_node_subp (PR_nodes,RE_nodes,HV_nodes,pos1)
|
function check_HV_node_subp (PR_nodes,RE_nodes,HV_nodes,pos1)
|
||||||
meta = minetest.env:get_meta(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
|
for i in ipairs(HV_machines) do
|
||||||
if minetest.env:get_node(pos1).name == HV_machines[i].machine_name then
|
if minetest.env:get_node(pos1).name == HV_machines[i].machine_name then
|
||||||
if HV_machines[i].machine_type == "PR" then
|
if HV_machines[i].machine_type == "PR" then
|
||||||
|
@ -20,6 +20,7 @@ dofile(modpath.."/battery_box.lua")
|
|||||||
dofile(modpath.."/alloy_furnaces_commons.lua")
|
dofile(modpath.."/alloy_furnaces_commons.lua")
|
||||||
dofile(modpath.."/alloy_furnace.lua")
|
dofile(modpath.."/alloy_furnace.lua")
|
||||||
dofile(modpath.."/solar_panel.lua")
|
dofile(modpath.."/solar_panel.lua")
|
||||||
|
dofile(modpath.."/solar_array_lv.lua")
|
||||||
dofile(modpath.."/geothermal.lua")
|
dofile(modpath.."/geothermal.lua")
|
||||||
dofile(modpath.."/water_mill.lua")
|
dofile(modpath.."/water_mill.lua")
|
||||||
dofile(modpath.."/electric_furnace.lua")
|
dofile(modpath.."/electric_furnace.lua")
|
||||||
@ -34,7 +35,7 @@ dofile(modpath.."/cnc_nodes.lua")
|
|||||||
--MV machines
|
--MV machines
|
||||||
dofile(modpath.."/wires_mv.lua")
|
dofile(modpath.."/wires_mv.lua")
|
||||||
dofile(modpath.."/battery_box_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.."/electric_furnace_mv.lua")
|
||||||
dofile(modpath.."/alloy_furnace_mv.lua")
|
dofile(modpath.."/alloy_furnace_mv.lua")
|
||||||
dofile(modpath.."/forcefield.lua")
|
dofile(modpath.."/forcefield.lua")
|
||||||
@ -42,6 +43,7 @@ dofile(modpath.."/forcefield.lua")
|
|||||||
--HV machines
|
--HV machines
|
||||||
dofile(modpath.."/wires_hv.lua")
|
dofile(modpath.."/wires_hv.lua")
|
||||||
dofile(modpath.."/battery_box_hv.lua")
|
dofile(modpath.."/battery_box_hv.lua")
|
||||||
|
dofile(modpath.."/solar_array_hv.lua")
|
||||||
|
|
||||||
--Tools
|
--Tools
|
||||||
if technic.config:getBool("enable_mining_drill") then dofile(modpath.."/mining_drill.lua") end
|
if technic.config:getBool("enable_mining_drill") then dofile(modpath.."/mining_drill.lua") end
|
||||||
|
@ -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", {
|
minetest.register_craftitem( "technic:mv_transformer", {
|
||||||
description = "Medium Voltage Transformer",
|
description = "Medium Voltage Transformer",
|
||||||
inventory_image = "technic_mv_transformer.png",
|
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", {
|
minetest.register_craftitem( "technic:control_logic_unit", {
|
||||||
description = "Control Logic Unit",
|
description = "Control Logic Unit",
|
||||||
inventory_image = "technic_control_logic_unit.png",
|
inventory_image = "technic_control_logic_unit.png",
|
||||||
|
93
technic/solar_array_hv.lua
Normal file
@ -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")
|
94
technic/solar_array_lv.lua
Normal file
@ -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")
|
94
technic/solar_array_mv.lua
Normal file
@ -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")
|
@ -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", {
|
minetest.register_node("technic:solar_panel", {
|
||||||
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
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"},
|
"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,
|
active = false,
|
||||||
technic_power_machine=1,
|
technic_power_machine=1,
|
||||||
internal_EU_buffer=0;
|
internal_EU_buffer=0;
|
||||||
internal_EU_buffer_size=1000;
|
internal_EU_buffer_size=160;
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
@ -23,7 +26,7 @@ minetest.register_node("technic:solar_panel", {
|
|||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
meta:set_float("technic_power_machine", 1)
|
meta:set_float("technic_power_machine", 1)
|
||||||
meta:set_float("internal_EU_buffer", 0)
|
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_string("infotext", "Solar Panel")
|
||||||
meta:set_float("active", false)
|
meta:set_float("active", false)
|
||||||
@ -34,7 +37,7 @@ minetest.register_craft({
|
|||||||
output = 'technic:solar_panel 1',
|
output = 'technic:solar_panel 1',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'},
|
{'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'},
|
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'},
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -45,26 +48,36 @@ minetest.register_abm(
|
|||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
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={}
|
local pos1={}
|
||||||
pos1.y=pos.y+1
|
pos1.y=pos.y+1
|
||||||
pos1.x=pos.x
|
pos1.x=pos.x
|
||||||
pos1.z=pos.z
|
pos1.z=pos.z
|
||||||
|
|
||||||
local light = minetest.env:get_node_light(pos1, nil)
|
local light = minetest.env:get_node_light(pos1, nil)
|
||||||
|
local time_of_day = minetest.env:get_timeofday()
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
if light == nil then light = 0 end
|
if light == nil then light = 0 end
|
||||||
if light >= 12 then
|
-- turn on panel only during day time and if sufficient light
|
||||||
meta:set_string("infotext", "Solar Panel is active ")
|
-- I know this is counter intuitive when cheating by using other light sources underground.
|
||||||
meta:set_float("active",1)
|
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=meta:get_float("internal_EU_buffer")
|
||||||
local internal_EU_buffer_size=meta:get_float("internal_EU_buffer_size")
|
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<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
|
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
|
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
|
internal_EU_buffer=internal_EU_buffer+charge_to_give
|
||||||
meta:set_float("internal_EU_buffer",internal_EU_buffer)
|
meta:set_float("internal_EU_buffer",internal_EU_buffer)
|
||||||
|
|
||||||
|
BIN
technic/textures/technic_hv_solar_array_bottom.png
Normal file
After Width: | Height: | Size: 574 B |
BIN
technic/textures/technic_hv_solar_array_side.png
Normal file
After Width: | Height: | Size: 709 B |
BIN
technic/textures/technic_hv_solar_array_top.png
Normal file
After Width: | Height: | Size: 777 B |
BIN
technic/textures/technic_hv_transformer.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
technic/textures/technic_lv_solar_array_bottom.png
Normal file
After Width: | Height: | Size: 579 B |
BIN
technic/textures/technic_lv_solar_array_side.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
technic/textures/technic_lv_solar_array_top.png
Normal file
After Width: | Height: | Size: 743 B |
BIN
technic/textures/technic_lv_transformer.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
technic/textures/technic_mv_solar_array_bottom.png
Normal file
After Width: | Height: | Size: 574 B |
BIN
technic/textures/technic_mv_solar_array_side.png
Normal file
After Width: | Height: | Size: 628 B |
BIN
technic/textures/technic_mv_solar_array_top.png
Normal file
After Width: | Height: | Size: 728 B |
BIN
technic/textures/technicx32/technic_hv_solar_array_bottom.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
technic/textures/technicx32/technic_hv_solar_array_side.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
technic/textures/technicx32/technic_hv_solar_array_top.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
technic/textures/technicx32/technic_hv_transformer.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
technic/textures/technicx32/technic_lv_solar_array_bottom.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
technic/textures/technicx32/technic_lv_solar_array_side.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
technic/textures/technicx32/technic_lv_solar_array_top.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
technic/textures/technicx32/technic_lv_transformer.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
technic/textures/technicx32/technic_mv_solar_array_bottom.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
technic/textures/technicx32/technic_mv_solar_array_side.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
technic/textures/technicx32/technic_mv_solar_array_top.png
Normal file
After Width: | Height: | Size: 2.7 KiB |