diff --git a/lists_of_all.lua b/lists_of_all.lua index db8369d..aa699ee 100755 --- a/lists_of_all.lua +++ b/lists_of_all.lua @@ -1,14 +1,19 @@ --Global lists GLOBAL_FLUID_LIST ={ - "mcl_core:lava_source","mcl_core:water_source","mclx_core:river_water_source" + "mcl_core:lava_source","mcl_core:water_source","mclx_core:river_water_source","owl_tech:tar_source" } INPUT_SLOT_NAME= { - "fluid_in","fuel",'input_in',"sapling" + "fluid_in","fuel",'input_in',"sapling",'input_in' } OUTPUT_SLOT_NAME={ 'dst_add','dst',"wood","leaves" } - +FLUID_NAME_TO_SELL={ + lava_source="owl_tech:lava_sell", + water_source="owl_tech:water_sell", + river_water_source="owl_tech:water_sell", + tar_source="owl_tech:tar_sell", +} local ore_duration = 2 local ingot_duration = 4 diff --git a/multiblocks/help_node.lua b/multiblocks/help_node.lua index 8c20200..8d1006a 100644 --- a/multiblocks/help_node.lua +++ b/multiblocks/help_node.lua @@ -38,17 +38,7 @@ for i, value in ipairs(energy_hatch_table) do local timer = minetest.get_node_timer(pos) local meta = minetest.get_meta(pos) local rotation = minetest.get_node(pos).param2 % 32 - if owl_tech:get_active_hatch(meta)==1 then if rotation==0 then --z-1 - if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).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,z=pos.z-1}) - if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then - owl_tech.send_electro_from_wire_in_pos(meta_up,pos) - end - end - end - if rotation==2 then --z+1 if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})).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,z=pos.z+1}) @@ -57,16 +47,16 @@ for i, value in ipairs(energy_hatch_table) do end end end - if rotation==3 then --x-1 - if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"owl_tech_electro_wire")>0 + if rotation==2 then --z+1 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).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-1,y=pos.y,z=pos.z}) + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then owl_tech.send_electro_from_wire_in_pos(meta_up,pos) end end end - if rotation==1 then --x+1 + if rotation==3 then --x-1 if minetest.get_item_group((minetest.get_node({x=pos.x+1,y=pos.y,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+1,y=pos.y,z=pos.z}) @@ -75,7 +65,16 @@ for i, value in ipairs(energy_hatch_table) do end end end - end + if rotation==1 then --x+1 + if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,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-1,y=pos.y,z=pos.z}) + if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then + owl_tech.send_electro_from_wire_in_pos(meta_up,pos) + end + end + end + meta:set_string("infotext",owl_tech:get_charge(meta).."/"..owl_tech:get_charge_max(meta)) timer:start(0.2) end @@ -122,10 +121,9 @@ for i, value in ipairs(energy_hatch_table) do local timer = minetest.get_node_timer(pos) local meta = minetest.get_meta(pos) local rotation = minetest.get_node(pos).param2 % 32 - if owl_tech:get_active_hatch(meta)==1 then if rotation==0 then --z-1 - if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"owl_tech_electro_wire") then --send electro in wire - local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})).name,"owl_tech_electro_wire") then --send electro in wire + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) 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 @@ -135,8 +133,8 @@ for i, value in ipairs(energy_hatch_table) do end end if rotation==2 then --z+1 - if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})).name,"owl_tech_electro_wire") then --send electro in wire - local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"owl_tech_electro_wire") then --send electro in wire + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) 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 @@ -146,17 +144,6 @@ for i, value in ipairs(energy_hatch_table) do end end if rotation==3 then --x-1 - if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"owl_tech_electro_wire") then --send electro in wire - local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,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 - end - if rotation==1 then --x+1 if minetest.get_item_group((minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})).name,"owl_tech_electro_wire") then --send electro in wire local meta_up = minetest.get_meta({x=pos.x+1,y=pos.y,z=pos.z}) if owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) and @@ -167,7 +154,18 @@ for i, value in ipairs(energy_hatch_table) do end end end - end + if rotation==1 then --x+1 + if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"owl_tech_electro_wire") then --send electro in wire + local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,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 + end + meta:set_string("infotext",owl_tech:get_charge(meta).."/"..owl_tech:get_charge_max(meta)) timer:start(0.2) end @@ -331,20 +329,7 @@ for i, value in ipairs(energy_hatch_table) do local timer = minetest.get_node_timer(pos) local meta = minetest.get_meta(pos) local rotation = minetest.get_node(pos).param2 % 32 - if owl_tech:get_active_hatch(meta)==1 then if rotation==0 then --z-1 - if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"fluid_pipe") then --get from pipe - local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) - local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) - local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta)) - local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) - if can_do and can_do2 then - owl_tech.add_fluid_in_node_pull(meta,fluid_name_to_send,remove_amount,inde_pull) - owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) - end - end - end - if rotation==2 then --z+1 if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})).name,"fluid_pipe") then --get from pipe local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) @@ -356,9 +341,9 @@ for i, value in ipairs(energy_hatch_table) do end end end - if rotation==3 then --x-1 - if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --get from pipe - local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}) + if rotation==2 then --z+1 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"fluid_pipe") then --get from pipe + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta)) local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) @@ -368,7 +353,7 @@ for i, value in ipairs(energy_hatch_table) do end end end - if rotation==1 then --x+1 + if rotation==3 then --x-1 if minetest.get_item_group((minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --get from pipe local meta_up = minetest.get_meta({x=pos.x+1,y=pos.y,z=pos.z}) local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) @@ -380,7 +365,19 @@ for i, value in ipairs(energy_hatch_table) do end end end - end + if rotation==1 then --x+1 + if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --get from pipe + local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,fluid_name_to_send,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + end + owl_tech.delit_name_fluid_if_0(meta) meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) timer:start(0.2) @@ -430,22 +427,7 @@ for i, value in ipairs(energy_hatch_table) do local timer = minetest.get_node_timer(pos) local meta = minetest.get_meta(pos) local rotation = minetest.get_node(pos).param2 % 32 - if owl_tech:get_active_hatch(meta)==1 then if rotation==0 then --z-1 - if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"fluid_pipe") then --sand in pipe - local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) - local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) - local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) - local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) - if can_do and can_do2 then - owl_tech.add_fluid_in_node_pull(meta_up,fluid_name_to_send,remove_amount,inde_pull) - local pull_curent_volume = owl_tech.get_pull_volume(meta,1) - local difer = pull_curent_volume-remove_amount - owl_tech.set_pull_volume(meta,2,difer) - end - end - end - if rotation==2 then --z+1 if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})).name,"fluid_pipe") then --sand in pipe local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) @@ -459,9 +441,9 @@ for i, value in ipairs(energy_hatch_table) do end end end - if rotation==3 then --x-1 - if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --sand in pipe - local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}) + if rotation==2 then --z+1 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"fluid_pipe") then --sand in pipe + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) @@ -473,7 +455,7 @@ for i, value in ipairs(energy_hatch_table) do end end end - if rotation==1 then --x+1 + if rotation==3 then --x-1 if minetest.get_item_group((minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --sand in pipe local meta_up = minetest.get_meta({x=pos.x+1,y=pos.y,z=pos.z}) local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) @@ -487,7 +469,21 @@ for i, value in ipairs(energy_hatch_table) do end end end - end + if rotation==1 then --x+1 + if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --sand in pipe + local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,fluid_name_to_send,remove_amount,inde_pull) + local pull_curent_volume = owl_tech.get_pull_volume(meta,1) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + end + owl_tech.delit_name_fluid_if_0(meta) meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) timer:start(0.2) diff --git a/multiblocks/multiblock_api.lua b/multiblocks/multiblock_api.lua index 0b68218..eb1d12c 100644 --- a/multiblocks/multiblock_api.lua +++ b/multiblocks/multiblock_api.lua @@ -97,25 +97,25 @@ end ------------------------------------------------------ --get and set fluid amount in hatch function owl_tech:get_volume_amount_in_hatch_pos(x,y,z) - return owl_tech.get_pull_volume(minetest:get_meta({x=x,y=y,z=z}),1) + return owl_tech.get_pull_volume(minetest.get_meta({x=x,y=y,z=z}),1) end function owl_tech:set_volume_amount_in_hatch_pos(x,y,z,volume) - owl_tech.set_pull_volume(minetest:get_meta({x=x,y=y,z=z}),1,volume) + owl_tech.set_pull_volume(minetest.get_meta({x=x,y=y,z=z}),1,volume) end ------------------------------------------------------ --get and set max volume amount in hatch function owl_tech:get_max_volume_in_hatch_pos(x,y,z) - return owl_tech.get_pull_max_volume(minetest:get_meta({x=x,y=y,z=z}),1) + return owl_tech.get_pull_max_volume(minetest.get_meta({x=x,y=y,z=z}),1) end function owl_tech:set_max_volume_in_hatch_pos(x,y,z,volume) - owl_tech.set_pull_max_volume(minetest:get_meta({x=x,y=y,z=z}),1,volume) + owl_tech.set_pull_max_volume(minetest.get_meta({x=x,y=y,z=z}),1,volume) end ------------------------------------------------------ --get and set name fluid in hatch function owl_tech:get_name_fluid_in_hatch_pos(x,y,z) - return owl_tech.get_pull_fluid_name(minetest:get_meta({x=x,y=y,z=z}),1) + return owl_tech.get_pull_fluid_name(minetest.get_meta({x=x,y=y,z=z}),1) end function owl_tech:set_name_fluid_in_hatch_pos(x,y,z,name) - owl_tech.set_pull_fluid_name(minetest:get_meta({x=x,y=y,z=z}),1,name) + owl_tech.set_pull_fluid_name(minetest.get_meta({x=x,y=y,z=z}),1,name) end ------------------------------------------------------- diff --git a/multiblocks/wood_pyrolysis.lua b/multiblocks/wood_pyrolysis.lua index 2d006dd..8a9fa1a 100644 --- a/multiblocks/wood_pyrolysis.lua +++ b/multiblocks/wood_pyrolysis.lua @@ -669,21 +669,28 @@ minetest.register_node("owl_tech:wood_pyrolis", { owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output") ) if owl_tech.get_item_redines(meta)>0 and owl_tech.get_item_redines(meta)<100 then - if owl_tech.get_item_redines(meta)==0 and input_stack:get_count()>=4 and output_stack:get_free_space()>=6 - and minetest.get_item_group(input_stack:get_name(),"tree" and (output_stack:get_name()=="mcl_core:charcoal_lump" or output_stack:is_empty()) ) - and owl_tech:get_max_volume_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"))-fluid_output>=250 then --has bonus coal - owl_tech.add_item_redines(meta,10) + if input_stack:get_count()>=4 and (output_stack:get_free_space()>=6 or output_stack:is_empty()) + and minetest.get_item_group(input_stack:get_name(),"tree")>0 and (output_stack:get_name()=="mcl_core:charcoal_lump" or output_stack:is_empty()) + and input_energy>=100 + and owl_tech:get_max_volume_in_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"))-fluid_output>=250 then --has bonus coal + owl_tech.add_item_redines(meta,5) owl_tech:set_charge_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Y(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Z(meta,1,"energy_hatch_input") - ,input_energy-10) + ,input_energy-5) end end - if owl_tech.get_item_redines(meta)==0 and input_stack:get_count()>=4 and output_stack:get_free_space()>=6 - and minetest.get_item_group(input_stack:get_name(),"tree" and (output_stack:get_name()=="mcl_core:charcoal_lump" or output_stack:is_empty()) ) + if owl_tech.get_item_redines(meta)==0 and input_stack:get_count()>=4 and (output_stack:get_free_space()>=6 or output_stack:is_empty()) + and minetest.get_item_group(input_stack:get_name(),"tree")>0 and (output_stack:get_name()=="mcl_core:charcoal_lump" or output_stack:is_empty()) and input_energy>=100 - and owl_tech:get_max_volume_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"))-fluid_output>=250 then --has bonus coal - owl_tech.add_item_redines(meta,10) + and owl_tech:get_max_volume_in_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"))-fluid_output>=250 then --has bonus coal + owl_tech.add_item_redines(meta,5) owl_tech:set_charge_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Y(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Z(meta,1,"energy_hatch_input") - ,input_energy-10) + ,input_energy-5) end if owl_tech.get_item_redines(meta)>=100 then if not output_stack:is_empty() then-- Add main output @@ -709,10 +716,23 @@ minetest.register_node("owl_tech:wood_pyrolis", { owl_tech:get_hatch_ofset_Z(meta,1,"item_hatch_input"),input_stack ) if fluid_output==0 then ---Dont forget add fluid TODO - + owl_tech:set_volume_amount_in_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"),250) + owl_tech:set_name_fluid_in_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"),"owl_tech:tar_source") + else + owl_tech:set_volume_amount_in_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"),fluid_output+250) end owl_tech.reset_item_redines(meta) end + minetest.chat_send_all(owl_tech.get_item_redines(meta)) end set_formspect_wood_pyrolis(meta) timer:start(0.2) diff --git a/ore/node_register.lua b/ore/node_register.lua index 80c5116..3603345 100755 --- a/ore/node_register.lua +++ b/ore/node_register.lua @@ -946,10 +946,12 @@ for i, value in ipairs(gems_orew_array) do _mcl_hardness = 5, }) end +--1)name 2)Name 3)flowing animation 4)source animation 5)sell tezture 6)is gas? local fluid_array ={ - {"tar","Tar","owl_tech_tar_flowing_animated.png","owl_tech_tar_source_animated.png","owl_tech_tar_bucket.png","owl_tech_tar_for_sell.png"}--#8d4a00 + {"tar","Tar","owl_tech_tar_flowing_animated.png","owl_tech_tar_source_animated.png","owl_tech_tar_for_sell.png",false}--#8d4a00 } for i, value in ipairs(fluid_array) do + minetest.register_node("owl_tech:"..fluid_array[i][1].."_flowing", { description = S(fluid_array[i][2].." Water"), _doc_items_create_entry = false, @@ -1034,10 +1036,10 @@ for i, value in ipairs(fluid_array) do _mcl_hardness = -1, }) --capsuls - minetest.register_craftitem("owl_tech:"..fluid_array[i][1].."sell_tire_1", { + minetest.register_craftitem("owl_tech:"..fluid_array[i][1].."sell", { description = S("Get 1000 of "..fluid_array[i][1]), _doc_items_longdesc = S("Contein "..fluid_array[i][1]), - inventory_image = "owl_tech_empty_sell.png^"..fluid_array[i][6], + inventory_image = "owl_tech_empty_sell.png^"..fluid_array[i][5], stack_max = 64, groups = { craftitem=1 }, on_place = function(itemstack, placer, pointed_thing) @@ -1050,15 +1052,24 @@ for i, value in ipairs(fluid_array) do }) end --empty sell -minetest.register_craftitem("owl_tech:empty_sell_tire_1", { +minetest.register_craftitem("owl_tech:empty_sell", { description = S("Sell tire 1"), _doc_items_longdesc = S("Simple sell for fluids"), inventory_image = "owl_tech_empty_sell.png", stack_max = 64, groups = { craftitem=1 }, }) --- water and lava sell owl_tech_lava_for_sell.png -minetest.register_craftitem("owl_tech:water_sell_tire_1", { +minetest.register_craft({ + type = "shaped", + output = "owl_tech:empty_sell 4", + recipe = { + {"","owl_tech:iron_plate",""}, + {"owl_tech:tin_plate","","owl_tech:tin_plate"}, + {"","owl_tech:iron_plate",""}, + }, +}) +-- water and lava sell +minetest.register_craftitem("owl_tech:water_sell", { description = S("Get 1000 of water"), _doc_items_longdesc = S("Contein water"), inventory_image = "owl_tech_empty_sell.png^owl_tech_water_for_sell.png", @@ -1072,7 +1083,7 @@ minetest.register_craftitem("owl_tech:water_sell_tire_1", { end end }) -minetest.register_craftitem("owl_tech:lava_sell_tire_1", { +minetest.register_craftitem("owl_tech:lava_sell", { description = S("Get 1000 of lava"), _doc_items_longdesc = S("Contein lava"), inventory_image = "owl_tech_empty_sell.png^owl_tech_lava_for_sell.png", diff --git a/pipe/fluid_tank.lua b/pipe/fluid_tank.lua index 407fa63..724fa09 100755 --- a/pipe/fluid_tank.lua +++ b/pipe/fluid_tank.lua @@ -2,6 +2,34 @@ local S = minetest.get_translator(minetest.get_current_modname()) local name = minetest.get_current_modname() local path = minetest.get_modpath(name) +local function set_formspect_tank(meta) + local fluid_1_name = owl_tech.get_pull_fluid_name(meta,1) + local fluid_1_volume = owl_tech.get_pull_volume(meta,1) + local formspec = "size[9,8.75]".. + "label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1).. + "label[2.75,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Tank"))).."]".. + "list[context;input_in;2.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,1.5,1,1).. + "list[context;dst;3.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(3.5,1.5,1,1).. + "list[context;input_in_add;2.5,3.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,3.5,1,1).. + "list[context;dst_add;2.5,3.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,3.5,1,1).. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[current_player;main]".. + "listring[context;input_in]".. + "listring[context;input_in_add]".. + "listring[context;dst_add]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end + minetest.register_node("owl_tech:bronze_tank", { description = S("Bronze tank"), _doc_items_longdesc = S("Tank fluid"), @@ -26,13 +54,24 @@ minetest.register_node("owl_tech:bronze_tank", { owl_tech.set_mashine_tire(meta,1) owl_tech.update_fluid_pipe_around(pos) owl_tech.set_fluid_sand_in_tick(meta,60) + local inv = meta:get_inventory() + inv:set_size("input_in", 1) --for input + inv:set_size("dst", 1) --for input + inv:set_size("input_in_add", 1) --for output + inv:set_size("dst_add", 1) --for output local timer =minetest.get_node_timer(pos) meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) + set_formspect_tank(meta) timer:start(0.2) end, on_timer = function(pos, elapsed) local timer = minetest.get_node_timer(pos) local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local sell_input_1 = inv:get_stack("input_in", 1) + local sell_output_1 = inv:get_stack("dst", 1) + local sell_input_2 = inv:get_stack("input_in_add", 1) + local sell_output_2 = inv:get_stack("dst_add", 1) if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})).name,"fluid_pipe") then --get from pipe steam local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z}) local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) @@ -55,7 +94,22 @@ minetest.register_node("owl_tech:bronze_tank", { owl_tech.set_pull_volume(meta,2,difer) end end + if not sell_input_1:is_empty() and sell_input_1:get_name() =="owl_tech:empty_sell" and owl_tech.get_pull_volume(meta,1)>=1000 then + local fluid_name = string.sub(owl_tech.get_pull_fluid_name(meta,1) , 10) + if FLUID_NAME_TO_SELL[fluid_name]~=nil and FLUID_NAME_TO_SELL[fluid_name]~="" and + (sell_output_1:is_empty() or (sell_output_1:get_name()==FLUID_NAME_TO_SELL[fluid_name] and sell_output_1:get_free_space()>0 )) then + if not sell_output_1:is_empty() then-- Add main output + sell_output_1:set_count(sell_output_1:get_count()+FLUID_NAME_TO_SELL[fluid_name] ) + inv:set_stack('dst', 1, sell_output_1) + else + local item ={name=FLUID_NAME_TO_SELL[fluid_name], count=1, wear=0, metadata=""} + sell_output_1:add_item(item) + inv:set_stack('dst', 1, sell_output_1) + end + end + end owl_tech.delit_name_fluid_if_0(meta) + set_formspect_tank(meta) meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) timer:start(0.2) end