commit 56b9442e4b4ac02a6d6beee20cf58762a7759906 Author: ConfidentOwl Date: Wed Dec 21 08:57:54 2022 +0300 Initial Commit diff --git a/api/fluid_llogik.lua b/api/fluid_llogik.lua new file mode 100755 index 0000000..8eea95d --- /dev/null +++ b/api/fluid_llogik.lua @@ -0,0 +1,240 @@ +--Setter and getter pull_amount +function owl_tech.get_pull_amount(meta) + return meta:get_int("pull_amount") +end + +function owl_tech.set_pull_amount(meta,new_amount) + meta:set_int("pull_amount",new_amount) + return owl_tech.get_pull_amount(meta) +end +------------------------------ +--Setter and getter pull_volume +function owl_tech.get_pull_volume(meta,namber) + return meta:get_float(namber.."_current_volume") +end + +function owl_tech.set_pull_volume(meta,namber,volume) + meta:set_float(namber.."_current_volume",volume) + return owl_tech.get_pull_volume(meta,namber) +end +------------------------------ +--Setter and getter pull_max_volume +function owl_tech.get_pull_max_volume(meta,namber) + return meta:get_float(namber.."_max_volume") +end + +function owl_tech.set_pull_max_volume(meta,namber,volume) + meta:set_float(namber.."_max_volume",volume) + return owl_tech.get_pull_max_volume(meta,namber) +end +------------------------------ +--Setter and getter fluid name +function owl_tech.get_pull_fluid_name(meta,namber) + return meta:get_string(namber.."_fluid_name") +end + +function owl_tech.set_pull_fluid_name(meta,namber,volume) + meta:set_string(namber.."_fluid_name",volume) + return owl_tech.get_pull_fluid_name(meta,namber) +end +------------------------------ +--Setter and getter can fluid input use 0 and 1!!! +function owl_tech.get_pull_fluid_input(meta,namber) + return meta:get_int(namber.."_input") +end + +function owl_tech.set_pull_fluid_input(meta,namber,input) + meta:set_int(namber.."_input",input) + return owl_tech.get_pull_fluid_input(meta,namber) +end +------------------------------ +--Setter and getter can fluid output 0 and 1!!! +function owl_tech.get_pull_fluid_output(meta,namber) + return meta:get_int(namber.."_output") +end + +function owl_tech.set_pull_fluid_output(meta,namber,input) + meta:set_int(namber.."_output",input) + return owl_tech.get_pull_fluid_output(meta,namber) +end +------------------------------ +--whitlist for fluid tanks (Only 1 fluid can put in whitelist) +function owl_tech.get_pull_fluid_whitlist(meta,namber) + return meta:get_string(namber.."_whitlist") +end + +function owl_tech.set_pull_fluid_whitlist(meta,namber,name) + meta:set_string(namber.."_whitlist",name) + return owl_tech.get_pull_fluid_whitlist(meta,namber) +end + +function owl_tech.remove_pull_fluid_whitlist(meta,namber) + meta:set_string(namber.."_whitlist","none") + return owl_tech.get_pull_fluid_whitlist(meta,namber) +end +------------------------------ +--Add new pull +function owl_tech.add_new_pull(meta,max_volume,input,output) + owl_tech.set_pull_amount(meta,owl_tech.get_pull_amount(meta)+1) + local pull_amount = owl_tech.get_pull_amount(meta) + owl_tech.set_pull_max_volume(meta,pull_amount,max_volume) + owl_tech.set_pull_volume(meta,pull_amount,0) + owl_tech.set_pull_fluid_name(meta,pull_amount,"none") + owl_tech.set_pull_fluid_input(meta,pull_amount,input)--use int not bool(( + owl_tech.set_pull_fluid_output(meta,pull_amount,output) + owl_tech.remove_pull_fluid_whitlist(meta,pull_amount) +end +------------------------------ +--finde tank in node for add some fluid(local func ) +function owl_tech.finde_tank_in_node_for_add_fluid_amount(meta,pulls,fluid_indef,fluid_amount) + local ret =0 + for i = 0, pulls, 1 do + local pull_max_volume = owl_tech.get_pull_max_volume(meta,i) + local pull_curent_volume = owl_tech.get_pull_volume(meta,i) + local difer = pull_curent_volume+fluid_amount + if owl_tech.get_pull_fluid_name(meta,i)=="none" or (owl_tech.get_pull_fluid_name(meta,i)==fluid_indef and difer<=pull_max_volume )then + ret =i + break + end + end + return ret + +end +------------------------------ +--finde tank in side node for remove some fluid(local func ) +function owl_tech.finde_tank_in_node_for_remove_fluid_amount(meta,pulls,fluid_indef,fluid_amount) + for i = 0, pulls, 1 do + local pull_curent_volume = owl_tech.get_pull_volume(meta,i) + local difer = pull_curent_volume-fluid_amount + if (owl_tech.get_pull_fluid_name(meta,i)==fluid_indef and difer>=0 )then + return i + end + end +end +------------------------------ +--Fluid from itemslot +function owl_tech.add_fluid_in_pull_from_itemslot(meta,itemstak_buck,inv,itemstak_dst,slot_name_fuel,slot_name_dst) + local pulls=owl_tech.get_pull_amount(meta) + local name_item_fluid= itemstak_buck:get_name() + local fluid_indef="" + local epmty_sel_name ="" + if name_item_fluid=="mcl_buckets:bucket_water" or name_item_fluid=="mcl_buckets:bucket_river_water" then + fluid_indef="mcl_water" + epmty_sel_name= "mcl_buckets:bucket_empty" + elseif name_item_fluid=="mcl_buckets:bucket_lava" then + fluid_indef="mcl_lava" + epmty_sel_name= "mcl_buckets:bucket_empty" + end + local can_return_buck= false + if itemstak_dst:is_empty() then + can_return_buck =true + elseif itemstak_dst:get_free_space()>0 and itemstak_dst:get_name()==epmty_sel_name then + can_return_buck =true + end + if pulls>0 and fluid_indef~="" and can_return_buck then + local inde_pull =owl_tech.finde_tank_in_node_for_add_fluid_amount(meta,pulls,fluid_indef,1000)--1000 is 1 bucket\cell + if inde_pull~=0 and (owl_tech.get_pull_fluid_whitlist(meta,inde_pull)==fluid_indef or owl_tech.get_pull_fluid_whitlist(meta,inde_pull)=="none" )then + local volume = owl_tech.get_pull_volume(meta,inde_pull)+1000 + owl_tech.set_pull_volume(meta,inde_pull,volume) + local amount_buck = itemstak_buck:get_count() + owl_tech.set_pull_fluid_name(meta,inde_pull,fluid_indef) + if amount_buck>1 then + itemstak_buck:set_count(amount_buck-1) + inv:set_stack(slot_name_fuel, 1, itemstak_buck) + if itemstak_dst:is_empty() then --retrun emty sell + local item ={name=epmty_sel_name, count=1, wear=0, metadata=""} + itemstak_dst:add_item(item) + inv:set_stack(slot_name_dst, 1, itemstak_dst) + elseif not itemstak_dst:is_empty() then + local item ={name=epmty_sel_name, count=itemstak_dst:get_count()+1, wear=0, metadata=""} + itemstak_dst:add_item(item) + inv:set_stack(slot_name_dst, 1, itemstak_dst) + end + else + itemstak_buck:clear() + inv:set_stack(slot_name_fuel, 1, itemstak_buck) + if itemstak_dst:is_empty() then --retrun emty sell + local item ={name=epmty_sel_name, count=itemstak_dst:get_count()+1, wear=0, metadata=""} + itemstak_dst:add_item(item) + inv:set_stack(slot_name_dst, 1, itemstak_dst) + elseif not itemstak_dst:is_empty() then + itemstak_dst:set_count(itemstak_dst:get_count()+1) + inv:set_stack(slot_name_dst, 1, itemstak_dst) + end + end + else + return false + end + end +end +------------------------------ +--can add fluid in node pulls +function owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name,fluid_amount) + local pulls=owl_tech.get_pull_amount(meta) + if pulls>0 then + local inde_pull =owl_tech.finde_tank_in_node_for_add_fluid_amount(meta,pulls,fluid_name,fluid_amount) + if inde_pull~=0 and (owl_tech.get_pull_fluid_whitlist(meta,inde_pull)==fluid_name or owl_tech.get_pull_fluid_whitlist(meta,inde_pull)=="none" )then + return true ,inde_pull + else + return false ,inde_pull + end + end +end +------------------------------ +--add fluid in node +function owl_tech.add_fluid_in_node_pull(meta,fluid_name,fluid_amount,pull_number) + local volume = owl_tech.get_pull_volume(meta,pull_number)+fluid_amount + owl_tech.set_pull_volume(meta,pull_number,volume) + owl_tech.set_pull_fluid_name(meta,pull_number,fluid_name) +end +------------------------------ +--can remove fluid in node pulls +function owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name,fluid_amount) + local pulls=owl_tech.get_pull_amount(meta) + local remove_amount=0 + if pulls>0 then + local inde_pull=owl_tech.finde_tank_in_node_for_remove_fluid_amount(meta,pulls,fluid_name,fluid_amount) + if inde_pull~=nil and inde_pull~=0 and (owl_tech.get_pull_fluid_whitlist(meta,inde_pull)==fluid_name or owl_tech.get_pull_fluid_whitlist(meta,inde_pull)=="none" )then + if owl_tech.get_pull_volume(meta,inde_pull)>=fluid_amount then + remove_amount=fluid_amount + else + remove_amount=owl_tech.get_pull_volume(meta,inde_pull) + end + return true ,inde_pull ,remove_amount + else + return false ,inde_pull ,remove_amount + end + end +end +------------------------------ +--remove fluid in node +function owl_tech.remove_fluid_in_node_pull(meta,fluid_amount,pull_number) + local pull_curent_volume = owl_tech.get_pull_volume(meta,pull_number) + local difer = pull_curent_volume-fluid_amount + owl_tech.set_pull_volume(meta,pull_number,difer) + if difer ==0 then + owl_tech.set_pull_fluid_name(meta,pull_number,"none") + end +end +------------------------------ +--Chek for name thit 0 amount fluid and has name +function owl_tech.delit_name_fluid_if_0(meta) + local pulls_amount = owl_tech.get_pull_amount(meta) + for i = 1,pulls_amount, 1 do + if owl_tech.get_pull_volume(meta,i)==0 then + owl_tech.set_pull_fluid_name(meta,i,"none") + end + end +end +--------------------------------- +--Getter and setter conection amount +function owl_tech.get_conection_amount_item(meta) + return meta:get_int("conection_amount") +end +function owl_tech.set_conection_amount_item(meta,number) + meta:set_int("conection_amount",number) +end +function owl_tech.add_1_conection_amount_itemd(meta) + meta:set_int("conection_amount",meta:get_int("conection_amount")+1) +end +------------------------------------------- \ No newline at end of file diff --git a/api/init.lua b/api/init.lua new file mode 100755 index 0000000..2727d26 --- /dev/null +++ b/api/init.lua @@ -0,0 +1,39 @@ +owl_tech={} + +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +-- META Key info +--[[ + 1 buket is 1000 mlbickets(Use mlbucks for work) + Begin from 1 pull 0 is not walid!!0-is NOT pull in shis node! + pull_amount--amount fo pulls in this meta + + + non in mechanims - none + water in mechanism - mcl_water + lava in mechanism - mcl_lava + steam in mechanism - owl_tech_steam + + + Pipse!!! + + White-fluids + Green-items + Yelou-energy + + Red-Input + Blue-Output +]] + +--[[main names for items slots + dst-main_output + fuel --use only for nodes for that can burn like fuel + fluid_in- use for buckets miners.lua +]] + +dofile(minetest.get_modpath("owl_tech") .. "/api/fluid_llogik.lua") --main fail about all fluid work +dofile(minetest.get_modpath("owl_tech") .. "/api/item_logick.lua") --main fail about all item work +dofile(minetest.get_modpath("owl_tech") .. "/api/pipe_logick.lua") --main fail about all pipe work +dofile(minetest.get_modpath("owl_tech") .. "/api/miners.lua") --main fail about all miners work diff --git a/api/item_logick.lua b/api/item_logick.lua new file mode 100755 index 0000000..7d24f53 --- /dev/null +++ b/api/item_logick.lua @@ -0,0 +1,156 @@ +--all logick of item (pipe for item dont puy hear) +--list for input itemslot +--settera and geters for calculate item_redines (always max -100) +function owl_tech.get_item_redines(meta) + return meta:get_int("_redines") +end +function owl_tech.set_item_redines(meta,amount) + meta:set_int("_redines", amount) +end +function owl_tech.reset_item_redines(meta) + meta:set_int("_redines", 0) +end +function owl_tech.add_item_redines(meta,amount) + meta:set_int("_redines",owl_tech.get_item_redines(meta)+amount) +end +---------------------------------------------- +-- calculate add bnus for speed work if recipt tire is low that tire mashine ( 1 lv give 20%) +function owl_tech.calculate_recipe_tire_bonus(meta,recip_tire,recip_dens) + return recip_dens+(recip_dens*(owl_tech.get_mashine_tire(meta)-recip_tire)*0.2) +end +---------------------------------------------- +----Logick for item pipe +function owl_tech.set_item_pipe_logick(meta) + local inv = meta:get_inventory() + inv:set_size("pipe_inv", 1) +end +---------------------------------------------- + +--get item from inventory to pipe +function owl_tech.finde_inventory_slot_for_removing_item_around(pos) + local mass_pos ={ + {x=pos.x,y=pos.y+1,z=pos.z}, + {x=pos.x,y=pos.y-1,z=pos.z}, + {x=pos.x+1,y=pos.y,z=pos.z}, + {x=pos.x-1,y=pos.y,z=pos.z}, + {x=pos.x,y=pos.y,z=pos.z+1}, + {x=pos.x,y=pos.y,z=pos.z-1} + } + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() -- pipe + for i, value in ipairs(mass_pos) do + for j, value1 in pairs(OUTPUT_SLOT_NAME) do + if minetest.get_item_group((minetest.get_node(mass_pos[i])).name,OUTPUT_SLOT_NAME[j])>0 then-- for special item slots + local meta_source = minetest.get_meta(mass_pos[i]) + local inv_sourc = meta_source:get_inventory() + if inv:is_empty("pipe_inv") and not inv_sourc:is_empty(OUTPUT_SLOT_NAME[j]) then + if inv:room_for_item("pipe_inv", inv_sourc:get_stack(OUTPUT_SLOT_NAME[j], 1)) then + inv:add_item("pipe_inv", inv_sourc:get_stack(OUTPUT_SLOT_NAME[j], 1)) + inv_sourc:set_stack(OUTPUT_SLOT_NAME[j],1,'') + do return end + end + end + end + end + if minetest.get_node(mass_pos[i]).name=='mcl_chests:chest_small' + or minetest.get_node(mass_pos[i]).name=="mcl_chests:ender_chest" + or minetest.get_node(mass_pos[i]).name=="mcl_chests:ender_chest_small" then -- for chest type + local meta_source = minetest.get_meta(mass_pos[i]) + local inv_sourc = meta_source:get_inventory() + if inv:is_empty("pipe_inv") and not inv_sourc:is_empty("main")then + for k = 1, #(inv_sourc:get_list("main")),1 do + if inv:room_for_item("pipe_inv", inv_sourc:get_stack("main", k)) and not (inv_sourc:get_stack("main", k)):is_empty() then + inv:add_item("pipe_inv", inv_sourc:get_stack("main", k)) + inv_sourc:set_stack("main", k,'') + do return end + end + end + end + end + if minetest.get_item_group((minetest.get_node(mass_pos[i])).name,"owl_tech_can_pipe_output")>0 then + local meta_source = minetest.get_meta(mass_pos[i]) + local inv_sourc = meta_source:get_inventory() + if (not inv:is_empty("pipe_inv")) and inv_sourc:is_empty("pipe_inv") then + if inv_sourc:room_for_item("pipe_inv", inv:get_stack("pipe_inv", 1)) then + local itemstack= inv:get_stack("pipe_inv", 1) + inv_sourc:add_item("pipe_inv",itemstack) + inv:set_stack("pipe_inv", 1, '') + do return end + end + end + end + end +end +------------------------------------------- +--get item pipe to pipe +function owl_tech.finde_pipe_and_send_item(pos) + local mass_pos ={ + {x=pos.x,y=pos.y+1,z=pos.z}, + {x=pos.x,y=pos.y-1,z=pos.z}, + {x=pos.x+1,y=pos.y,z=pos.z}, + {x=pos.x-1,y=pos.y,z=pos.z}, + {x=pos.x,y=pos.y,z=pos.z+1}, + {x=pos.x,y=pos.y,z=pos.z-1} + } + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + --for i, value in ipairs(mass_pos) do + local rand = math.random(1,6) + if minetest.get_item_group((minetest.get_node(mass_pos[rand])).name,"owl_tech_can_pipe_output")>0 then + local meta_source = minetest.get_meta(mass_pos[rand]) + local inv_sourc = meta_source:get_inventory() + if (not inv:is_empty("pipe_inv")) and inv_sourc:is_empty("pipe_inv") then + if inv_sourc:room_for_item("pipe_inv", inv:get_stack("pipe_inv", 1)) then + local itemstack= inv:get_stack("pipe_inv", 1) + inv_sourc:add_item("pipe_inv",itemstack) + inv:set_stack("pipe_inv", 1, '') + do return end + end + end + end +end +----------------------------------------------------- +--Send item in pipe +function owl_tech.send_item_in_inventory(pos) + local meta = minetest.get_meta(pos) + local mass_pos ={ + {x=pos.x,y=pos.y+1,z=pos.z}, + {x=pos.x,y=pos.y-1,z=pos.z}, + {x=pos.x+1,y=pos.y,z=pos.z}, + {x=pos.x-1,y=pos.y,z=pos.z}, + {x=pos.x,y=pos.y,z=pos.z+1}, + {x=pos.x,y=pos.y,z=pos.z-1} + } + for i, value in ipairs(mass_pos) do + local name= minetest.get_node(mass_pos[i]).name + for j, value in pairs(INPUT_SLOT_NAME) do + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() -- pipe + if minetest.get_item_group((minetest.get_node(mass_pos[i])).name,"owl_tech_can_pipe_output")>0 then --get item from enather pipe + local meta_source = minetest.get_meta(mass_pos[i]) + local inv_sourc = meta_source:get_inventory() + if inv:is_empty("pipe_inv") and not inv_sourc:is_empty("pipe_inv") then + if inv:room_for_item("pipe_inv", inv_sourc:get_stack("pipe_inv", 1)) and not (inv_sourc:get_stack("pipe_inv", 1)):is_empty() then + inv:set_stack("pipe_inv", 1, inv_sourc:get_stack("pipe_inv", 1)) + inv_sourc:set_stack("pipe_inv", 1,'' ) + end + end + end + if minetest.get_node(mass_pos[i]).name=='mcl_chests:chest_small' + or minetest.get_node(mass_pos[i]).name=="mcl_chests:ender_chest" + or minetest.get_node(mass_pos[i]).name=="mcl_chests:ender_chest_small" then -- for chest + local meta_source = minetest.get_meta(mass_pos[i]) + local inv_sourc = meta_source:get_inventory() + if not inv:is_empty("pipe_inv") then + for k = 1, #(inv_sourc:get_list("main")),1 do + if (inv_sourc:room_for_item("main", inv:get_stack("pipe_inv", 1)) and not ((inv:get_stack("pipe_inv", 1)):is_empty() ))then + inv_sourc:add_item("main", inv:get_stack("pipe_inv", 1)) + inv:set_stack("pipe_inv", 1,'' ) + do return end + end + end + end + end + end + end +end diff --git a/api/miners.lua b/api/miners.lua new file mode 100644 index 0000000..8bbc8a7 --- /dev/null +++ b/api/miners.lua @@ -0,0 +1,203 @@ +-- prepear for vertical steam miner +function owl_tech.prepear_for_verticak_steam_miner(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,16000,1,0) --steam eat 25 steam in 1 tick + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + meta:set_int("curent-y",1) -- use pos - curent-y for get diginbg pos + meta:set_int("get_bedrock",0) +end +---------------------------------- +-- can steam miner mine this node +function owl_tech.can_vertical_steam_miner_mine_this(pos,meta) + local node_mine = minetest.get_node_or_nil({x=pos.x,y=(pos.y-meta:get_int("curent-y")),z=pos.z}) + local can_do = true + if node_mine~=nil then + if node_mine.name =='mcl_core:bedrock' then --bedrock mcl_core:bedrock + can_do =false + meta:set_int("get_bedrock",1) + return can_do + end + for i, value in ipairs(GLOBAL_FLUID_LIST) do + if node_mine.name ==GLOBAL_FLUID_LIST[i] and not can_do then --finde fluid + can_do =false + return can_do + end + end + return can_do + end +end +----------------------------------- +--mine verical steam +function owl_tech.vertical_steam_mine(pos,meta,can_mine) + if can_mine then + local inv = meta:get_inventory() + local dst_its = inv:get_stack('dst', 1) + local node_mine = minetest.get_node_or_nil({x=pos.x,y=(pos.y-meta:get_int("curent-y")),z=pos.z}) + if dst_its:is_empty() or ( + dst_its:get_stack_max()-dst_its:get_count()>0 and + node_mine.name == dst_its:get_name() + ) then + if dst_its:is_empty() and node_mine.name~='air' then + local new_stack = {name=node_mine.name, count=1, wear=0, metadata=""} + inv:set_stack('dst', 1,new_stack) + minetest.set_node({x=pos.x,y=(pos.y-meta:get_int("curent-y")),z=pos.z}, {name="owl_tech:decor_bronze_pipe"}) + meta:set_int("curent-y",meta:get_int("curent-y")+1) + elseif node_mine.name~='air' then + dst_its:set_count(dst_its:get_count()+1) + inv:set_stack('dst', 1,dst_its) + minetest.set_node({x=pos.x,y=(pos.y-meta:get_int("curent-y")),z=pos.z}, {name="owl_tech:decor_bronze_pipe"}) + meta:set_int("curent-y",meta:get_int("curent-y")+1) + elseif node_mine.name=='air' then + minetest.set_node({x=pos.x,y=(pos.y-meta:get_int("curent-y")),z=pos.z}, {name="owl_tech:decor_bronze_pipe"}) + meta:set_int("curent-y",meta:get_int("curent-y")+1) + end + end + end +end +-------------------------------- +--remove all vertical pipe +function owl_tech.remove_all_pipe_vertical(pos) + pos.y=pos.y-1 + while minetest.get_node_or_nil(pos).name =="owl_tech:decor_bronze_pipe" do + minetest.set_node(pos, {name="air"}) + pos.y=pos.y-1 + end + do return end +end +----------------------------------- +-- Prerpear for quarry +function owl_tech.prepera_quarry(pos,max_distance) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,32000,1,0) --steam + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + meta:set_int('horiz_max_distance',max_distance) + meta:set_int("curent-y",1) -- use pos - curent-y for get diginbg pos + meta:set_int("curent-x",0) + meta:set_int("max_x",0) + meta:set_int('min_x',0) + meta:set_int("curent-z",0) + meta:set_int("max_z",0) + meta:set_int('min_z',0) + meta:set_int("get_bedrock",0) +end +------------------------------------ +--scan for point +function owl_tech.scan_for_point(pos,meta,scan_disctance) + local x_pos = 0 + for i = (-1*scan_disctance), scan_disctance, 1 do + local node = minetest.get_node_or_nil({x=pos.x+i,y=pos.y,z=pos.z}) + if node~=nil and node.name =="owl_tech:quary_point" then + x_pos=i + end + end + local z_pos = 0 + for i = (-1*scan_disctance), scan_disctance, 1 do + local node = minetest.get_node_or_nil({x=pos.x,y=pos.y,z=pos.z+i}) + if node~=nil and node.name =="owl_tech:quary_point" then + z_pos=i + end + end + if x_pos~=0 and z_pos~=0 then + if pos.x+x_pos>pos.x and pos.z+z_pos>pos.z then -- ++ + meta:set_int("max_x",pos.x+x_pos) + meta:set_int("min_x",pos.x ) + meta:set_int("max_z",pos.z+z_pos) + meta:set_int("min_z",pos.z ) + elseif pos.x+x_pos>pos.x and pos.z+z_pospos.z then -- -+ + meta:set_int("max_x",pos.x) + meta:set_int("min_x",pos.x+x_pos) + meta:set_int("max_z",pos.z+z_pos) + meta:set_int("min_z",pos.z ) + elseif pos.x+x_pos0 and + node_mine.name == dst_its:get_name() + ) then + if dst_its:is_empty() and node_mine.name~='air' then + local new_stack = {name=node_mine.name, count=1, wear=0, metadata=""} + inv:set_stack('dst', 1,new_stack) + minetest.remove_node(pos_dig) + owl_tech.calculate_new_pos_for_quarry(meta) + elseif node_mine.name~='air' then + dst_its:set_count(dst_its:get_count()+1) + inv:set_stack('dst', 1,dst_its) + minetest.remove_node(pos_dig) + owl_tech.calculate_new_pos_for_quarry(meta) + elseif node_mine.name=='air' then + minetest.remove_node(pos_dig) + owl_tech.calculate_new_pos_for_quarry(meta) + end + end + end +end +------------------------------------ +--calculate new pos for qurey +function owl_tech.calculate_new_pos_for_quarry(meta) + if meta:get_int("curent-x")< meta:get_int("max_x") then --x + meta:set_int("curent-x",meta:get_int("curent-x")+1) + do return end + end + if meta:get_int("curent-x")==meta:get_int("max_x") then + if meta:get_int("curent-z")==meta:get_int("max_z") then + meta:set_int("curent-x",meta:get_int("min_x")) + meta:set_int("curent-z",meta:get_int("min_z")) + meta:set_int("curent-y",meta:get_int("curent-y")+1) + do return end + end + meta:set_int("curent-x",meta:get_int("min_x")) + meta:set_int("curent-z",meta:get_int("curent-z")+1) + end +end +---------------------------------- +-- can quary mine this node +function owl_tech.can_quary_mine_this(pos,meta) + local pos_dig={ + x=meta:get_int("curent-x"), + y=pos.y-meta:get_int("curent-y"), + z=meta:get_int("curent-z") + } + local node_mine = minetest.get_node_or_nil(pos_dig) + local can_do = true + if node_mine~=nil then + if node_mine.name =='mcl_core:bedrock' then --bedrock mcl_core:bedrock + can_do =false + meta:set_int("get_bedrock",1) + return can_do + end + for i, value in ipairs(GLOBAL_FLUID_LIST) do + if node_mine.name ==GLOBAL_FLUID_LIST[i] and not can_do then --finde fluid + minetest.remove_node(pos_dig) + return can_do + end + end + return can_do + end +end \ No newline at end of file diff --git a/api/pipe_logick.lua b/api/pipe_logick.lua new file mode 100755 index 0000000..322e70c --- /dev/null +++ b/api/pipe_logick.lua @@ -0,0 +1,282 @@ +--[[ + 0-nothing + 1-get\set_somthing +]] +local conetc_to={ + "owl_tech_generator","owl_tech_fluid_pipe","owl_tech_machine" +} +--node in pos ?in list +function owl_tech.node_in_pos_connect_to_fluid_pipe(pos) + local ret=0 + for index, value in ipairs(conetc_to) do + if minetest.get_item_group((minetest.get_node(pos)).name,"owl_tech_fluid_pipe")>0 then + ret=1 + end + end + return ret +end +------------------------------------------- +--Getter and setter conection amount +function owl_tech.get_conection_amount_fluid(meta) + return meta:get_int("conection_amount") +end +function owl_tech.set_conection_amount_fluid(meta,number) + meta:set_int("conection_amount",number) +end +function owl_tech.add_1_conection_amount_fluid(meta) + meta:set_int("conection_amount",meta:get_int("conection_amount")+1) +end +------------------------------------------- +--setter and getter fluid sander in 1 tick +function owl_tech.get_fluid_sand_in_tick(meta) + return meta:get_int("fluid_sand_in_tick") +end +function owl_tech.set_fluid_sand_in_tick(meta,number) + meta:set_int("fluid_sand_in_tick",number) +end +------------------------------------------- +--setter and geters for all 6 sides info +function owl_tech.set_side_info_y_p(meta,number)--y+ + meta:set_int("+y",number) +end +function owl_tech.set_side_info_y_m(meta,number)--y- + meta:set_int("-y",number) +end +function owl_tech.set_side_info_x_p(meta,number)--x+ + meta:set_int("+x",number) +end +function owl_tech.set_side_info_x_m(meta,number)--x- + meta:set_int("-x",number) +end +function owl_tech.set_side_info_z_p(meta,number)--z+ + meta:set_int("+z",number) +end +function owl_tech.set_side_info_z_m(meta,number)--z- + meta:set_int("-z",number) +end +function owl_tech.get_side_info_y_p(meta)--y+ + return meta:get_int("+y") +end +function owl_tech.get_side_info_y_m(meta)--y- + return meta:get_int("-y") +end +function owl_tech.get_side_info_x_p(meta)--x+ + return meta:get_int("+x") +end +function owl_tech.get_side_info_x_m(meta)--x- + return meta:get_int("-x") +end +function owl_tech.get_side_info_z_p(meta)--z+ + return meta:get_int("+z") +end +function owl_tech.get_side_info_z_m(meta)--z- + return meta:get_int("-z") +end +------------------------------------------- +--update pipe around +function owl_tech.update_fluid_pipe_around(pos) + local mass_pos ={ + {x=pos.x,y=pos.y+1,z=pos.z}, + {x=pos.x,y=pos.y-1,z=pos.z}, + {x=pos.x+1,y=pos.y,z=pos.z}, + {x=pos.x-1,y=pos.y,z=pos.z}, + {x=pos.x,y=pos.y,z=pos.z+1}, + {x=pos.x,y=pos.y,z=pos.z-1} + } + for i, value in ipairs(mass_pos) do + if minetest.get_item_group((minetest.get_node(mass_pos[i])).name,"fluid_pipe")>0 then + local meta = minetest.get_meta(mass_pos[i]) + owl_tech.check_all_side_for_fluid_work(mass_pos[i],meta) + end + end +end +------------------------------ +--Chek all side for work and set it +function owl_tech.check_all_side_for_fluid_work(pos,meta) + owl_tech.set_conection_amount_fluid(meta,0)--reset conection amount + + owl_tech.set_side_info_y_p(meta,owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y+1,z=pos.z}))--y+ + owl_tech.set_conection_amount_fluid(meta,owl_tech.get_conection_amount_fluid(meta)+owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y+1,z=pos.z})) + + owl_tech.set_side_info_y_m(meta,owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y-1,z=pos.z}))--y- + owl_tech.set_conection_amount_fluid(meta,owl_tech.get_conection_amount_fluid(meta)+owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y-1,z=pos.z})) + + owl_tech.set_side_info_x_p(meta,owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x+1,y=pos.y,z=pos.z}))--x+ + owl_tech.set_conection_amount_fluid(meta,owl_tech.get_conection_amount_fluid(meta)+owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x+1,y=pos.y,z=pos.z})) + + owl_tech.set_side_info_x_m(meta,owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x-1,y=pos.y,z=pos.z}))--x- + owl_tech.set_conection_amount_fluid(meta,owl_tech.get_conection_amount_fluid(meta)+owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x-1,y=pos.y,z=pos.z})) + + owl_tech.set_side_info_z_p(meta,owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y,z=pos.z+1}))--z+ + owl_tech.set_conection_amount_fluid(meta,owl_tech.get_conection_amount_fluid(meta)+owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y,z=pos.z+1})) + + owl_tech.set_side_info_z_m(meta,owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y,z=pos.z-1}))--z- + owl_tech.set_conection_amount_fluid(meta,owl_tech.get_conection_amount_fluid(meta)+owl_tech.node_in_pos_connect_to_fluid_pipe({x=pos.x,y=pos.y,z=pos.z-1})) +end +------------------------------------------- +--chek can send fluid in pipe\mashine +function owl_tech.can_send_fluid_in_node(meta,pos_send,send_amount) + local flyid_name= owl_tech.get_pull_fluid_name(meta,0) + local meta_send = minetest.get_meta(pos_send) + local can_sand ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_send,flyid_name,send_amount) + return can_sand ,inde_pull +end +------------------------------------------- +--send fluid in pos by pipe +function owl_tech.send_fluid_from_pipe_in_pos(meta,pos_send,send_amount) + local meta_send = minetest.get_meta(pos_send) + local flyid_name= owl_tech.get_pull_fluid_name(meta,0) + local can_sand , inde_pull = owl_tech.can_send_fluid_in_node(meta_send,pos_send,send_amount) + if can_sand then + owl_tech.add_fluid_in_node_pull(meta_send,flyid_name,send_amount,inde_pull) + end +end +------------------------------------------- +--send for all sides in 1 tick +function owl_tech.send_for_all_sides_fluid_pipe(meta,pos) + local send_amount = owl_tech.get_fluid_sand_in_tick(meta) + local flyid_name= owl_tech.get_pull_fluid_name(meta,1) + local side_andres = owl_tech.get_need_pipe_to_send_fluid(pos,meta) + --+Y + if side_andres==1 then + local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z}) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,flyid_name,send_amount) + local can_do2 ,_ , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,flyid_name,send_amount) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,flyid_name,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta,remove_amount,inde_pull) + end + end + ---Y + if side_andres==2 then + local meta_up = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z}) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,flyid_name,send_amount) + local can_do2 ,_ , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,flyid_name,send_amount) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,flyid_name,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta,remove_amount,inde_pull) + end + end + --+X + if side_andres==3 then + local meta_up = minetest.get_meta({x=pos.x+1,y=pos.y,z=pos.z}) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,flyid_name,send_amount) + local can_do2 ,_ , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,flyid_name,send_amount) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,flyid_name,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta,remove_amount,inde_pull) + end + end + ---X + if side_andres==4 then + local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,flyid_name,send_amount) + local can_do2 ,_ , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,flyid_name,send_amount) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,flyid_name,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta,remove_amount,inde_pull) + end + end + --+Z + if side_andres==5 then + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,flyid_name,send_amount) + local can_do2 ,_ , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,flyid_name,send_amount) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,flyid_name,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta,remove_amount,inde_pull) + end + end + ---Z + if side_andres==6 then + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,flyid_name,send_amount) + local can_do2 ,_ , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,flyid_name,send_amount) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,flyid_name,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta,remove_amount,inde_pull) + end + end +end +------------------------------------------- +--get need pipe to send +function owl_tech.get_need_pipe_to_send_fluid(pos,meta) + local send_amount = owl_tech.get_fluid_sand_in_tick(meta) + local flyid_name= owl_tech.get_pull_fluid_name(meta,1) + local all_sede_table ={} + all_sede_table[1]=math.huge + all_sede_table[2]=math.huge + all_sede_table[3]=math.huge + all_sede_table[4]=math.huge + all_sede_table[5]=math.huge + all_sede_table[6]=math.huge + --+Y + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})).name,"owl_tech_fluid_pipe")>0 + and owl_tech.get_pull_volume(minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z}),1)0 + and owl_tech.get_pull_volume(minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z}),1)0 + and owl_tech.get_pull_volume(minetest.get_meta({x=pos.x+1,y=pos.y,z=pos.z}),1)0 + and owl_tech.get_pull_volume(minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}),1)0 + and owl_tech.get_pull_volume(minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}),1)0 + and owl_tech.get_pull_volume(minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}),1) all_sede_table[i] then + min = all_sede_table[i] + side_andres =i + end + end + return side_andres +end \ No newline at end of file diff --git a/custom_recips/init.lua b/custom_recips/init.lua new file mode 100755 index 0000000..d7c03a7 --- /dev/null +++ b/custom_recips/init.lua @@ -0,0 +1,5 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +dofile(path .. "/custom_recips/recips_table_and_some_metods.lua") --main fail about all pipes \ No newline at end of file diff --git a/custom_recips/recips_table_and_some_metods.lua b/custom_recips/recips_table_and_some_metods.lua new file mode 100755 index 0000000..121ccd0 --- /dev/null +++ b/custom_recips/recips_table_and_some_metods.lua @@ -0,0 +1,42 @@ + +--setter and getter mashine tire +function owl_tech.get_mashine_tire(meta) + return meta:get_int("_tire") +end +function owl_tech.set_mashine_tire(meta,value) + meta:set_int("_tire",value) +end +-------------------------------- +-- maceratro recips func +function owl_tech.can_macaerat_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) -- chek for tire , and slots for free space for res and add res + local ret =false + if MACERATO_RECIPS[name][2]<=owl_tech.get_mashine_tire(meta) + and (dst_its:is_empty() or(dst_its:get_name()==MACERATO_RECIPS[name][3] and dst_its:get_count()+MACERATO_RECIPS[name][4]<=dst_its:get_stack_max())) + and (dst_add_its:is_empty() or(dst_add_its:get_name()==MACERATO_RECIPS[name][7] and dst_add_its:get_count()+MACERATO_RECIPS[name][8]<=dst_add_its:get_stack_max())) then + ret =true + end + return ret +end +-------------------------------- +-- sieve recips func +function owl_tech.can_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) -- chek for tire , and slots for free space for res and add res + local ret =false + if SIEV_RESIPS[name][2]<=owl_tech.get_mashine_tire(meta) + and (dst_its:is_empty() or(dst_its:get_name()==SIEV_RESIPS[name][3] and dst_its:get_count()+SIEV_RESIPS[name][4]<=dst_its:get_stack_max())) + and (dst_add_its:is_empty() or(dst_add_its:get_name()==SIEV_RESIPS[name][7] and dst_add_its:get_count()+SIEV_RESIPS[name][8]<=dst_add_its:get_stack_max())) then + ret =true + end + return ret +end +-------------------------------- +-- smelter recips func +function owl_tech.can_smelter_recips_recips_go_in_this_mashien(meta,name,dst_its) -- chek for tire , and slots for free space for res and add res + local ret =false + if SMELTER_RECIPS[name][5]<=owl_tech.get_mashine_tire(meta) + and (dst_its:is_empty() or(dst_its:get_name()==SMELTER_RECIPS[name][3] and dst_its:get_count()+SMELTER_RECIPS[name][4]<=dst_its:get_stack_max())) then + ret =true + end + return ret +end +-------------------------------- + diff --git a/debug_tools/init.lua b/debug_tools/init.lua new file mode 100755 index 0000000..5e2c73f --- /dev/null +++ b/debug_tools/init.lua @@ -0,0 +1,41 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + + +minetest.register_craftitem("owl_tech:stick_of_truef", { + description = S("Stick of truef"), + _doc_items_longdesc = S("get all info about node and envirment"), + inventory_image = "owl_tech_stick_of_trufh.png", + stack_max = 64, + groups = { book=1, craftitem = 1 }, + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local pos = {} + --local bioms_table = biomeinfo.get_active_v6_biomes() + minetest.chat_send_player(name, "-------------------------------------------") + if pointed_thing.type == "node" then + pos = pointed_thing.under + minetest.chat_send_player(name, "Node pos-"..(minetest.pos_to_string(pos))) + minetest.chat_send_player(name, "Node name-"..((minetest.get_node(pos)).name)) + --minetest.chat_send_player(name, "All bioms list -"..(biomeinfo.all_v6_biomes())) + --minetest.chat_send_player(name, "All active bioms list -"..(biomeinfo.get_active_v6_biomes())) + minetest.chat_send_player(name, "Biom name -"..(biomeinfo.get_v6_biome(pos))) + minetest.chat_send_player(name, "Biom humidity -"..(biomeinfo.get_v6_humidity(pos))) + minetest.chat_send_player(name, "Biom heat -"..(biomeinfo.get_v6_heat(pos))) + elseif pointed_thing.type == "object" then + pos = pointed_thing.ref:get_pos() + minetest.chat_send_player(name, "Object pos-"..(minetest.pos_to_string(pos))) + --minetest.chat_send_player(name, "All bioms list -"..(biomeinfo.all_v6_biomes())) + --minetest.chat_send_player(name, "All active bioms list -"..(biomeinfo.get_active_v6_biomes())) + minetest.chat_send_player(name, "Biom name -"..(biomeinfo.get_v6_biome(pos))) + minetest.chat_send_player(name, "Biom humidity -"..(biomeinfo.get_v6_humidity(pos))) + minetest.chat_send_player(name, "Biom heat -"..(biomeinfo.get_v6_heat(pos))) + else + minetest.chat_send_player(name, "Dont use it in air -finde node or some object") + end + minetest.chat_send_player(name, "-------------------------------------------") + end +}) + + diff --git a/i3_integration/init.lua b/i3_integration/init.lua new file mode 100644 index 0000000..af3e5fd --- /dev/null +++ b/i3_integration/init.lua @@ -0,0 +1,42 @@ +---Integration for i3 + +i3.register_craft_type("alloy_smelter", { + description = "Alloy smetler", + icon = "owl_tech_smelter_face.png", +}) + +i3.register_craft_type("macerator", { --SIEV_RESIPS + description = "Macerator", + icon = "owl_tech_macerator_face.png", +}) + +i3.register_craft_type("siev", { + description = "Siev", + icon = "owl_tech_sieve_face.png", +}) + +for i, value in pairs(SMELTER_RECIPS) do + i3.register_craft { + type = "alloy_smelter", + result = value[3]..' '..value[4], + items = {value[7]..' '..value[1],value[8]..' '..value[2]}, + } +end + +for i, value in pairs(MACERATO_RECIPS) do + i3.register_craft { + type = "macerator", + result = value[3]..' '..value[4], + items = {value[9]..' '..value[1]}, + } +end + +for i, value in pairs(SIEV_RESIPS) do + i3.register_craft { + type = "siev", + result = value[3]..' '..value[4], + items = {value[9]..' '..value[1]}, + } +end + + diff --git a/init.lua b/init.lua new file mode 100755 index 0000000..8fd5a6e --- /dev/null +++ b/init.lua @@ -0,0 +1,20 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +local i3_name = minetest.get_modpath('i3') + + +dofile(path .. "/api/init.lua") --all base func +dofile(path .. "/ore/init.lua") --ore loads +dofile(path .. "/debug_tools/init.lua") --debug_tools don.t use in surv game +--dofile(path .. "/xray/init.lua") --xray don.t use in surv game +dofile(path .. "/steam/init.lua") --main fail about all steam gen +dofile(path .. "/pipe/init.lua") --main fail about all pipes +dofile(path .. "/custom_recips/init.lua") --main fail about all custom recips +dofile(path .. "/mashins/init.lua") --main fail about all pipes +dofile(path .. "/lists_of_all.lua") --GLOBAL carialbe +if i3_name~=nil then + dofile(path .. "/i3_integration/init.lua") --i3 integration +end +dofile(path .. "/multiblocks/init.lua") --Multi-nodes \ No newline at end of file diff --git a/lists_of_all.lua b/lists_of_all.lua new file mode 100755 index 0000000..8f1ea0c --- /dev/null +++ b/lists_of_all.lua @@ -0,0 +1,58 @@ +--Global lists +GLOBAL_FLUID_LIST ={ + "mcl_water","mcl_lava" +} +INPUT_SLOT_NAME= { + "fluid_in","fuel",'input_in' +} +OUTPUT_SLOT_NAME={ + 'dst_add','dst' +} + + +local ore_duration = 4 +local ingot_duration = 2 +local smel_metal_duration = 2 + +-- key-input_name ----1)input_amount 2)recip_tire 3)output_name 4)output_amount 5)duration(use for 100) 6)seconds_chanse(0-100) 7)output_name_second 8)output_amount_second 9)Input full name +-- minus 10 key +MACERATO_RECIPS = { + --ore + iron_ore= {(1),(1),("owl_tech:iron_dirt_dust"),(2),(ore_duration),(25),("owl_tech:tin_dirt_dust"),(1),("owl_tech:iron_ore")}, + tin_ore = {(1),(1),("owl_tech:tin_dirt_dust"),(2),(ore_duration),(25),("owl_tech:iron_dirt_dust"),(1),("owl_tech:tin_ore")}, + copper_ore = {(1),(1),("owl_tech:copper_dirt_dust"),(2),(ore_duration),(25),("owl_tech:gold_dirt_dust"),(1),("owl_tech:copper_ore")}, + gold_ore = {(1),(1),("owl_tech:gold_dirt_dust"),(2),(ore_duration),(25),("owl_tech:copper_dirt_dust"),(1),("owl_tech:gold_ore")}, + silver_ore = {(1),(1),("owl_tech:silver_dirt_dust"),(2),(ore_duration),(25),("owl_tech:lead_dirt_dust"),(1),("owl_tech:silver_ore")}, + lead_ore = {(1),(1),("owl_tech:lead_dirt_dust"),(2),(ore_duration),(25),("owl_tech:silver_dirt_dust"),(1),("owl_tech:lead_ore")}, + coal_ore = {(1),(1),("owl_tech:coal_dirt_dust"),(2),(ore_duration),(25),("owl_tech:coal_dirt_dust"),(1),("owl_tech:coal_ore")}, + saltpeter_ore = {(1),(1),("owl_tech:saltpeter_dirt_dust"),(2),(ore_duration),(25),("owl_tech:sulfur_dirt_dust"),(1),("owl_tech:saltpeter_ore")}, + sulfur_ore = {(1),(1),("owl_tech:sulfur_dirt_dust"),(2),(ore_duration),(25),("owl_tech:saltpeter_dirt_dust"),(1),("owl_tech:sulfur_ore")}, + diamond_ore = {(1),(1),("owl_tech:diamond_dirt_dust"),(2),(ore_duration),(25),("owl_tech:coal_dirt_dust"),(1),("owl_tech:diamond_ore")}, + --ingots + iron_ingot = {(1),(1),("owl_tech:iron_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:iron_ingot")}, + tin_ingot = {(1),(1),("owl_tech:tin_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:tin_ingot")}, + copper_ingot = {(1),(1),("owl_tech:copper_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:copper_ingot")}, + gold_ingot = {(1),(1),("owl_tech:gold_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:gold_ingot")}, + silver_ingot = {(1),(1),("owl_tech:silver_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:silver_ingot")}, + lead_ingot = {(1),(1),("owl_tech:lead_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:lead_ingot")}, + steal_ingot = {(1),(1),("owl_tech:steal_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:steal_ingot")}, + bronze_ingot = {(1),(1),("owl_tech:bronze_dust"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:bronze_ingot")}, +} +-- key-input_name ----1)1 input amount 2)2 input amount 3)output name 4)output amount 5)recipt tire 6)duration(use for 100) 7)name 1 input 8)name 2 input +SMELTER_RECIPS={ + tin_ingotcopper_ingot={(1),(3),("owl_tech:bronze_ingot"),(4),(1),(smel_metal_duration),'owl_tech:tin_ingot','owl_tech:copper_ingot'}, + copper_ingottin_ingot={(3),(1),("owl_tech:bronze_ingot"),(4),(1),(smel_metal_duration),'owl_tech:copper_ingot','owl_tech:tin_ingot'}, +} +-- key-input_name ----1)input_amount 2)recip_tire 3)output_name 4)output_amount 5)duration(use for 100) 6)seconds_chanse(0-100) 7)output_name_second 8)output_amount_second 9)Input full name +SIEV_RESIPS={ + iron_dirt_dust= {(1),(1),("owl_tech:iron_dust"),(2),(ore_duration),(25),("owl_tech:tin_dust"),(1),("owl_tech:iron_dirt_dust")}, + tin_dirt_dust= {(1),(1),("owl_tech:tin_dust"),(2),(ore_duration),(25),("owl_tech:iron_dust"),(1),("owl_tech:tin_dirt_dust")}, + copper_dirt_dust= {(1),(1),("owl_tech:copper_dust"),(2),(ore_duration),(25),("owl_tech:gold_dust"),(1),("owl_tech:copper_dirt_dust")}, + gold_dirt_dust= {(1),(1),("owl_tech:gold_dust"),(2),(ore_duration),(25),("owl_tech:copper_dust"),(1),("owl_tech:gold_dirt_dust")}, + silver_dirt_dust= {(1),(1),("owl_tech:silver_dust"),(2),(ore_duration),(25),("owl_tech:lead_dust"),(1),("owl_tech:silver_dirt_dust")}, + lead_dirt_dust= {(1),(1),("owl_tech:lead_dust"),(2),(ore_duration),(25),("owl_tech:silver_dust"),(1),("owl_tech:lead_dirt_dust")}, + coal_dirt_dust= {(1),(1),("owl_tech:coal_dust"),(2),(ore_duration),(25),("owl_tech:coal_dust"),(1),("owl_tech:coal_dirt_dust")}, + saltpeter_dirt_dust= {(1),(1),("owl_tech:saltpeter_dust"),(2),(ore_duration),(25),("owl_tech:sulfur_dust"),(1),("owl_tech:saltpeter_dirt_dust")}, + sulfur_dirt_dust= {(1),(1),("owl_tech:sulfur_dust"),(2),(ore_duration),(25),("owl_tech:saltpeter_dust"),(1),("owl_tech:sulfur_dirt_dust")}, + diamond_dirt_dust= {(1),(1),("owl_tech:diamond_dust"),(2),(ore_duration),(25),("owl_tech:diamond_dust"),(1),("owl_tech:diamond_dirt_dust")}, +} \ No newline at end of file diff --git a/mashins/init.lua b/mashins/init.lua new file mode 100755 index 0000000..91c601b --- /dev/null +++ b/mashins/init.lua @@ -0,0 +1,7 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +dofile(path .. "/mashins/steam_machins.lua") --steam mashins +dofile(path .. "/mashins/vertical_miner.lua") --steam mashins +dofile(path .. "/mashins/quarry.lua") \ No newline at end of file diff --git a/mashins/quarry.lua b/mashins/quarry.lua new file mode 100644 index 0000000..eef5bdd --- /dev/null +++ b/mashins/quarry.lua @@ -0,0 +1,103 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +minetest.register_node("owl_tech:quary_point", { + description = S("Quary point"), + _doc_items_longdesc = S("Point the pos for quary "), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary_point.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary_point.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary_point.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary_point.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,dst=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, +}) + + +local function set_formspect_steam_quarry(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.25,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Stean vertical miner"))).."]".. + "list[context;dst;5.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(5.5,1.5,1,1).. + "label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]".. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[current_player;main]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end + + +minetest.register_node("owl_tech:steam_quarry", { + description = S("Steam quarry"), + _doc_items_longdesc = S("Dig the Hole"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_quary.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,dst=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,8000,1,0) --steam eat 25 steam in 1 tick + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + owl_tech.set_mashine_tire(meta,1) --all steam mishine has 1 tire + set_formspect_steam_quarry(meta) + owl_tech.prepear_for_verticak_steam_miner(pos) + local timer =minetest.get_node_timer(pos) + local inv = meta:get_inventory() + inv:set_size("dst", 1) + timer:start(2) + end, + on_timer = function(pos, elapsed) + local meta = minetest.get_meta(pos) + local timer = minetest.get_node_timer(pos) + if meta:get_int("min_x")==0 and meta:get_int("min_z")==0 then + owl_tech.scan_for_point(pos,meta,8) + end + if meta:get_int("get_bedrock")==0 and + owl_tech.get_pull_volume(meta,1)>=15 then + local inv = meta:get_inventory() + owl_tech.set_pull_volume(meta,1,owl_tech.get_pull_volume(meta,1)-15) + local can_mine = owl_tech.can_quary_mine_this(pos,meta) + owl_tech.diging_quary(pos,meta,can_mine) + end + 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 can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,"owl_tech_steam",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,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,"owl_tech_steam",remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + owl_tech.delit_name_fluid_if_0(meta) + set_formspect_steam_quarry(meta) + timer:start(0.2) + end +}) \ No newline at end of file diff --git a/mashins/steam_machins.lua b/mashins/steam_machins.lua new file mode 100755 index 0000000..70aa1d6 --- /dev/null +++ b/mashins/steam_machins.lua @@ -0,0 +1,400 @@ +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_base_macerator(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 redines = owl_tech.get_item_redines(meta) + 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.25,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Stean macerator"))).."]".. + "list[context;input_in;2.5,2.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,2.5,1,1).. + "list[context;dst;5.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(5.5,1.5,1,1).. + "list[context;dst_add;6.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(6.5,1.5,1,1).. + "label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]".. + "label[0,2;"..minetest.formspec_escape(minetest.colorize("#313131", (redines.." / 100"))).."]".. + "listring[context;dst]".. + "listring[context;dst_add]".. + "listring[current_player;main]".. + "listring[context;input_in]".. + "listring[current_player;main]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end + +--bronze_macerator" +minetest.register_node("owl_tech:bronze_macerator", { + description = S("Bronze macerator"), + _doc_items_longdesc = S("Macerate ore in dust"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_macerator_face.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,dst=1,dst_add=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,8000,1,0) --steam eat 25 steam in 1 tick + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + owl_tech.set_mashine_tire(meta,1) --all steam mishine has 1 tire + owl_tech.reset_item_redines(meta) + set_formspect_base_macerator(meta) + owl_tech.update_fluid_pipe_around(pos) + local timer =minetest.get_node_timer(pos) + local inv = meta:get_inventory() + inv:set_size("input_in", 1) + inv:set_size("dst", 1) + inv:set_size("dst_add", 1) + 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 input_its = inv:get_stack('input_in', 1) + local dst_its = inv:get_stack('dst', 1) + local dst_add_its = inv:get_stack('dst_add', 1) + if not input_its:is_empty() then -- chek for item in slots + local name= string.sub(input_its:get_name(), 10) + if MACERATO_RECIPS[name]~=nil and owl_tech.get_item_redines(meta)>0 and owl_tech.get_item_redines(meta)<100 then --recipt real + if owl_tech.can_macaerat_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) then-- chek for all itemslot and machine tire + local amount=owl_tech.calculate_recipe_tire_bonus(meta,MACERATO_RECIPS[name][2],MACERATO_RECIPS[name][5]) + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.add_item_redines(meta,amount) + end + elseif MACERATO_RECIPS[name]~=nil and owl_tech.get_item_redines(meta)>=100 then + if owl_tech.can_macaerat_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) then-- chek for all itemslot and machine tire + + input_its:set_count(input_its:get_count()-1) --Remove item from input slot + inv:set_stack('input_in', 1, input_its) + + if not dst_its:is_empty() then-- Add main output + dst_its:set_count(dst_its:get_count()+MACERATO_RECIPS[name][4]) + inv:set_stack('dst', 1, dst_its) + else + local item ={name=MACERATO_RECIPS[name][3], count=MACERATO_RECIPS[name][4], wear=0, metadata=""} + dst_its:add_item(item) + inv:set_stack('dst', 1, dst_its) + end + + local random = math.random(1,100) --chans to get second output + if MACERATO_RECIPS[name][6]>random then-- Add second output if has + if not dst_add_its:is_empty() then + dst_add_its:set_count(dst_add_its:get_count()+MACERATO_RECIPS[name][8]) + inv:set_stack('dst_add', 1, dst_add_its) + else + local item ={name=MACERATO_RECIPS[name][7], count=MACERATO_RECIPS[name][8], wear=0, metadata=""} + dst_add_its:add_item(item) + inv:set_stack('dst_add', 1, dst_add_its) + end + end + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.reset_item_redines(meta) + end + elseif MACERATO_RECIPS[name]~=nil and 100/MACERATO_RECIPS[name][5]*25<= owl_tech.get_pull_volume(meta,1) and owl_tech.get_item_redines(meta)==0 then --begin for work + local amount=owl_tech.calculate_recipe_tire_bonus(meta,MACERATO_RECIPS[name][2],MACERATO_RECIPS[name][5]) + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.add_item_redines(meta,amount) + end + else + owl_tech.reset_item_redines(meta) + end + 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 can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,"owl_tech_steam",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,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,"owl_tech_steam",remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + owl_tech.delit_name_fluid_if_0(meta) + set_formspect_base_macerator(meta) + timer:start(0.2) + end +}) +--alloy smelter +local function set_formspect_base_alloy_smelter(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 redines = owl_tech.get_item_redines(meta) + 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("Steam alloy smelter"))).."]".. + "list[context;input_in;2.5,2.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,2.5,1,1).. + "list[context;input_in_add;4,2.5;1,1;]".. + mcl_formspec.get_itemslot_bg(4,2.5,1,1).. + "list[context;dst;5.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(5.5,1.5,1,1).. + "label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]".. + "label[0,2;"..minetest.formspec_escape(minetest.colorize("#313131", (redines.." / 100"))).."]".. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[context;input_in]".. + "listring[context;input_in_add]".. + "listring[current_player;main]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end +------------------------------------------- +--bronze_alloy_smelter +minetest.register_node("owl_tech:bronze_alloy_smelter", { + description = S("Bronze alloy smelter"), + _doc_items_longdesc = S("Smelt alll"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_smelter_face.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,8000,1,0) --steam eat 25 steam in 1 tick + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + owl_tech.set_mashine_tire(meta,1) --all steam mishine has 1 tire + owl_tech.reset_item_redines(meta) + set_formspect_base_alloy_smelter(meta) + owl_tech.update_fluid_pipe_around(pos) + local timer =minetest.get_node_timer(pos) + local inv = meta:get_inventory() + inv:set_size("input_in", 1) + inv:set_size("input_in_add", 1) + inv:set_size("dst", 1) + 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 input_its = inv:get_stack('input_in', 1) + local input_its_add = inv:get_stack('input_in_add', 1) + local dst_its = inv:get_stack('dst', 1) + if not input_its:is_empty() then -- chek for item in slots + local name1= string.sub(input_its:get_name(), 10) + local name2 = string.sub(input_its_add:get_name(), 10) + local name ="" + local recipt_true = false + if SMELTER_RECIPS[name1..name2]~=nil then + recipt_true= true + name=name1..name2 + elseif SMELTER_RECIPS[name2..name1]~=nil then + recipt_true= true + name=name2..name1 + end + if recipt_true and owl_tech.get_item_redines(meta)>0 and owl_tech.get_item_redines(meta)<100 then --recipt real + + if owl_tech.can_smelter_recips_recips_go_in_this_mashien(meta,name,dst_its) then-- chek for all itemslot and machine tire + + local amount=owl_tech.calculate_recipe_tire_bonus(meta,SMELTER_RECIPS[name][5],SMELTER_RECIPS[name][6]) + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.add_item_redines(meta,amount) + end + elseif recipt_true and owl_tech.get_item_redines(meta)>=100 then + if owl_tech.can_smelter_recips_recips_go_in_this_mashien(meta,name,dst_its) then-- chek for all itemslot and machine tire + input_its:set_count(input_its:get_count()-1) --Remove item from input slot + inv:set_stack('input_in', 1, input_its) + input_its:set_count(input_its_add:get_count()-1) --Remove item from input slot + inv:set_stack('input_in_add', 1, input_its) + + if not dst_its:is_empty() then-- Add main output + dst_its:set_count(dst_its:get_count()+SMELTER_RECIPS[name][4]) + inv:set_stack('dst', 1, dst_its) + else + local item ={name=SMELTER_RECIPS[name][3], count=SMELTER_RECIPS[name][4], wear=0, metadata=""} + dst_its:add_item(item) + inv:set_stack('dst', 1, dst_its) + end + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.reset_item_redines(meta) + end + elseif recipt_true and 100/SMELTER_RECIPS[name][6]*25<= owl_tech.get_pull_volume(meta,1) and owl_tech.get_item_redines(meta)==0 then --begin for work + local amount=owl_tech.calculate_recipe_tire_bonus(meta,SMELTER_RECIPS[name][2],SMELTER_RECIPS[name][5]) + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.add_item_redines(meta,amount) + end + else + owl_tech.reset_item_redines(meta) + end + 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 can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,"owl_tech_steam",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,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,"owl_tech_steam",remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + owl_tech.delit_name_fluid_if_0(meta) + set_formspect_base_alloy_smelter(meta) + timer:start(0.2) + end +}) +------------------------------------------- +--base sieve +local function set_formspect_base_sieve(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 redines = owl_tech.get_item_redines(meta) + 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.25,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Stean sieve"))).."]".. + "list[context;input_in;2.5,2.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,2.5,1,1).. + "list[context;dst;5.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(5.5,1.5,1,1).. + "list[context;dst_add;6.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(6.5,1.5,1,1).. + "label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]".. + "label[0,2;"..minetest.formspec_escape(minetest.colorize("#313131", (redines.." / 100"))).."]".. + "listring[context;dst]".. + "listring[context;dst_add]".. + "listring[current_player;main]".. + "listring[context;input_in]".. + "listring[current_player;main]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end +--bronze_sieve" +minetest.register_node("owl_tech:bronze_sieve", { + description = S("Bronze sieve"), + _doc_items_longdesc = S("sieve alls"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_sieve_face.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,8000,1,0) --steam eat 25 steam in 1 tick + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + owl_tech.set_mashine_tire(meta,1) --all steam mishine has 1 tire + owl_tech.reset_item_redines(meta) + set_formspect_base_sieve(meta) + owl_tech.update_fluid_pipe_around(pos) + local timer =minetest.get_node_timer(pos) + local inv = meta:get_inventory() + inv:set_size("input_in", 1) + inv:set_size("dst", 1) + inv:set_size("dst_add", 1) + 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 input_its = inv:get_stack('input_in', 1) + local dst_its = inv:get_stack('dst', 1) + local dst_add_its = inv:get_stack('dst_add', 1) + if not input_its:is_empty() then -- chek for item in slots + local name= string.sub(input_its:get_name(), 10) + if SIEV_RESIPS[name]~=nil and owl_tech.get_item_redines(meta)>0 and owl_tech.get_item_redines(meta)<100 then --recipt real + if owl_tech.can_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) then-- chek for all itemslot and machine tire + local amount=owl_tech.calculate_recipe_tire_bonus(meta,SIEV_RESIPS[name][2],SIEV_RESIPS[name][5]) + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.add_item_redines(meta,amount) + end + elseif SIEV_RESIPS[name]~=nil and owl_tech.get_item_redines(meta)>=100 then + if owl_tech.can_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) then-- chek for all itemslot and machine tire + + input_its:set_count(input_its:get_count()-1) --Remove item from input slot + inv:set_stack('input_in', 1, input_its) + + if not dst_its:is_empty() then-- Add main output + dst_its:set_count(dst_its:get_count()+SIEV_RESIPS[name][4]) + inv:set_stack('dst', 1, dst_its) + else + local item ={name=SIEV_RESIPS[name][3], count=SIEV_RESIPS[name][4], wear=0, metadata=""} + dst_its:add_item(item) + inv:set_stack('dst', 1, dst_its) + end + + local random = math.random(1,100) --chans to get second output + if SIEV_RESIPS[name][6]>random then-- Add second output if has + if not dst_add_its:is_empty() then + dst_add_its:set_count(dst_add_its:get_count()+SIEV_RESIPS[name][8]) + inv:set_stack('dst_add', 1, dst_add_its) + else + local item ={name=SIEV_RESIPS[name][7], count=SIEV_RESIPS[name][8], wear=0, metadata=""} + dst_add_its:add_item(item) + inv:set_stack('dst_add', 1, dst_add_its) + end + end + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.reset_item_redines(meta) + end + elseif SIEV_RESIPS[name]~=nil and 100/SIEV_RESIPS[name][5]*25<= owl_tech.get_pull_volume(meta,1) and owl_tech.get_item_redines(meta)==0 then --begin for work + local amount=owl_tech.calculate_recipe_tire_bonus(meta,SIEV_RESIPS[name][2],SIEV_RESIPS[name][5]) + local steam_new =owl_tech.get_pull_volume(meta,1)-25 + owl_tech.set_pull_volume(meta,1,steam_new) + owl_tech.add_item_redines(meta,amount) + end + else + owl_tech.reset_item_redines(meta) + end + 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 can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,"owl_tech_steam",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,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,"owl_tech_steam",remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + owl_tech.delit_name_fluid_if_0(meta) + set_formspect_base_sieve(meta) + timer:start(0.2) + end +}) \ No newline at end of file diff --git a/mashins/vertical_miner.lua b/mashins/vertical_miner.lua new file mode 100644 index 0000000..3c71873 --- /dev/null +++ b/mashins/vertical_miner.lua @@ -0,0 +1,81 @@ +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_steam_vertical_miner(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.25,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Stean vertical miner"))).."]".. + "list[context;dst;5.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(5.5,1.5,1,1).. + "label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]".. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[current_player;main]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end + + +minetest.register_node("owl_tech:steam_vertical_miner", { + description = S("Vertical miner"), + _doc_items_longdesc = S("Dig the hole"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_vertical_miner_face.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_vertical_miner_face.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_vertical_miner_face.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_vertical_miner_face.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,dst=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,8000,1,0) --steam eat 25 steam in 1 tick + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + owl_tech.set_mashine_tire(meta,1) --all steam mishine has 1 tire + set_formspect_steam_vertical_miner(meta) + owl_tech.prepear_for_verticak_steam_miner(pos) + local timer =minetest.get_node_timer(pos) + local inv = meta:get_inventory() + inv:set_size("dst", 1) + timer:start(2) + end, + on_timer = function(pos, elapsed) + local meta = minetest.get_meta(pos) + local timer = minetest.get_node_timer(pos) + if meta:get_int("get_bedrock")==0 and + owl_tech.get_pull_volume(meta,1)>=15 then + local inv = meta:get_inventory() + owl_tech.set_pull_volume(meta,1,owl_tech.get_pull_volume(meta,1)-15) + owl_tech.vertical_steam_mine(pos,meta,owl_tech.can_vertical_steam_miner_mine_this(pos,meta)) + end + 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 can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,"owl_tech_steam",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,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,"owl_tech_steam",remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + owl_tech.delit_name_fluid_if_0(meta) + set_formspect_steam_vertical_miner(meta) + timer:start(0.2) + end, + on_destruct = function(pos) + owl_tech.remove_all_pipe_vertical(pos) + end +}) \ No newline at end of file diff --git a/mod.conf b/mod.conf new file mode 100755 index 0000000..5912516 --- /dev/null +++ b/mod.conf @@ -0,0 +1,7 @@ +name = owl_tech +author = ConfidentOwl +depends = mcl_core + +description = Big tech mod + +release = 0.001 diff --git a/ore/init.lua b/ore/init.lua new file mode 100755 index 0000000..292df0c --- /dev/null +++ b/ore/init.lua @@ -0,0 +1,10 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +dofile(minetest.get_modpath("owl_tech") .. "/ore/node_register.lua") --ore node load +dofile(minetest.get_modpath("owl_tech") .. "/ore/ore_gen.lua") --ore node load + +--All ore logick put hear!!! + + diff --git a/ore/node_register.lua b/ore/node_register.lua new file mode 100755 index 0000000..fefd87f --- /dev/null +++ b/ore/node_register.lua @@ -0,0 +1,264 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) +--delite vanila ores (dont foget make confige for it) +--[[local ore_for_delite ={"mcl_core:stone_with_coal","mcl_core:stone_with_iron","mcl_core:stone_with_redstone","mcl_core:stone_with_lapis","mcl_core:stone_with_diamond",} +for i, value in ipairs(ore_for_delite) do + minetest.unregister_item(ore_for_delite[i]) +end]] +--wanila res remove !!!! + +-- 1)tech_name 2)useal name 3)ineed ore ? 4)pickasxe_level 5)color +local metals_ore_array={ + {"iron","Iron ",true,3,"#f7f7f7"}, + {"copper","Copper ",true,2,"#ff5e00"}, + {"tin","Tin ",true,2,"#c9c9c9"}, + {"gold","Gold ",true,2,"#ffe600"}, + {"silver","Silver ",true,3,"#d1d1d1"}, + {"lead","Lead ",true,3,"#9092ab"}, + {"steal","Steal ",false,3,"#575757"}, + {"bronze","Bronze ",false,3,"#a35900"}, +} +--make metals ALL +for i, value in ipairs(metals_ore_array) do + --ore + if metals_ore_array[i][3] then + minetest.register_node("owl_tech:"..metals_ore_array[i][1].."_ore", { + description = S(metals_ore_array[i][2].." ore"), + _doc_items_longdesc = S(metals_ore_array[i][2]..' ore'), + _doc_items_hidden = false, + tiles = {"default_stone.png^(owl_tech_ore_base.png^[colorize:"..metals_ore_array[i][5]..":128)"}, + is_ground_content = true, + stack_max = 64, + groups = {pickaxey=metals_ore_array[i][4], building_block=1, material_stone=1, blast_furnace_smeltable=1}, + drop = "owl_tech:"..metals_ore_array[i][1].."_ore", + sounds = mcl_sounds.node_sound_stone_defaults(), + _mcl_blast_resistance = 3, + _mcl_hardness = 3, + _mcl_silk_touch_drop = true, + }) + end + --Nugget + minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_nugget", { + description = S(metals_ore_array[i][2].. " Nugget"), + _doc_items_longdesc = S(metals_ore_array[i][2].. " Nugget"), + inventory_image = "mcl_core_iron_nugget.png^[colorize:"..metals_ore_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --Ingot + minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_ingot", { + description = S(metals_ore_array[i][2].. " Ingot"), + _doc_items_longdesc = S(metals_ore_array[i][2].. " Ingot"), + inventory_image = "default_steel_ingot.png^[colorize:"..metals_ore_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --dust + minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dust", { + description = S(metals_ore_array[i][2].. " dust"), + _doc_items_longdesc = S(metals_ore_array[i][2].. " dust"), + inventory_image = "owl_tech_dust.png^[colorize:"..metals_ore_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --dirt dust + minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dirt_dust", { + description = S(metals_ore_array[i][2].. " dirt dust"), + _doc_items_longdesc = S(metals_ore_array[i][2].. " dirt dust"), + inventory_image = "owl_tech_dirt_dust.png^[colorize:"..metals_ore_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --plate + minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_plate", { + description = S(metals_ore_array[i][2].. " plate"), + _doc_items_longdesc = S(metals_ore_array[i][2].. " plate"), + inventory_image = "owl_tech_plate.png^[colorize:"..metals_ore_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --stick + minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_stick", { + description = S(metals_ore_array[i][2].. " stick"), + _doc_items_longdesc = S(metals_ore_array[i][2].. " stick"), + inventory_image = "owl_tech_stick.png^[colorize:"..metals_ore_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --Block + minetest.register_node("owl_tech:"..metals_ore_array[i][1].."block", { + description = S("Block of "..metals_ore_array[i][2]), + _doc_items_longdesc = S("Block of "..metals_ore_array[i][2]), + tiles = {"default_steel_block.png^[colorize:"..metals_ore_array[i][5]..":128"}, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=metals_ore_array[i][4], building_block=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + }) + --Block dust + minetest.register_node("owl_tech:"..metals_ore_array[i][1].."_dust_block", { + description = S("Dust block of "..metals_ore_array[i][2]), + _doc_items_longdesc = S("Block of "..metals_ore_array[i][2]), + tiles = {"owl_tech_dust_block_1.png^[colorize:"..metals_ore_array[i][5]..":128"}, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=metals_ore_array[i][4], building_block=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + }) + --Crafte ingot from nugets + minetest.register_craft({ + type = "shaped", + output = "owl_tech:"..metals_ore_array[i][1].."_ingot", + recipe = { + {"owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget"}, + {"owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget"}, + {"owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget"} + } + }) + --Crafte block from ingots + minetest.register_craft({ + type = "shaped", + output = "owl_tech:"..metals_ore_array[i][1].."block", + recipe = { + {"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"}, + {"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"}, + {"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"} + } + }) + --Crafte block dust from ingots + minetest.register_craft({ + type = "shaped", + output = "owl_tech:"..metals_ore_array[i][1].."_dust_block", + recipe = { + {"owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust"}, + {"owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust"}, + {"owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust"} + } + }) + --Crafte ingots from block + minetest.register_craft({ + type = "shapeless", + output = "owl_tech:"..metals_ore_array[i][1].."_ingot 9", + recipe = {"owl_tech:"..metals_ore_array[i][1].."block"} + }) + --Crafte dust from block + minetest.register_craft({ + type = "shapeless", + output = "owl_tech:"..metals_ore_array[i][1].."_dust 9", + recipe = {"owl_tech:"..metals_ore_array[i][1].."_dust_block"} + }) + +end +-- 1)tech_name 2)useal name 3)need ore ? 4)pickasxe_level 5)color 6)gem_base 7)gem_block_base 8)dust_block 9)burn fuel + +local gems_orew_array={ + {"coal","Coal ",true,1,"#1b1b1b","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",80}, + {"sulfur","Sulfur ",true,1,"#c2a800","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",0}, + {"saltpeter","Saltpeter ",true,1,"#b3e6ee","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",0}, + {"diamond","Diamond ",true,3,"#77cefb","owl_tech_gem_2.png","owl_tech_gem_block_2.png","owl_tech_dust_block_1.png",0}, + +} +for i, value in ipairs(gems_orew_array) do + --ore + if gems_orew_array[i][3] then + minetest.register_node("owl_tech:"..gems_orew_array[i][1].."_ore", { + description = S(gems_orew_array[i][2].." ore"), + _doc_items_longdesc = S(gems_orew_array[i][2]..' ore'), + _doc_items_hidden = false, + tiles = {"default_stone.png^(owl_tech_ore_base.png^[colorize:"..gems_orew_array[i][5]..":128)"}, + is_ground_content = true, + stack_max = 64, + groups = {pickaxey=gems_orew_array[i][4], building_block=1, material_stone=1, blast_furnace_smeltable=1}, + drop = "owl_tech:coal_ore", + sounds = mcl_sounds.node_sound_stone_defaults(), + _mcl_blast_resistance = 3, + _mcl_hardness = 3, + _mcl_silk_touch_drop = true, + }) + end + --dust + minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_dust", { + description = S(gems_orew_array[i][2].. " dust"), + _doc_items_longdesc = S(gems_orew_array[i][2].. " dust"), + inventory_image = "owl_tech_dust.png^[colorize:"..gems_orew_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --dirt dust + minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_dirt_dust", { + description = S(gems_orew_array[i][2].. " dirt dust"), + _doc_items_longdesc = S(gems_orew_array[i][2].. " dirt dust"), + inventory_image = "owl_tech_dirt_dust.png^[colorize:"..gems_orew_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --gem + minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1], { + description = S(gems_orew_array[i][2]), + _doc_items_longdesc = S(gems_orew_array[i][2]), + inventory_image = gems_orew_array[i][6].."^[colorize:"..gems_orew_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --plate + minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_plate", { + description = S(gems_orew_array[i][2].. " plate"), + _doc_items_longdesc = S(gems_orew_array[i][2].. " plate"), + inventory_image = "owl_tech_plate.png^[colorize:"..gems_orew_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --stick + minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_stick", { + description = S(gems_orew_array[i][2].. " stick"), + _doc_items_longdesc = S(gems_orew_array[i][2].. " stick"), + inventory_image = "owl_tech_stick.png^[colorize:"..gems_orew_array[i][5]..":128", + stack_max = 64, + groups = { craftitem=1 }, + }) + --burn time gem + if gems_orew_array[i][9]>0 then + minetest.register_craft({ + type = "fuel", + recipe = "owl_tech:"..gems_orew_array[i][1], + burntime = gems_orew_array[i][9], + }) + end + --Block + minetest.register_node("owl_tech:"..gems_orew_array[i][1].."_block", { + description = S("Block of "..gems_orew_array[i][2]), + _doc_items_longdesc = S("Block of "..gems_orew_array[i][2]), + tiles = {gems_orew_array[i][7].."^[colorize:"..gems_orew_array[i][5]..":128"}, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=gems_orew_array[i][4], building_block=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + }) + --burn time block + if gems_orew_array[i][9]>0 then + minetest.register_craft({ + type = "fuel", + recipe = "owl_tech:"..gems_orew_array[i][1].."_block", + burntime = gems_orew_array[i][9]*9, + }) + end + --Block dust + minetest.register_node("owl_tech:"..gems_orew_array[i][1].."_dust_block", { + description = S("Block of "..gems_orew_array[i][2]), + _doc_items_longdesc = S("Block of "..gems_orew_array[i][2]), + tiles = {gems_orew_array[i][8].."^[colorize:"..gems_orew_array[i][5]..":128"}, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=gems_orew_array[i][4], building_block=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + }) +end \ No newline at end of file diff --git a/ore/ore_gen.lua b/ore/ore_gen.lua new file mode 100755 index 0000000..6add889 --- /dev/null +++ b/ore/ore_gen.lua @@ -0,0 +1,332 @@ +local stonelike = {"mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite"} +--------------------------------- Coal +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:coal_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=100, y=100, z=100}, + seed = 423423, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.5, + random_factor = 1.0, +}) + +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:coal_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=100, y=100, z=100}, + seed = 423423, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.5 , + random_factor = 1.0, +}) +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:coal_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=100, y=100, z=100}, + seed = 423423, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.5 , + random_factor = 1.0, +}) +-------------------------------------- +--------------------------------- iron +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:iron_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=125, y=125, z=125}, + seed = 12341423, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6, + random_factor = 1.0, +}) + +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:iron_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=125, y=125, z=125}, + seed = 12341423, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6 , + random_factor = 1.0, +}) +-------------------------------------- +--------------------------------- copper +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:copper_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=125, y=125, z=125}, + seed = 456456, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6, + random_factor = 1.0, +}) + +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:copper_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=125, y=125, z=125}, + seed = 456456, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6 , + random_factor = 1.0, +}) +-------------------------------------- +--------------------------------- tin +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:tin_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 879789, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6, + random_factor = 1.0, +}) + +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:tin_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 879789, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6 , + random_factor = 1.0, +}) +-------------------------------------- +--------------------------------- gold +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:gold_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 453234654, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6, + random_factor = 1.0, +}) +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:silver_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 453234654, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6 , + random_factor = 1.0, +}) +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:silver_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 453234654, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6 , + random_factor = 1.0, +}) +-------------------------------------- +--------------------------------- Sulfure and saltpeter +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:sulfur_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 34567890, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6, + random_factor = 1.0, +}) +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:sulfur_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 34567890, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6 , + random_factor = 1.0, +}) +minetest.register_ore({ + ore_type = "vein", + ore = "owl_tech:saltpeter_ore", + wherein = stonelike, + clust_scarcity = 4*4*4, + clust_num_ores = 2048, + clust_size = 3, + y_min = -31000, + y_max = 31000, + noise_params = { + offset = 0, + scale = 3, + spread = {x=75, y=75, z=75}, + seed = 34567890, + octaves = 3, + persistence = 0,1, + lacunarity = 4, + }, + noise_threshold = 1.6 , + random_factor = 1.0, +}) +-------------------------------------- \ No newline at end of file diff --git a/pipe/fluid_pipe.lua b/pipe/fluid_pipe.lua new file mode 100755 index 0000000..2e8a29a --- /dev/null +++ b/pipe/fluid_pipe.lua @@ -0,0 +1,51 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + +minetest.register_node("owl_tech:iron_fluid_pipe",{ + description = "Fluid pipe tire 1", + _tt_help = S("Transport fluids"), + _doc_items_longdesc = S("Fence gates can be opened or closed and can't be jumped over. Fences will connect nicely to fence gates."), + _doc_items_usagehelp = S("Right-click the fence gate to open or close it."), + tiles = {"owl_tech_base_fluid_pipe.png"}, + paramtype = "light", + is_ground_content = false, + stack_max = 64, + sunlight_propagates = true, + walkable = true, + groups = {owl_tech_fluid_pipe=1}, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {-0.125,-0.125,-0.125,0.125,0.125,0.125} , + connect_top = {-0.125,-0.125,-0.125,0.125,0.5,0.125} , + connect_bottom = {-0.125,-0.5,-0.125,0.125,0.125,0.125} , + connect_front = {-0.125,-0.125,-0.5,0.125,0.125,0.125} , + connect_left = {-0.5,-0.125,-0.125,0.125,0.125,0.125} , + connect_back = {-0.125,-0.125,-0.125,0.125,0.125,0.5} , + connect_right = {-0.125,-0.125,-0.125,0.5,0.125,0.125} , + }, + connects_to = {"group:owl_tech_fluid_pipe","group:owl_tech_generator","group:owl_tech_machine"}, + sounds = mcl_sounds.node_sound_wool_defaults(), + _mcl_hardness = 0.1, + _mcl_blast_resistance = 0.1, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,300,1,1) + owl_tech.set_fluid_sand_in_tick(meta,60) + owl_tech.check_all_side_for_fluid_work(pos,meta) + owl_tech.update_fluid_pipe_around(pos) + local info_set = owl_tech.get_pull_volume(meta,1) + meta:set_string("infotext", info_set) + local timer =minetest.get_node_timer(pos) + timer:start(0.2) + end, + on_timer = function (pos, elapsed) + local meta = minetest.get_meta(pos) + local timer =minetest.get_node_timer(pos) + if owl_tech.get_pull_volume(meta,1)>0 then + owl_tech.send_for_all_sides_fluid_pipe(meta,pos) + end + local info_set = owl_tech.get_pull_volume(meta,1) + meta:set_string("infotext", info_set) + timer:start(0.01) + end +}) \ No newline at end of file diff --git a/pipe/fluid_pump.lua b/pipe/fluid_pump.lua new file mode 100755 index 0000000..f1c1c68 --- /dev/null +++ b/pipe/fluid_pump.lua @@ -0,0 +1,242 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +function owl_tech.prepear_for_pump(meta,max_horizontal_distance) + meta:set_int("check_y",-1) + meta:set_int("check_x",max_horizontal_distance) + meta:set_int("check_z",max_horizontal_distance) + meta:set_int("max_horizontal_distance",max_horizontal_distance) +end + +function owl_tech.get_max_horizontal_distance(meta) + return meta:get_int("max_horizontal_distance") +end + +function owl_tech.get_y_pump(meta) + return meta:get_int("check_y") +end + +function owl_tech.get_x_pump(meta) + return meta:get_int("check_x") +end + +function owl_tech.get_z_pump(meta) + return meta:get_int("check_z") +end + +function owl_tech.add_y_pump(meta) + meta:set_int("check_y",owl_tech.get_y_pump(meta)-1) +end + +function owl_tech.add_x_pump(meta) + meta:set_int("check_x",owl_tech.get_x_pump(meta)-1) +end + +function owl_tech.add_z_pump(meta) + meta:set_int("check_z",owl_tech.get_z_pump(meta)-1) +end + +function owl_tech.reset_x_pump(meta) + meta:set_int("check_x",meta:get_int("max_horizontal_distance")) +end + +function owl_tech.reset_z_pump(meta) + meta:set_int("check_z",meta:get_int("max_horizontal_distance")) +end + +function owl_tech.pos_pumping_update(meta) + if (-owl_tech.get_max_horizontal_distance(meta))>owl_tech.get_x_pump(meta)then --x + owl_tech.reset_x_pump(meta) + owl_tech.add_z_pump(meta) + end +end +function owl_tech.finde_fluid_on_level(meta,pos) + local finde = false + local new_pos = { + x=pos.x+owl_tech.get_max_horizontal_distance(meta), + y=pos.y+owl_tech.get_y_pump(meta), + z=pos.z+owl_tech.get_max_horizontal_distance(meta) + } + for i = owl_tech.get_max_horizontal_distance(meta), -owl_tech.get_max_horizontal_distance(meta), -1 do --x + new_pos.x= new_pos.x-1 + for j = owl_tech.get_max_horizontal_distance(meta), -owl_tech.get_max_horizontal_distance(meta), -1 do--z + new_pos.z= new_pos.z-1 + if (minetest.get_node(new_pos).name)=="mclx_core:river_water_source" or (minetest.get_node(new_pos).name)=="mcl_core:water_source" or (minetest.get_node(new_pos).name)=="mcl_core:lava_source" then + finde =true + return true + end + end + end + return finde +end + +local function set_formspect_base_pump(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 fluid_2_name = owl_tech.get_pull_fluid_name(meta,2) + local fluid_2_volume = owl_tech.get_pull_volume(meta,2) + 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.25,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Stean pump"))).."]".. + "label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]".. + "label[0,2.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_2_name.."--"..fluid_2_volume))).."]".. + "listring[current_player;main]".. + "listring[current_player;main]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end +--decor pump fluid +minetest.register_node("owl_tech:decor_bronze_pipe",{ + description = "Decor fluid pipe ", + _tt_help = S("Safe for decor"), + tiles = {"(owl_tech_base_fluid_pipe.png^[colorize:#a35900:128)"}, + paramtype = "light", + is_ground_content = false, + stack_max = 64, + drop ="", + sunlight_propagates = true, + walkable = true, + groups = {owl_tech_decor_fluid_pipe=1}, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {-0.125,-0.125,-0.125,0.125,0.125,0.125} , + connect_top = {-0.125,-0.125,-0.125,0.125,0.5,0.125} , + connect_bottom = {-0.125,-0.5,-0.125,0.125,0.125,0.125} , + connect_front = {-0.125,-0.125,-0.5,0.125,0.125,0.125} , + connect_left = {-0.5,-0.125,-0.125,0.125,0.125,0.125} , + connect_back = {-0.125,-0.125,-0.125,0.125,0.125,0.5} , + connect_right = {-0.125,-0.125,-0.125,0.5,0.125,0.125} , + }, + connects_to = {"group:owl_tech_decor_fluid_pipe","group:owl_tech_machine"}, + sounds = mcl_sounds.node_sound_wool_defaults(), + _mcl_hardness = 0.1, + _mcl_blast_resistance = 0.1, +}) +--bronze_pump" +minetest.register_node("owl_tech:bronze_pump", { + description = S("Bronze pump"), + _doc_items_longdesc = S("Pump fluid"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_base_pump.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_base_pump.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_base_pump.png", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_base_pump.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,8000,1,0) --steam eat 25 steam in 1 tick + owl_tech.add_new_pull(meta,8000,0,1) + owl_tech.set_pull_fluid_whitlist(meta,1,"owl_tech_steam")--whitlist for make and output ONLY Steam + owl_tech.set_mashine_tire(meta,1) --all steam mashine has 1 tire + owl_tech.prepear_for_pump(meta,2) + set_formspect_base_pump(meta) + owl_tech.update_fluid_pipe_around(pos) + local timer =minetest.get_node_timer(pos) + timer:start(0.2) + end, + on_timer = function(pos, elapsed) + local timer = minetest.get_node_timer(pos) + local meta = minetest.get_meta(pos) + --gete fluid down air mcl_core:lava_source mclx_core:water_source mcl_core:water_source + local new_pos = { + x=pos.x+owl_tech.get_x_pump(meta), + y=pos.y+owl_tech.get_y_pump(meta), + z=pos.z+owl_tech.get_z_pump(meta) + }if owl_tech.get_pull_volume(meta,1)>100 then + if minetest.get_node({x=pos.x,y=pos.y+owl_tech.get_y_pump(meta),z=pos.z}).name=="air" and + not owl_tech.finde_fluid_on_level(meta,pos) then -- place decor pipe + minetest.set_node({x=pos.x,y=pos.y+owl_tech.get_y_pump(meta),z=pos.z},{name="owl_tech:decor_bronze_pipe"}) + owl_tech.reset_x_pump(meta) + owl_tech.reset_z_pump(meta) + owl_tech.add_y_pump(meta) + end + --minetest.chat_send_all(minetest.get_node(new_pos).name) + if (minetest.get_node(new_pos).name)=="mclx_core:river_water_source" or (minetest.get_node(new_pos).name)=="mcl_core:water_source" or (minetest.get_node(new_pos).name)=="mcl_core:lava_source" then + if (owl_tech.get_pull_fluid_name(meta,2)=='none' or owl_tech.get_pull_fluid_name(meta,2)=='mcl_core:water_source' or owl_tech.get_pull_fluid_name(meta,2)=='mclx_core:river_water_source' or (minetest.get_node(new_pos).name)=="mcl_core:lava_source") + and owl_tech.get_pull_max_volume(meta,2)-owl_tech.get_pull_volume(meta,2)>=1000 then + owl_tech.add_fluid_in_node_pull(meta,minetest.get_node(new_pos).name,1000,2) + owl_tech.set_pull_volume(meta,1, owl_tech.get_pull_volume(meta,1)-100) + minetest.set_node(new_pos,{name="air"}) + end + end + owl_tech.pos_pumping_update(meta) + owl_tech.add_x_pump(meta) + end + -- + 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 can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,"owl_tech_steam",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,"owl_tech_steam",owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,"owl_tech_steam",remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + 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,2) + 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,2) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + 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,2) + 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,2) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + 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,2) + 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,2) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + 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,2) + 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,2) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + owl_tech.delit_name_fluid_if_0(meta) + set_formspect_base_pump(meta) + timer:start(0.2) + end +}) \ No newline at end of file diff --git a/pipe/fluid_tank.lua b/pipe/fluid_tank.lua new file mode 100755 index 0000000..18e2c12 --- /dev/null +++ b/pipe/fluid_tank.lua @@ -0,0 +1,62 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +minetest.register_node("owl_tech:bronze_tank", { + description = S("Bronze tank"), + _doc_items_longdesc = S("Tank fluid"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_tank_side.png^[colorize:#a35900:128)", + "(owl_tech_base_tank_side.png^[colorize:#a35900:128)", + "(owl_tech_base_tank_side.png^[colorize:#a35900:128)", + "(owl_tech_base_tank_side.png^[colorize:#a35900:128)", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,16000,1,1) + owl_tech.set_mashine_tire(meta,1) + owl_tech.update_fluid_pipe_around(pos) + owl_tech.set_fluid_sand_in_tick(meta,60) + local timer =minetest.get_node_timer(pos) + meta:set_string("infotext",owl_tech.get_pull_volume(meta,1)) + timer:start(0.2) + end, + on_timer = function(pos, elapsed) + local timer = minetest.get_node_timer(pos) + local meta = minetest.get_meta(pos) + 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) + 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 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"fluid_pipe") then --sand in pipe + 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,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 + owl_tech.delit_name_fluid_if_0(meta) + meta:set_string("infotext",owl_tech.get_pull_volume(meta,1)) + timer:start(0.2) + end +}) \ No newline at end of file diff --git a/pipe/init.lua b/pipe/init.lua new file mode 100755 index 0000000..10c56c7 --- /dev/null +++ b/pipe/init.lua @@ -0,0 +1,8 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +dofile(minetest.get_modpath("owl_tech") .. "/pipe/fluid_pipe.lua") --fluid pipe logick +dofile(minetest.get_modpath("owl_tech") .. "/pipe/fluid_pump.lua") --fluid pump logick +dofile(minetest.get_modpath("owl_tech") .. "/pipe/fluid_tank.lua") --fluid tank logick +dofile(minetest.get_modpath("owl_tech") .. "/pipe/item_pipe.lua") --item pipe logick \ No newline at end of file diff --git a/pipe/item_pipe.lua b/pipe/item_pipe.lua new file mode 100755 index 0000000..b619ba5 --- /dev/null +++ b/pipe/item_pipe.lua @@ -0,0 +1,169 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +minetest.register_node("owl_tech:iron_item_pipe_input",{ + description = "Item input pipe tire 1", + _tt_help = S("Input items in pipe systems"), + _doc_items_longdesc = S("Use for input items in pipe "), + _doc_items_usagehelp = S("Put it in the world to start pulling items from inventory."), + tiles = {"owl_tech_base_fluid_pipe.png^[colorize:#0066ff:128"}, + paramtype = "light", + is_ground_content = false, + stack_max = 64, + sunlight_propagates = true, + walkable = true, + groups = {owl_tech_item_pipe=1}, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {-0.125,-0.125,-0.125,0.125,0.125,0.125} , + connect_top = {-0.125,-0.125,-0.125,0.125,0.5,0.125} , + connect_bottom = {-0.125,-0.5,-0.125,0.125,0.125,0.125} , + connect_front = {-0.125,-0.125,-0.5,0.125,0.125,0.125} , + connect_left = {-0.5,-0.125,-0.125,0.125,0.125,0.125} , + connect_back = {-0.125,-0.125,-0.125,0.125,0.125,0.5} , + connect_right = {-0.125,-0.125,-0.125,0.5,0.125,0.125} , + }, + connects_to = {"group:owl_tech_item_pipe","group:owl_tech_generator","group:owl_tech_machine","mcl_chests:chest_small"}, + sounds = mcl_sounds.node_sound_wool_defaults(), + _mcl_hardness = 0.1, + _mcl_blast_resistance = 0.1, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv= meta:get_inventory() + local itemstack = inv:get_stack("pipe_inv", 1) + owl_tech.set_item_pipe_logick(meta) + local info_set =("empty") + if not itemstack:is_empty() then + info_set = (itemstack:get_name().."-"..itemstack:get_count()) + end + meta:set_string("infotext", info_set) + local timer =minetest.get_node_timer(pos) + timer:start(0.2) + end, + on_timer = function (pos, elapsed) + local meta = minetest.get_meta(pos) + local inv= meta:get_inventory() + local itemstack = inv:get_stack("pipe_inv", 1) + local timer =minetest.get_node_timer(pos) + owl_tech.finde_pipe_and_send_item(pos) + local info_set =("empty") + if not itemstack:is_empty() then + info_set = (itemstack:get_name().."-"..itemstack:get_count()) + end + owl_tech.finde_inventory_slot_for_removing_item_around(pos) + meta:set_string("infotext", info_set) + timer:start(0.2) + end +}) + +minetest.register_node("owl_tech:iron_item_pipe",{ + description = "Item pipe tire 1", + _tt_help = S("Transport items"), + _doc_items_longdesc = S("Fence gates can be opened or closed and can't be jumped over. Fences will connect nicely to fence gates."), + _doc_items_usagehelp = S("Put it in the world to let objects move through it."), + tiles = {"owl_tech_base_fluid_pipe.png"}, + paramtype = "light", + is_ground_content = false, + stack_max = 64, + sunlight_propagates = true, + walkable = true, + groups = {owl_tech_item_pipe=1,owl_tech_can_pipe_output=1}, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {-0.125,-0.125,-0.125,0.125,0.125,0.125} , + connect_top = {-0.125,-0.125,-0.125,0.125,0.5,0.125} , + connect_bottom = {-0.125,-0.5,-0.125,0.125,0.125,0.125} , + connect_front = {-0.125,-0.125,-0.5,0.125,0.125,0.125} , + connect_left = {-0.5,-0.125,-0.125,0.125,0.125,0.125} , + connect_back = {-0.125,-0.125,-0.125,0.125,0.125,0.5} , + connect_right = {-0.125,-0.125,-0.125,0.5,0.125,0.125} , + }, + connects_to = {"group:owl_tech_item_pipe","group:owl_tech_generator","group:owl_tech_machine"}, + sounds = mcl_sounds.node_sound_wool_defaults(), + _mcl_hardness = 0.1, + _mcl_blast_resistance = 0.1, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv= meta:get_inventory() + local itemstack = inv:get_stack("pipe_inv", 1) + owl_tech.set_item_pipe_logick(meta) + local info_set =("empty") + if not itemstack:is_empty() then + info_set = (itemstack:get_name().."-"..itemstack:get_count()) + end + meta:set_string("infotext", info_set) + local timer =minetest.get_node_timer(pos) + timer:start(0.2) + end, + on_timer = function (pos, elapsed) + local meta = minetest.get_meta(pos) + local inv= meta:get_inventory() + local itemstack = inv:get_stack("pipe_inv", 1) + local timer =minetest.get_node_timer(pos) + owl_tech.finde_pipe_and_send_item(pos) + local info_set =("empty") + if not itemstack:is_empty() then + info_set = (itemstack:get_name().."-"..itemstack:get_count()) + end + meta:set_string("infotext", info_set) + timer:start(0.01) + end +}) + +minetest.register_node("owl_tech:iron_item_pipe_output",{ + description = "Item pipe tire 1 output", + _tt_help = S("Move item from pipe to invenotry"), + _doc_items_longdesc = S("Fence gates can be opened or closed and can't be jumped over. Fences will connect nicely to fence gates."), + _doc_items_usagehelp = S("Put it in the world to put the item in inventory."), + tiles = {"owl_tech_base_fluid_pipe.png^[colorize:#ff3300:128"}, + paramtype = "light", + is_ground_content = false, + stack_max = 64, + sunlight_propagates = true, + walkable = true, + groups = {owl_tech_item_pipe=1,owl_tech_can_pipe_output=1}, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {-0.125,-0.125,-0.125,0.125,0.125,0.125} , + connect_top = {-0.125,-0.125,-0.125,0.125,0.5,0.125} , + connect_bottom = {-0.125,-0.5,-0.125,0.125,0.125,0.125} , + connect_front = {-0.125,-0.125,-0.5,0.125,0.125,0.125} , + connect_left = {-0.5,-0.125,-0.125,0.125,0.125,0.125} , + connect_back = {-0.125,-0.125,-0.125,0.125,0.125,0.5} , + connect_right = {-0.125,-0.125,-0.125,0.5,0.125,0.125} , + }, + connects_to = {"group:owl_tech_item_pipe","group:owl_tech_generator","group:owl_tech_machine"}, + sounds = mcl_sounds.node_sound_wool_defaults(), + _mcl_hardness = 0.1, + _mcl_blast_resistance = 0.1, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv= meta:get_inventory() + local itemstack = inv:get_stack("pipe_inv", 1) + owl_tech.set_item_pipe_logick(meta) + local info_set =("empty") + if not itemstack:is_empty() then + info_set = (itemstack:get_name().."-"..itemstack:get_count()) + end + meta:set_string("infotext", info_set) + local timer =minetest.get_node_timer(pos) + timer:start(0.2) + end, + on_timer = function (pos, elapsed) + local meta = minetest.get_meta(pos) + local inv= meta:get_inventory() + local itemstack = inv:get_stack("pipe_inv", 1) + local timer =minetest.get_node_timer(pos) + owl_tech.send_item_in_inventory(pos) + local info_set =("empty") + if not itemstack:is_empty() then + info_set = (itemstack:get_name().."-"..itemstack:get_count()) + end + meta:set_string("infotext", info_set) + timer:start(0.2) + end +}) \ No newline at end of file diff --git a/steam/init.lua b/steam/init.lua new file mode 100755 index 0000000..69b296a --- /dev/null +++ b/steam/init.lua @@ -0,0 +1,6 @@ +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) + +dofile(minetest.get_modpath("owl_tech") .. "/steam/small_steam_boiler.lua") --ore loads +dofile(minetest.get_modpath("owl_tech") .."/steam/steam_gen_logick.lua") --logick for steam gen \ No newline at end of file diff --git a/steam/small_steam_boiler.lua b/steam/small_steam_boiler.lua new file mode 100755 index 0000000..b894a35 --- /dev/null +++ b/steam/small_steam_boiler.lua @@ -0,0 +1,119 @@ +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_base_boiler(meta) + local fluid_1_name = owl_tech.get_pull_fluid_name(meta,1) + local fluid_2_name = owl_tech.get_pull_fluid_name(meta,2) + local fluid_1_volume = owl_tech.get_pull_volume(meta,1) + local fluid_2_volume = owl_tech.get_pull_volume(meta,2) + local heat = owl_tech.get_curent_heat(meta) + local max_heat = owl_tech.get_max_heat(meta) + local fuel_burn =owl_tech.get_fuel_time(meta) + 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("Boiler"))).."]".. + "list[context;fluid_in;2.5,2.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,2.5,1,1).. + "list[context;fuel;2.5,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.5,1.5,1,1).. + "list[context;dst;5.75,1.5;1,1;]".. + mcl_formspec.get_itemslot_bg(5.75,1.5,1,1).. + "label[0,0.5;"..minetest.formspec_escape(minetest.colorize("#313131", ("Heat-"..heat.."--"..max_heat))).."]".. + "label[0,1;"..minetest.formspec_escape(minetest.colorize("#313131", ("Fuel brun-"..fuel_burn))).."]".. + "label[0,1.5;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_1_name.."--"..fluid_1_volume))).."]".. + "label[0,2;"..minetest.formspec_escape(minetest.colorize("#313131", (fluid_2_name.."--"..fluid_2_volume))).."]".. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[context;fluid_in]".. + "listring[current_player;main]".. + "listring[context;fuel]".. + "listring[current_player;main]" + meta:set_string("formspec", formspec) +end + + +minetest.register_node("owl_tech:bronze_boiler", { + description = S("Bronze boiler"), + _doc_items_longdesc = S("First wey generate steam"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_steam_output.png", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "owl_tech_base_meshanism_side.png^[colorize:#a35900:128", + "(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_boiler_face.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_generator=1 ,fluid_in=1,fuel=1,dst=1 }, + sounds = mcl_sounds.node_sound_metal_defaults(), + paramtype2 = "facedir", + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + owl_tech.add_new_pull(meta,8000,1,0) --water + owl_tech.set_pull_fluid_whitlist(meta,1,"mcl_water") --whitlist for make input ONLY Water + owl_tech.add_new_pull(meta,8000,0,1) --steam + owl_tech.set_pull_fluid_whitlist(meta,2,"owl_tech_steam")--whitlist for make and output ONLY Steam + set_formspect_base_boiler(meta) + owl_tech.prepear_for_make_steam(meta,256,0.5,1,0.25) --prepea al meta info for work like boiler + owl_tech.update_fluid_pipe_around(pos) + local timer =minetest.get_node_timer(pos) + local inv = meta:get_inventory() + inv:set_size("fluid_in", 1) + inv:set_size("fuel", 1) + inv:set_size("dst", 1) + 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 fluid_its = inv:get_stack('fluid_in', 1) + local fuel_its = inv:get_stack('fuel', 1) + local dst_its = inv:get_stack('dst', 1) + if not fluid_its:is_empty() then --Load fluid from buckets + owl_tech.add_fluid_in_pull_from_itemslot(meta,fluid_its,inv,dst_its,'fluid_in','dst') + end + if owl_tech.get_fuel_time(meta)>0 then --burn process + owl_tech.fuel_burning(meta) + end + if owl_tech.get_curent_heat(meta)>0 and owl_tech.get_fuel_time(meta)==0 then --coling boiler if not burn + owl_tech.cooling_boiler(meta) + end + if owl_tech.get_curent_heat(meta)>100 + and owl_tech.get_pull_volume(meta,2)+owl_tech.get_water_in_steam(meta)*5<=owl_tech.get_pull_max_volume(meta,2) + and owl_tech.get_pull_volume(meta,1)-owl_tech.get_water_in_steam(meta)>=0 then --make steam + owl_tech.gen_steam_in_node_pull(meta,1,2,owl_tech.get_water_in_steam(meta)) + if owl_tech.get_pull_fluid_name(meta,2)~="owl_tech_steam" then + owl_tech.set_pull_fluid_name(meta,2,"owl_tech_steam") + end + end + if not fuel_its:is_empty() and owl_tech.get_fuel_time(meta)==0 then --Load fluid from buckets + local out_fuel= minetest.get_craft_result({method = "fuel", width = 1, items = {fuel_its}}) + if out_fuel.time>0 then + owl_tech.load_fuel_in_boiler(meta,inv,'fuel',out_fuel,fuel_its) + end + end + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})).name,"fluid_pipe") then --sand in pipe + local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z}) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,"owl_tech_steam",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,"owl_tech_steam",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,"owl_tech_steam",remove_amount,inde_pull) + local pull_curent_volume = owl_tech.get_pull_volume(meta,2) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + owl_tech.delit_name_fluid_if_0(meta) + set_formspect_base_boiler(meta) + timer:start(0.2) + end +}) diff --git a/steam/steam_gen_logick.lua b/steam/steam_gen_logick.lua new file mode 100755 index 0000000..aed1aaa --- /dev/null +++ b/steam/steam_gen_logick.lua @@ -0,0 +1,101 @@ +--Setter and getter max_heat (USE UNT!) +function owl_tech.get_max_heat(meta) + return meta:get_float("max_heat") + end + +function owl_tech.set_max_heat(meta,new_amount) + meta:set_float("max_heat",new_amount) + return owl_tech.get_max_heat(meta) +end + ------------------------------ + --Setter and getter curent_heat (USE UNT!) +function owl_tech.get_curent_heat(meta) + return meta:get_float("curent_heat") + end + +function owl_tech.set_curent_heat(meta,new_amount) + meta:set_float("curent_heat",new_amount) + return owl_tech.get_curent_heat(meta) +end + ------------------------------ + --Setter and getter speed_heat(USE UNT!) +function owl_tech.get_speed_heat(meta) + return meta:get_float("speed_heat") + end + +function owl_tech.set_speed_heat(meta,new_amount) + meta:set_float("speed_heat",new_amount) + return owl_tech.get_speed_heat(meta) +end + ------------------------------ + --Setter and getter fuel_time(USE UNT!) +function owl_tech.get_fuel_time(meta) + return meta:get_float("fuel_time") +end + +function owl_tech.set_fuel_time(meta,new_amount) + meta:set_float("fuel_time",new_amount) + return owl_tech.get_fuel_time(meta) +end +------------------------------ +--Setter and getter fuel consumption(USE UNT!) +function owl_tech.get_fuel_consumption(meta) + return meta:get_float("fuel_consumption") +end + +function owl_tech.set_fuel_consumption(meta,new_amount) + meta:set_float("fuel_consumption",new_amount) + return owl_tech.get_fuel_consumption(meta) +end + ------------------------------ + --Water in steam in 1 time +function owl_tech.get_water_in_steam(meta) + return meta:get_float("water_in_steam") +end + +function owl_tech.set_water_in_steam(meta,new_amount) + meta:set_float("water_in_steam",new_amount) + return owl_tech.get_water_in_steam(meta) +end + ------------------------------ +--Prepea mashine for make steam --call ONLY in on_construct = function(pos) +function owl_tech.prepear_for_make_steam(meta,max_heat,heat_speed,fuel_consumption,water_in_steam) + owl_tech.set_max_heat(meta,max_heat) + owl_tech.set_curent_heat(meta,0) + owl_tech.set_speed_heat(meta,heat_speed) + owl_tech.set_fuel_time(meta,0) + owl_tech.set_fuel_consumption(meta,fuel_consumption) + owl_tech.set_water_in_steam(meta,water_in_steam) +end +---------------------------------------------- +--load fuel from slot +function owl_tech.load_fuel_in_boiler(meta,inv,slot_name,out_fuel,fuel_its) + local fuel_time=out_fuel.time + local bon= math.modf(owl_tech.get_curent_heat(meta)/5) + owl_tech.set_fuel_time(meta,(bon+fuel_time)*10) + fuel_its:set_count(fuel_its:get_count()-1) + inv:set_stack(slot_name, 1, fuel_its) +end +---------------------------------------------- +--Fuel burn +function owl_tech.fuel_burning(meta) + owl_tech.set_fuel_time(meta,owl_tech.get_fuel_time(meta)-owl_tech.get_fuel_consumption(meta))--remove fuel + if owl_tech.get_curent_heat(meta)