From ede3978965790f9683b96d12fc0bf80ba30824cd Mon Sep 17 00:00:00 2001 From: kpoppel Date: Mon, 3 Jun 2013 23:37:04 +0200 Subject: 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. --- technic/alloy_furnaces_commons.lua | 2 +- technic/battery_box_hv.lua | 6 +- technic/init.lua | 4 +- technic/items.lua | 30 +++++++ technic/solar_array_hv.lua | 93 ++++++++++++++++++++ technic/solar_array_lv.lua | 94 +++++++++++++++++++++ technic/solar_array_mv.lua | 94 +++++++++++++++++++++ technic/solar_panel.lua | 37 +++++--- technic/textures/technic_hv_solar_array_bottom.png | Bin 0 -> 574 bytes technic/textures/technic_hv_solar_array_side.png | Bin 0 -> 709 bytes technic/textures/technic_hv_solar_array_top.png | Bin 0 -> 777 bytes technic/textures/technic_hv_transformer.png | Bin 0 -> 1801 bytes technic/textures/technic_lv_solar_array_bottom.png | Bin 0 -> 579 bytes technic/textures/technic_lv_solar_array_side.png | Bin 0 -> 465 bytes technic/textures/technic_lv_solar_array_top.png | Bin 0 -> 743 bytes technic/textures/technic_lv_transformer.png | Bin 0 -> 1821 bytes technic/textures/technic_mv_solar_array_bottom.png | Bin 0 -> 574 bytes technic/textures/technic_mv_solar_array_side.png | Bin 0 -> 628 bytes technic/textures/technic_mv_solar_array_top.png | Bin 0 -> 728 bytes .../technicx32/technic_hv_solar_array_bottom.png | Bin 0 -> 2019 bytes .../technicx32/technic_hv_solar_array_side.png | Bin 0 -> 1772 bytes .../technicx32/technic_hv_solar_array_top.png | Bin 0 -> 2855 bytes .../textures/technicx32/technic_hv_transformer.png | Bin 0 -> 1789 bytes .../technicx32/technic_lv_solar_array_bottom.png | Bin 0 -> 2019 bytes .../technicx32/technic_lv_solar_array_side.png | Bin 0 -> 1772 bytes .../technicx32/technic_lv_solar_array_top.png | Bin 0 -> 2728 bytes .../textures/technicx32/technic_lv_transformer.png | Bin 0 -> 1809 bytes .../technicx32/technic_mv_solar_array_bottom.png | Bin 0 -> 2019 bytes .../technicx32/technic_mv_solar_array_side.png | Bin 0 -> 1772 bytes .../technicx32/technic_mv_solar_array_top.png | Bin 0 -> 2784 bytes 30 files changed, 343 insertions(+), 17 deletions(-) create mode 100644 technic/solar_array_hv.lua create mode 100644 technic/solar_array_lv.lua create mode 100644 technic/solar_array_mv.lua create mode 100644 technic/textures/technic_hv_solar_array_bottom.png create mode 100644 technic/textures/technic_hv_solar_array_side.png create mode 100644 technic/textures/technic_hv_solar_array_top.png create mode 100644 technic/textures/technic_hv_transformer.png create mode 100644 technic/textures/technic_lv_solar_array_bottom.png create mode 100644 technic/textures/technic_lv_solar_array_side.png create mode 100644 technic/textures/technic_lv_solar_array_top.png create mode 100644 technic/textures/technic_lv_transformer.png create mode 100644 technic/textures/technic_mv_solar_array_bottom.png create mode 100644 technic/textures/technic_mv_solar_array_side.png create mode 100644 technic/textures/technic_mv_solar_array_top.png create mode 100644 technic/textures/technicx32/technic_hv_solar_array_bottom.png create mode 100644 technic/textures/technicx32/technic_hv_solar_array_side.png create mode 100644 technic/textures/technicx32/technic_hv_solar_array_top.png create mode 100644 technic/textures/technicx32/technic_hv_transformer.png create mode 100644 technic/textures/technicx32/technic_lv_solar_array_bottom.png create mode 100644 technic/textures/technicx32/technic_lv_solar_array_side.png create mode 100644 technic/textures/technicx32/technic_lv_solar_array_top.png create mode 100644 technic/textures/technicx32/technic_lv_transformer.png create mode 100644 technic/textures/technicx32/technic_mv_solar_array_bottom.png create mode 100644 technic/textures/technicx32/technic_mv_solar_array_side.png create mode 100644 technic/textures/technicx32/technic_mv_solar_array_top.png 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 index 0000000..e4999d5 Binary files /dev/null and b/technic/textures/technicx32/technic_mv_solar_array_top.png differ -- cgit v1.2.3 From 4f1a44a80b5522db60125f3018c0ce80fbb9e3b4 Mon Sep 17 00:00:00 2001 From: kpoppel Date: Mon, 3 Jun 2013 23:42:44 +0200 Subject: Removing ununsed textures. Added more safety to item_drop to get around a fatal server halt issue. --- item_drop/item_entity.lua | 2 +- technic/solar_panel_mv.lua | 78 --------------------- technic/textures/technic_mv_solar_panel_bottom.png | Bin 574 -> 0 bytes technic/textures/technic_mv_solar_panel_side.png | Bin 628 -> 0 bytes technic/textures/technic_mv_solar_panel_top.png | Bin 728 -> 0 bytes technic/textures/technic_mv_solarpanel_bottom.png | Bin 574 -> 0 bytes technic/textures/technic_mv_solarpanel_side.png | Bin 628 -> 0 bytes technic/textures/technic_mv_solarpanel_top.png | Bin 728 -> 0 bytes .../technicx32/technic_mv_solar_panel_bottom.png | Bin 2019 -> 0 bytes .../technicx32/technic_mv_solar_panel_side.png | Bin 1772 -> 0 bytes .../technicx32/technic_mv_solar_panel_top.png | Bin 2728 -> 0 bytes 11 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 technic/solar_panel_mv.lua delete mode 100644 technic/textures/technic_mv_solar_panel_bottom.png delete mode 100644 technic/textures/technic_mv_solar_panel_side.png delete mode 100644 technic/textures/technic_mv_solar_panel_top.png delete mode 100644 technic/textures/technic_mv_solarpanel_bottom.png delete mode 100644 technic/textures/technic_mv_solarpanel_side.png delete mode 100644 technic/textures/technic_mv_solarpanel_top.png delete mode 100644 technic/textures/technicx32/technic_mv_solar_panel_bottom.png delete mode 100644 technic/textures/technicx32/technic_mv_solar_panel_side.png delete mode 100644 technic/textures/technicx32/technic_mv_solar_panel_top.png diff --git a/item_drop/item_entity.lua b/item_drop/item_entity.lua index 3d1a83b..5da8285 100644 --- a/item_drop/item_entity.lua +++ b/item_drop/item_entity.lua @@ -109,7 +109,7 @@ minetest.register_entity(":__builtin:item", { return end - if minetest.registered_nodes[name].liquidtype == "flowing" then + if minetest.registered_nodes[name] and minetest.registered_nodes[name].liquidtype == "flowing" then get_flowing_dir = function(self) local pos = self.object:getpos() local param2 = minetest.env:get_node(pos).param2 diff --git a/technic/solar_panel_mv.lua b/technic/solar_panel_mv.lua deleted file mode 100644 index 4deb42e..0000000 --- a/technic/solar_panel_mv.lua +++ /dev/null @@ -1,78 +0,0 @@ -minetest.register_node("technic:solar_panel_mv", { - tiles = {"technic_mv_solar_panel_top.png", "technic_mv_solar_panel_bottom.png", "technic_mv_solar_panel_side.png", - "technic_mv_solar_panel_side.png", "technic_mv_solar_panel_side.png", "technic_mv_solar_panel_side.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - description="MV Solar Panel", - active = false, - technic_mv_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=10000; - 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", 10000) - - meta:set_string("infotext", "MV Solar Panel") - meta:set_float("active", false) - end, -}) - -minetest.register_craft({ - output = 'technic:solar_panel_mv 1', - recipe = { - {'technic:solar_panel', 'technic:solar_panel','technic:solar_panel'}, - {'technic:solar_panel', 'technic:mv_transformer','technic:solar_panel'}, - {'', 'technic:mv_cable',''}, - - } -}) - -minetest.register_abm( - {nodenames = {"technic:solar_panel_mv"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - - 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 meta = minetest.env:get_meta(pos) - if light == nil then light = 0 end - if light >= 14 then - meta:set_string("infotext", "Solar Panel is active ") - meta:set_float("active",1) - 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=300+(pos1.y/250*300) -- make solar energy depending on height - if charge_to_give<0 then charge_to_give=0 end - if charge_to_give>600 then charge_to_give=600 end - if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then - charge_to_give=internal_EU_buffer_size-internal_EU_buffer - end - internal_EU_buffer=internal_EU_buffer+charge_to_give - meta:set_float("internal_EU_buffer",internal_EU_buffer) - - else - meta:set_string("infotext", "Solar Panel is inactive"); - meta:set_float("active",0) - end - end, -}) - -register_MV_machine ("technic:solar_panel_mv","PR") diff --git a/technic/textures/technic_mv_solar_panel_bottom.png b/technic/textures/technic_mv_solar_panel_bottom.png deleted file mode 100644 index 596e79a..0000000 Binary files a/technic/textures/technic_mv_solar_panel_bottom.png and /dev/null differ diff --git a/technic/textures/technic_mv_solar_panel_side.png b/technic/textures/technic_mv_solar_panel_side.png deleted file mode 100644 index 917b9ed..0000000 Binary files a/technic/textures/technic_mv_solar_panel_side.png and /dev/null differ diff --git a/technic/textures/technic_mv_solar_panel_top.png b/technic/textures/technic_mv_solar_panel_top.png deleted file mode 100644 index cdb7cf7..0000000 Binary files a/technic/textures/technic_mv_solar_panel_top.png and /dev/null differ diff --git a/technic/textures/technic_mv_solarpanel_bottom.png b/technic/textures/technic_mv_solarpanel_bottom.png deleted file mode 100644 index 596e79a..0000000 Binary files a/technic/textures/technic_mv_solarpanel_bottom.png and /dev/null differ diff --git a/technic/textures/technic_mv_solarpanel_side.png b/technic/textures/technic_mv_solarpanel_side.png deleted file mode 100644 index 917b9ed..0000000 Binary files a/technic/textures/technic_mv_solarpanel_side.png and /dev/null differ diff --git a/technic/textures/technic_mv_solarpanel_top.png b/technic/textures/technic_mv_solarpanel_top.png deleted file mode 100644 index cdb7cf7..0000000 Binary files a/technic/textures/technic_mv_solarpanel_top.png and /dev/null differ diff --git a/technic/textures/technicx32/technic_mv_solar_panel_bottom.png b/technic/textures/technicx32/technic_mv_solar_panel_bottom.png deleted file mode 100644 index 94c8222..0000000 Binary files a/technic/textures/technicx32/technic_mv_solar_panel_bottom.png and /dev/null differ diff --git a/technic/textures/technicx32/technic_mv_solar_panel_side.png b/technic/textures/technicx32/technic_mv_solar_panel_side.png deleted file mode 100644 index d39d3d8..0000000 Binary files a/technic/textures/technicx32/technic_mv_solar_panel_side.png and /dev/null differ diff --git a/technic/textures/technicx32/technic_mv_solar_panel_top.png b/technic/textures/technicx32/technic_mv_solar_panel_top.png deleted file mode 100644 index 3d8c7ab..0000000 Binary files a/technic/textures/technicx32/technic_mv_solar_panel_top.png and /dev/null differ -- cgit v1.2.3