Fix solar panel

This commit is contained in:
ConfidentOwl 2023-05-07 17:19:34 +03:00
parent 914735253f
commit 72c533d46b
3 changed files with 10 additions and 11 deletions

View File

@ -948,7 +948,7 @@ for i = 1, #table_all_machines, 1 do
if meta:get_int("work_delay")>0 then
meta:set_int("work_delay",meta:get_int("work_delay")-1)
end
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"owl_tech_electro_wire")>01
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"owl_tech_electro_wire")>0
and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro
local meta_up = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z})
if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then

View File

@ -65,6 +65,15 @@ for i = 1, #small_turbins_conf, 1 do
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("battari_slot", 1)
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"owl_tech_electro_wire") then --send electro in wire
local meta_up = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z})
if owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) and
owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) and
owl_tech:get_charge_max(meta_up)-owl_tech:get_charge(meta_up)>=owl_tech:get_voltage(meta) then
owl_tech:set_charge(meta,owl_tech:get_charge(meta)-owl_tech:get_voltage(meta))
owl_tech:set_charge(meta_up,owl_tech:get_charge(meta_up)+owl_tech:get_voltage(meta_up))
end
end
if owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>owl_tech:get_voltage(meta)*small_turbins_conf[i][6] and owl_tech.get_pull_volume(meta,1)>=owl_tech:get_voltage(meta) then
owl_tech.set_pull_volume(meta,1, owl_tech.get_pull_volume(meta,1)-owl_tech:get_voltage(meta) )
owl_tech:set_charge(meta,owl_tech:get_charge(meta)+owl_tech:get_voltage(meta)*small_turbins_conf[i][6])
@ -77,16 +86,6 @@ for i = 1, #small_turbins_conf, 1 do
owl_tech:set_charge(meta ,owl_tech:get_charge(meta) + owl_tech:get_voltage(meta)*(power_light/power_factor))
end
end
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"owl_tech_electro_wire") then --send electro in wire
local meta_up = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z})
if owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) and
owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) and
owl_tech:get_charge_max(meta_up)-owl_tech:get_charge(meta_up)>=owl_tech:get_voltage(meta) then
owl_tech:set_charge(meta,owl_tech:get_charge(meta)-owl_tech:get_voltage(meta))
owl_tech:set_charge(meta_up,owl_tech:get_charge(meta_up)+owl_tech:get_voltage(meta_up))
end
end
set_formspect_base_steam_turbine(meta)
timer:start(0.2)
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB