diff --git a/api/item_logick.lua b/api/item_logick.lua index e689046..40ed016 100755 --- a/api/item_logick.lua +++ b/api/item_logick.lua @@ -145,18 +145,31 @@ function owl_tech.send_item_in_inventory(pos) or minetest.get_node(mass_pos[i]).name=="mcl_chests:trapped_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 + for j, value1 in pairs(INPUT_SLOT_NAME) do + if minetest.get_item_group((minetest.get_node(mass_pos[i])).name,INPUT_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 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 + if not inv:is_empty("pipe_inv") and inv_sourc:is_empty(INPUT_SLOT_NAME[j]) then + if inv_sourc:room_for_item(INPUT_SLOT_NAME[j], inv:get_stack("pipe_inv", 1)) and meta:get_int("has_filte")==0 then-- no filters + inv_sourc:add_item(INPUT_SLOT_NAME[j], 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/debug_tools/init.lua b/debug_tools/init.lua index ffe6e75..6894d45 100755 --- a/debug_tools/init.lua +++ b/debug_tools/init.lua @@ -32,7 +32,6 @@ minetest.register_craftitem("owl_tech:stick_of_truef", { 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/mashins/electro_machins.lua b/mashins/electro_machins.lua index 418941d..d77d55f 100644 --- a/mashins/electro_machins.lua +++ b/mashins/electro_machins.lua @@ -267,7 +267,7 @@ for i = 1, #table_all_machines, 1 do owl_tech.reset_item_redines(meta) end elseif recipt_true and 100/SMELTER_RECIPS[name][6]*12<=owl_tech:get_charge(meta) 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 amount=owl_tech.calculate_recipe_tire_bonus(meta,SMELTER_RECIPS[name][5],SMELTER_RECIPS[name][6]) meta:set_int("eat_in_tick",((100/SMELTER_RECIPS[name][6]*12)/(100/amount))) meta:set_int("bonus",amount) local steam_new =owl_tech:get_charge(meta)-meta:get_int("eat_in_tick") diff --git a/mod.conf b/mod.conf index 5912516..218138e 100755 --- a/mod.conf +++ b/mod.conf @@ -1,6 +1,6 @@ name = owl_tech author = ConfidentOwl -depends = mcl_core +depends = mcl_core,mcl_buckets,mcl_util description = Big tech mod diff --git a/multiblocks/help_node.lua b/multiblocks/help_node.lua index 24f1ddf..8c20200 100644 --- a/multiblocks/help_node.lua +++ b/multiblocks/help_node.lua @@ -3,20 +3,20 @@ local name = minetest.get_current_modname() local path = minetest.get_modpath(name) local energy_hatch_table ={ - {"base","Base",32,16000,"#575757","owl_tech:copper_electro_wire","steel"} + {"base","Base",32,16000,"#575757","owl_tech:copper_electro_wire","steel","owl_tech:bronze_fluid_pipe"} } for i, value in ipairs(energy_hatch_table) do - - minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."energy_hatch_input", { + --input electro hatch + minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."_energy_hatch_input", { description = S(energy_hatch_table[i][2].."energy hatch input"), _doc_items_longdesc = S("Contein energy for multinode"), tiles = { "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", "owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_input.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_base_battary_side.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_base_battary_side.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_base_battary_side.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_input.png", }, is_ground_content = false, stack_max = 64, @@ -38,7 +38,7 @@ for i, value in ipairs(energy_hatch_table) do local timer = minetest.get_node_timer(pos) local meta = minetest.get_meta(pos) local rotation = minetest.get_node(pos).param2 % 32 - if owl_tech.get_active_hatch(meta)==1 then + if owl_tech:get_active_hatch(meta)==1 then if rotation==0 then --z-1 if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"owl_tech_electro_wire")>0 and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro @@ -83,28 +83,28 @@ for i, value in ipairs(energy_hatch_table) do --Crafte minetest.register_craft({ type = "shaped", - output = "owl_tech:"..energy_hatch_table[i][1].."energy_hatch_input", + output = "owl_tech:"..energy_hatch_table[i][1].."_energy_hatch_input", recipe = { {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"}, {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"}, {"owl_tech:"..energy_hatch_table[i][7].."_plate",energy_hatch_table[i][6],"owl_tech:"..energy_hatch_table[i][7].."_plate"} } }) - - minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."energy_hatch_output", { + --output electro hatch + minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."_energy_hatch_output", { description = S(energy_hatch_table[i][2].."energy hatch output"), _doc_items_longdesc = S("Contein energy for multinode"), tiles = { "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", "owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", - "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_output.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_base_battary_side.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_base_battary_side.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_base_battary_side.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_output.png", }, is_ground_content = false, stack_max = 64, - groups = {pickaxey=2, owl_tech_machine=1,energy_hatch_1_input=1}, + groups = {pickaxey=2, owl_tech_machine=1,energy_hatch_1_output=1}, sounds = mcl_sounds.node_sound_metal_defaults(), paramtype2 = "facedir", _mcl_blast_resistance = 6, @@ -122,7 +122,7 @@ for i, value in ipairs(energy_hatch_table) do local timer = minetest.get_node_timer(pos) local meta = minetest.get_meta(pos) local rotation = minetest.get_node(pos).param2 % 32 - if owl_tech.get_active_hatch(meta)==1 then + if owl_tech:get_active_hatch(meta)==1 then if rotation==0 then --z-1 if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"owl_tech_electro_wire") then --send electro in wire local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) @@ -175,11 +175,332 @@ for i, value in ipairs(energy_hatch_table) do --Crafte minetest.register_craft({ type = "shaped", - output = "owl_tech:"..energy_hatch_table[i][1].."energy_hatch_input", + output = "owl_tech:"..energy_hatch_table[i][1].."_energy_hatch_output", recipe = { {"owl_tech:"..energy_hatch_table[i][7].."_plate",energy_hatch_table[i][6],"owl_tech:"..energy_hatch_table[i][7].."_plate"}, {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"}, {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"} } }) + --input item + minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."_item_hatch_input", { + description = S(energy_hatch_table[i][2].."item hatch input"), + _doc_items_longdesc = S("Contein item for multinode"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_item_hatch.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_item_hatch.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_item_hatch.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_input.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,item_hatch_1_input=1,input_in=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.set_mashine_tire(meta,i+1) + owl_tech:set_active_hatch(meta,0) + local inv = meta:get_inventory() + inv:set_size("input_in", 1) + local timer =minetest.get_node_timer(pos) + local text_info ="empty" + local input_stack = inv:get_stack("input_in", 1) + if not input_stack:is_empty() then + text_info = input_stack:get_count().."--"..input_stack:get_name() + end + meta:set_string("infotext",text_info) + 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_stack = inv:get_stack("input_in", 1) + local rotation = minetest.get_node(pos).param2 % 32 + local text_info ="empty" + if not input_stack:is_empty() then + text_info = input_stack:get_count().."--"..input_stack:get_name() + end + meta:set_string("infotext",text_info) + timer:start(0.2) + end + }) + --Crafte + minetest.register_craft({ + type = "shaped", + output = "owl_tech:"..energy_hatch_table[i][1].."_item_hatch_input", + recipe = { + {"owl_tech:"..energy_hatch_table[i][7].."_plate",energy_hatch_table[i][6],"owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate","mcl_chests:chest","owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate","mcl_chests:chest","owl_tech:"..energy_hatch_table[i][7].."_plate"} + } + }) + --output item + minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."_item_hatch_output", { + description = S(energy_hatch_table[i][2].."item hatch output"), + _doc_items_longdesc = S("Contein item for multinode"), + tiles = { + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_item_hatch.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_item_hatch.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_item_hatch.png", + "(owl_tech_base_meshanism_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_output.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,item_hatch_1_output=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.set_mashine_tire(meta,i+1) + owl_tech:set_active_hatch(meta,0) + local inv = meta:get_inventory() + inv:set_size("dst", 1) + local timer =minetest.get_node_timer(pos) + local text_info ="empty" + local input_stack = inv:get_stack("dst", 1) + if not input_stack:is_empty() then + text_info = input_stack:get_count().."--"..input_stack:get_name() + end + meta:set_string("infotext",text_info) + 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_stack = inv:get_stack("dst", 1) + local text_info ="empty" + if not input_stack:is_empty() then + text_info = input_stack:get_count().."--"..input_stack:get_name() + end + meta:set_string("infotext",text_info) + timer:start(0.2) + end + }) + --Crafte + minetest.register_craft({ + type = "shaped", + output = "owl_tech:"..energy_hatch_table[i][1].."_item_hatch_output", + recipe = { + {"owl_tech:"..energy_hatch_table[i][7].."_plate","mcl_chests:chest","owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate","mcl_chests:chest","owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate",energy_hatch_table[i][6],"owl_tech:"..energy_hatch_table[i][7].."_plate"} + } + }) + --input fluid hatch + minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."_fluid_hatch_input", { + description = S(energy_hatch_table[i][2].."fluid hatch input"), + _doc_items_longdesc = S("Contein fluid for multinode"), + tiles = { + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_input.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,fluid_hatch_1_input=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,(energy_hatch_table[i][4]*2),1,1) + owl_tech.set_mashine_tire(meta,i+1) + owl_tech:set_active_hatch(meta,0) + owl_tech.update_fluid_pipe_around(pos) + owl_tech.set_fluid_sand_in_tick(meta,(energy_hatch_table[i][3]*2)) + 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) + local rotation = minetest.get_node(pos).param2 % 32 + if owl_tech:get_active_hatch(meta)==1 then + if rotation==0 then --z-1 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"fluid_pipe") then --get from pipe + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,fluid_name_to_send,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + end + if rotation==2 then --z+1 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})).name,"fluid_pipe") then --get from pipe + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,fluid_name_to_send,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + end + if rotation==3 then --x-1 + if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --get from pipe + local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,fluid_name_to_send,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + end + if rotation==1 then --x+1 + if minetest.get_item_group((minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --get from pipe + local meta_up = minetest.get_meta({x=pos.x+1,y=pos.y,z=pos.z}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta_up,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta,fluid_name_to_send,remove_amount,inde_pull) + owl_tech.remove_fluid_in_node_pull(meta_up,remove_amount,inde_pull) + end + end + end + end + owl_tech.delit_name_fluid_if_0(meta) + meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) + timer:start(0.2) + end + }) + --Crafte + minetest.register_craft({ + type = "shaped", + output = "owl_tech:"..energy_hatch_table[i][1].."_fluid_hatch_input", + recipe = { + {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate",energy_hatch_table[i][8],"owl_tech:"..energy_hatch_table[i][7].."_plate"} + } + }) + --output fluid hatch + minetest.register_node("owl_tech:"..energy_hatch_table[i][1].."_fluid_hatch_output", { + description = S(energy_hatch_table[i][2].."fluid hatch output"), + _doc_items_longdesc = S("Contein fluid for multinode"), + tiles = { + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)", + "(owl_tech_base_tank_side.png^[colorize:"..energy_hatch_table[i][5]..":128)^owl_tech_steam_output.png", + }, + is_ground_content = false, + stack_max = 64, + groups = {pickaxey=2, owl_tech_machine=1,fluid_hatch_1_output=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,(energy_hatch_table[i][4]*2),1,1) + owl_tech.set_mashine_tire(meta,i+1) + owl_tech:set_active_hatch(meta,0) + owl_tech.update_fluid_pipe_around(pos) + owl_tech.set_fluid_sand_in_tick(meta,(energy_hatch_table[i][3]*2)) + 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) + local rotation = minetest.get_node(pos).param2 % 32 + if owl_tech:get_active_hatch(meta)==1 then + if rotation==0 then --z-1 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})).name,"fluid_pipe") then --sand in pipe + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z-1}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,fluid_name_to_send,remove_amount,inde_pull) + local pull_curent_volume = owl_tech.get_pull_volume(meta,1) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + end + if rotation==2 then --z+1 + if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})).name,"fluid_pipe") then --sand in pipe + local meta_up = minetest.get_meta({x=pos.x,y=pos.y,z=pos.z+1}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,fluid_name_to_send,remove_amount,inde_pull) + local pull_curent_volume = owl_tech.get_pull_volume(meta,1) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + end + if rotation==3 then --x-1 + if minetest.get_item_group((minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --sand in pipe + local meta_up = minetest.get_meta({x=pos.x-1,y=pos.y,z=pos.z}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,fluid_name_to_send,remove_amount,inde_pull) + local pull_curent_volume = owl_tech.get_pull_volume(meta,1) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + end + if rotation==1 then --x+1 + if minetest.get_item_group((minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})).name,"fluid_pipe") then --sand in pipe + local meta_up = minetest.get_meta({x=pos.x+1,y=pos.y,z=pos.z}) + local fluid_name_to_send = owl_tech.get_pull_fluid_name(meta,1) + local can_do ,inde_pull =owl_tech.test_add_fluid_in_any_pulls(meta_up,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + local can_do2 ,inde_pull_2 , remove_amount =owl_tech.test_remove_fluid_in_any_pulls(meta,fluid_name_to_send,owl_tech.get_fluid_sand_in_tick(meta_up)) + if can_do and can_do2 then + owl_tech.add_fluid_in_node_pull(meta_up,fluid_name_to_send,remove_amount,inde_pull) + local pull_curent_volume = owl_tech.get_pull_volume(meta,1) + local difer = pull_curent_volume-remove_amount + owl_tech.set_pull_volume(meta,2,difer) + end + end + end + end + owl_tech.delit_name_fluid_if_0(meta) + meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) + timer:start(0.2) + end + }) + --Crafte + minetest.register_craft({ + type = "shaped", + output = "owl_tech:"..energy_hatch_table[i][1].."_fluid_hatch_output", + recipe = { + {"owl_tech:"..energy_hatch_table[i][7].."_plate",energy_hatch_table[i][8],"owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"}, + {"owl_tech:"..energy_hatch_table[i][7].."_plate","owl_tech:batteri_tire_"..i,"owl_tech:"..energy_hatch_table[i][7].."_plate"} + } + }) end \ No newline at end of file diff --git a/multiblocks/multiblock_api.lua b/multiblocks/multiblock_api.lua index c42946a..0b68218 100644 --- a/multiblocks/multiblock_api.lua +++ b/multiblocks/multiblock_api.lua @@ -10,4 +10,112 @@ end function owl_tech:get_active_hatch(meta) return meta:get_int("activ_hatch") end -------------------------------------------------------- \ No newline at end of file +------------------------------------------------------- +--get and set enrgy hatch pos ofset (energy_hatch,item_hatch,fluid_hatch) +function owl_tech:set_hatch_ofset(meta,number_hatch,hatch_name,x,y,z) + meta:set_int("X"..number_hatch..hatch_name,x) + meta:set_int("Y"..number_hatch..hatch_name,y) + meta:set_int("Z"..number_hatch..hatch_name,z) +end +function owl_tech:get_hatch_ofset_X(meta,number_hatch,hatch_name) + return meta:get_int("X"..number_hatch..hatch_name) +end +function owl_tech:get_hatch_ofset_Y(meta,number_hatch,hatch_name) + return meta:get_int("Y"..number_hatch..hatch_name) +end +function owl_tech:get_hatch_ofset_Z(meta,number_hatch,hatch_name) + return meta:get_int("Z"..number_hatch..hatch_name) +end +------------------------------------------------------- +--set amount hatchs +function owl_tech:set_amount_energy_hatch(meta,amount) + meta:set_int("amount_energy_hatch",amount) +end +function owl_tech:get_amount_energy_hatch(meta) + return meta:get_int("amount_energy_hatch") +end +function owl_tech:set_amount_fluid_hatch(meta,amount) + meta:set_int("amount_fluid_hatch",amount) +end +function owl_tech:get_amount_fluid_hatch(meta) + return meta:get_int("amount_fluid_hatch") +end +function owl_tech:set_amount_item_hatch(meta,amount) + meta:set_int("amount_item_hatch",amount) +end +function owl_tech:get_amount_item_hatch(meta) + return meta:get_int("amount_item_hatch") +end +------------------------------------------------------ +--get and set item in hatch +function owl_tech:get_item_in_input_hatch_pos(x,y,z) + local meta = minetest.get_meta({x=x,y=y,z=z}) + local inv = meta:get_inventory() + local input_stack = inv:get_stack("input_in", 1) + return input_stack +end +function owl_tech:set_item_in_input_hatch_pos(x,y,z,item_stack) + local meta = minetest.get_meta({x=x,y=y,z=z}) + local inv = meta:get_inventory() + inv:set_stack("input_in", 1 ,item_stack) +end +function owl_tech:get_item_in_input_output_pos(x,y,z) + local meta = minetest.get_meta({x=x,y=y,z=z}) + local inv = meta:get_inventory() + local input_stack = inv:get_stack("dst", 1) + return input_stack +end +function owl_tech:set_item_in_input_output_pos(x,y,z,item_stack) + local meta = minetest.get_meta({x=x,y=y,z=z}) + local inv = meta:get_inventory() + inv:set_stack("dst", 1 ,item_stack) +end +------------------------------------------------------ +--get and set energy in hatch +function owl_tech:get_charge_in_hatch_pos(x,y,z) + return owl_tech:get_charge(minetest.get_meta({x=x,y=y,z=z})) +end +function owl_tech:set_charge_in_hatch_pos(x,y,z,energy) + owl_tech:set_charge(minetest.get_meta({x=x,y=y,z=z}),energy) +end +------------------------------------------------------ +--get and set max charge in hatch +function owl_tech:get_max_charge_in_hatch_pos(x,y,z) + return owl_tech:get_charge_max(minetest.get_meta({x=x,y=y,z=z})) +end +function owl_tech:set_max_charge_in_hatch_pos(x,y,z,energy) + owl_tech:set_charge_max(minetest.get_meta({x=x,y=y,z=z}),energy) +end +------------------------------------------------------ +--get and set voltage hatch +function owl_tech:get_voltage_in_hatch_pos(x,y,z) + return owl_tech:get_voltage(minetest.get_meta({x=x,y=y,z=z})) +end +function owl_tech:set_voltage_in_hatch_pos(x,y,z,energy) + owl_tech:set_voltage(minetest.get_meta({x=x,y=y,z=z}),energy) +end +------------------------------------------------------ +--get and set fluid amount in hatch +function owl_tech:get_volume_amount_in_hatch_pos(x,y,z) + return owl_tech.get_pull_volume(minetest:get_meta({x=x,y=y,z=z}),1) +end +function owl_tech:set_volume_amount_in_hatch_pos(x,y,z,volume) + owl_tech.set_pull_volume(minetest:get_meta({x=x,y=y,z=z}),1,volume) +end +------------------------------------------------------ +--get and set max volume amount in hatch +function owl_tech:get_max_volume_in_hatch_pos(x,y,z) + return owl_tech.get_pull_max_volume(minetest:get_meta({x=x,y=y,z=z}),1) +end +function owl_tech:set_max_volume_in_hatch_pos(x,y,z,volume) + owl_tech.set_pull_max_volume(minetest:get_meta({x=x,y=y,z=z}),1,volume) +end +------------------------------------------------------ +--get and set name fluid in hatch +function owl_tech:get_name_fluid_in_hatch_pos(x,y,z) + return owl_tech.get_pull_fluid_name(minetest:get_meta({x=x,y=y,z=z}),1) +end +function owl_tech:set_name_fluid_in_hatch_pos(x,y,z,name) + owl_tech.set_pull_fluid_name(minetest:get_meta({x=x,y=y,z=z}),1,name) +end +------------------------------------------------------- diff --git a/multiblocks/wood_pyrolysis.lua b/multiblocks/wood_pyrolysis.lua index 5949f9d..2d006dd 100644 --- a/multiblocks/wood_pyrolysis.lua +++ b/multiblocks/wood_pyrolysis.lua @@ -1,8 +1,17 @@ local S = minetest.get_translator(minetest.get_current_modname()) local name = minetest.get_current_modname() local path = minetest.get_modpath(name) +--[[ + multinode = 3x4x3 + frames - "owl_tech:steel_big_tiles" + entrails - "owl_tech:copper_grid" + other nodes(can replace bu hatch) - "owl_tech:tin_tiles" + need 1 input item hatch ,1 output item hatch , 1 input energy hatch , 1 output fluid hatch +]] ---[[local function set_formspect_wood_pyrolis(meta) + + +local function set_formspect_wood_pyrolis(meta) local redines = owl_tech.get_item_redines(meta) local burn= meta:get_int("fuel_burn") local formspec = "size[9,8.75]".. @@ -31,63 +40,587 @@ end local function bronze_blast_furnanse_build_correct(pos) local retu = true - local centr_pos= { - x=0,y=0,z=0 - } - if minetest.get_node_or_nil({x=pos.x+1,y=pos.y,z=pos.z}).name=='mcl_core:lava_source' then --x+1 - centr_pos={ - x=pos.x+1,y=pos.y,z=pos.z - } - elseif minetest.get_node_or_nil({x=pos.x-1,y=pos.y,z=pos.z}).name=='mcl_core:lava_source' then --x-1 - centr_pos={ - x=pos.x-1,y=pos.y,z=pos.z - } - elseif minetest.get_node_or_nil({x=pos.x,y=pos.y,z=pos.z+1}).name=='mcl_core:lava_source' then --z+1 - centr_pos={ - x=pos.x,y=pos.y,z=pos.z+1 - } - elseif minetest.get_node_or_nil({x=pos.x,y=pos.y,z=pos.z-1}).name=='mcl_core:lava_source' then --z-1 - centr_pos={ - x=pos.x,y=pos.y,z=pos.z-1 + local meta = minetest.get_meta(pos) + local rotation = minetest.get_node(pos).param2 % 32 + + local id_frame = minetest.get_content_id("owl_tech:steel_big_tiles") + local id_entrails = minetest.get_content_id("owl_tech:copper_tiles") + local id_other= minetest.get_content_id("owl_tech:tin_tiles") + + local id_item_input_hatch = minetest.get_content_id("owl_tech:base_item_hatch_input") + local id_item_output_hatch = minetest.get_content_id("owl_tech:base_item_hatch_output") + local id_energy_input_hatch = minetest.get_content_id("owl_tech:base_energy_hatch_input") + local id_energy_output_hatch = minetest.get_content_id("owl_tech:base_energy_hatch_output") + local id_fluid_input_hatch = minetest.get_content_id("owl_tech:base_fluid_hatch_input") + local id_fluid_output_hatch = minetest.get_content_id("owl_tech:base_fluid_hatch_output") + + local item_hatch_input_count = 0 + local item_hatch_output_count = 0 + local energy_hatch_input_count = 0 + local fluid_hatch_output_count = 0 + + --check frame + if rotation==0 then --z-1 + local corect =true + local vm = minetest.get_voxel_manip() + local pos1,pos2 = {x=pos.x-1,y=pos.y-1,z=pos.z},{x=pos.x+1,y=pos.y+1,z=pos.z+4} + local emin, emax = vm:read_from_map(pos1,pos2) + local a = VoxelArea:new{ + MinEdge = emin, + MaxEdge = emax } + local data = vm:get_data() + -- begin frames + for z = pos1.z, pos2.z do + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for x = pos1.x,pos2.x,pos2.x-pos1.x do + local vi = a:index(x, y, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + end + end + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for z = pos1.z,pos2.z,pos2.z-pos1.z do + local vi = a:index(pos.x, y, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + end + for x = pos1.x,pos2.x,pos2.x-pos1.x do + for z = pos1.z,pos2.z,pos2.z-pos1.z do + local vi = a:index(x, pos1.y+1, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + end + -- end frames -begin entrails + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(pos.x, pos.y, z) + if data[vi] ~= id_entrails then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + -- end entrails look for hatch + for x = pos1.x, pos2.x,pos2.x-pos1.x do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(x, pos.y, z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",x,pos.y,z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",x,pos.y,z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",x,pos.y,z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",x,pos.y,z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(pos.x, y, z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",pos.x, y, z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",pos.x, y, z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",pos.x, y, z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, y, z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",pos.x, pos.y, pos2.z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",pos.x, pos.y, pos2.z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + --end look for hacth begin look for other nodes + for x = pos1.x, pos2.x,pos2.x-pos1.x do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(x, pos.y, z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + minetest.chat_send_all(1) + corect = false + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(pos.x, y, z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + minetest.chat_send_all(1) + corect = false + end + end + end + if not (data[a:index(pos.x, pos.y, pos2.z)] == id_other or data[a:index(pos.x, pos.y, pos2.z)] == id_item_input_hatch or data[a:index(pos.x, pos.y, pos2.z)] == id_item_output_hatch + or data[a:index(pos.x, pos.y, pos2.z)] == id_energy_input_hatch or data[a:index(pos.x, pos.y, pos2.z)] == id_fluid_output_hatch) then + corect = false + end + if item_hatch_input_count~=1 or item_hatch_output_count~=1 or energy_hatch_input_count~=1 or fluid_hatch_output_count~=1 then--get need count of hatchs + local meta = minetest.get_meta(pos) + corect = false + minetest.chat_send_all(rotation.."eror!") + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",0,0,0) + end + return corect end - if centr_pos.y==pos.y then - for i = -1, 1, 1 do --check botom - for j = -1, 1, 1 do - if minetest.get_node_or_nil({x=centr_pos.x+i,y=centr_pos.y-1,z=centr_pos.z+j}).name~="owl_tech:bronze_briks" then - retu=false + if rotation==2 then --z+1 + local corect =true + local vm = minetest.get_voxel_manip() + local pos1,pos2 = {x=pos.x-1,y=pos.y-1,z=pos.z-4},{x=pos.x+1,y=pos.y+1,z=pos.z} + local emin, emax = vm:read_from_map(pos1,pos2) + local a = VoxelArea:new{ + MinEdge = emin, + MaxEdge = emax + } + local data = vm:get_data() + -- begin frames + for z = pos1.z, pos2.z do + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for x = pos1.x,pos2.x,pos2.x-pos1.x do + local vi = a:index(x, y, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end end end end - if minetest.get_node_or_nil({x=centr_pos.x+1,y=centr_pos.y,z=centr_pos.z+1}).name~="owl_tech:bronze_briks" or - minetest.get_node_or_nil({x=centr_pos.x-1,y=centr_pos.y,z=centr_pos.z+1}).name~="owl_tech:bronze_briks" or - minetest.get_node_or_nil({x=centr_pos.x+1,y=centr_pos.y,z=centr_pos.z-1}).name~="owl_tech:bronze_briks" or - minetest.get_node_or_nil({x=centr_pos.x-1,y=centr_pos.y,z=centr_pos.z-1}).name~="owl_tech:bronze_briks" then - retu=false - end - for i = -1, 1, 1 do --check +1 level - for j = -1, 1, 1 do - if minetest.get_node_or_nil({x=centr_pos.x+i,y=centr_pos.y+1,z=centr_pos.z+j}).name~="owl_tech:bronze_briks" and not(i==0 and j==0) then - retu=false + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for z = pos1.z,pos2.z,pos2.z-pos1.z do + local vi = a:index(pos.x, y, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false end end end - for i = -1, 1, 1 do --check +2 level - for j = -1, 1, 1 do - if minetest.get_node_or_nil({x=centr_pos.x+i,y=centr_pos.y+2,z=centr_pos.z+j}).name~="owl_tech:bronze_briks" and not(i==0 and j==0) then - retu=false + for x = pos1.x,pos2.x,pos2.x-pos1.x do + for z = pos1.z,pos2.z,pos2.z-pos1.z do + local vi = a:index(x, pos1.y+1, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false end end end - return retu - else - return false + -- end frames -begin entrails + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(pos.x, pos.y, z) + if data[vi] ~= id_entrails then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + -- end entrails look for hatch + for x = pos1.x, pos2.x,pos2.x-pos1.x do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(x, pos.y, z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",x,pos.y,z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",x,pos.y,z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",x,pos.y,z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",x,pos.y,z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(pos.x, y, z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",pos.x, y, z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",pos.x, y, z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",pos.x, y, z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, y, z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",pos.x, pos.y, pos2.z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",pos.x, pos.y, pos2.z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[a:index(pos.x, pos.y, pos2.z)] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + --end look for hacth begin look for other nodes + for x = pos1.x, pos2.x,pos2.x-pos1.x do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(x, pos.y, z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + corect = false + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for z = pos1.z+1,pos2.z-1 , 1 do + local vi = a:index(pos.x, y, z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + corect = false + end + end + end + if not (data[a:index(pos.x, pos.y, pos1.z)]== id_other + or data[a:index(pos.x, pos.y, pos1.z)] == id_item_input_hatch + or data[a:index(pos.x, pos.y, pos1.z)] == id_item_output_hatch + or data[a:index(pos.x, pos.y, pos1.z)] == id_energy_input_hatch + or data[a:index(pos.x, pos.y, pos1.z)] == id_fluid_output_hatch) then + corect = false + end + if item_hatch_input_count~=1 or item_hatch_output_count~=1 or energy_hatch_input_count~=1 or fluid_hatch_output_count~=1 then--get need count of hatchs + local meta = minetest.get_meta(pos) + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",0,0,0) + end + return corect + end + if rotation==1 then --x-1 + local corect =true + local vm = minetest.get_voxel_manip() + local pos1,pos2 = {x=pos.x,y=pos.y-1,z=pos.z-1},{x=pos.x+4,y=pos.y+1,z=pos.z+1} + local emin, emax = vm:read_from_map(pos1,pos2) + local a = VoxelArea:new{ + MinEdge = emin, + MaxEdge = emax + } + local data = vm:get_data() + -- begin frames + for x = pos1.x, pos2.x do + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for z = pos1.z,pos2.z,pos2.x-pos1.z do + local vi = a:index(x, y, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + end + end + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for x = pos1.x,pos2.x,pos2.x-pos1.x do + local vi = a:index(x, y, pos.z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..x.."--"..pos1.y.."--"..pos1.z) + corect = false + end + end + end + for z = pos1.z,pos2.z,pos2.z-pos1.z do + for x = pos1.x,pos2.x,pos2.x-pos1.x do + local vi = a:index(x, pos1.y+1, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + end + -- end frames -begin entrails + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, pos.y, pos.z) + if data[vi] ~= id_entrails then + minetest.chat_send_all("error"..x.."--"..pos1.y.."--"..pos1.z) + corect = false + end + end + -- end entrails look for hatch + for z = pos1.z, pos2.z,pos2.z-pos1.z do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, pos.y, z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",x,pos.y,z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",x,pos.y,z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",x,pos.y,z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",x,pos.y,z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, y, pos.z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",x, y, pos.z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",x, y, pos.z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",x, y, pos.z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",x, y, pos.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",pos.x, pos.y, pos2.z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",pos.x, pos.y, pos2.z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + --end look for hacth begin look for other nodes + for z = pos1.x, pos2.z,pos2.z-pos1.z do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, pos.y, z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + corect = false + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, y, pos.z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + corect = false + end + end + end + if not (data[a:index(pos2.x, pos.y, pos.z)] == id_other or data[a:index(pos2.x, pos.y, pos.z)] == id_item_input_hatch or data[a:index(pos2.x, pos.y, pos.z)] == id_item_output_hatch + or data[a:index(pos2.x, pos.y, pos.z)] == id_energy_input_hatch or data[a:index(pos2.x, pos.y, pos.z)] == id_fluid_output_hatch) then + corect = false + end + if item_hatch_input_count~=1 or item_hatch_output_count~=1 or energy_hatch_input_count~=1 or fluid_hatch_output_count~=1 then--get need count of hatchs + local meta = minetest.get_meta(pos) + minetest.chat_send_all(rotation.."eror!") + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",0,0,0) + end + return corect + end + if rotation==3 then --x+1 dont work! + local corect =true + local vm = minetest.get_voxel_manip() + local pos1,pos2 = {x=pos.x-4,y=pos.y-1,z=pos.z-1},{x=pos.x,y=pos.y+1,z=pos.z+1} + local emin, emax = vm:read_from_map(pos1,pos2) + local a = VoxelArea:new{ + MinEdge = emin, + MaxEdge = emax + } + local data = vm:get_data() + -- begin frames + for x = pos1.x, pos2.x do + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for z = pos1.z,pos2.z,pos2.x-pos1.z do + local vi = a:index(x, y, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + end + end + for y = pos1.y,pos2.y,pos2.y-pos1.y do + for x = pos1.x,pos2.x,pos2.x-pos1.x do + local vi = a:index(x, y, pos.z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..x.."--"..pos1.y.."--"..pos1.z) + corect = false + end + end + end + for z = pos1.z,pos2.z,pos2.z-pos1.z do + for x = pos1.x,pos2.x,pos2.x-pos1.x do + local vi = a:index(x, pos1.y+1, z) + if data[vi] ~= id_frame then + minetest.chat_send_all("error"..pos1.x.."--"..pos1.y.."--"..z) + corect = false + end + end + end + -- end frames -begin entrails + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, pos.y, pos.z) + if data[vi] ~= id_entrails then + minetest.chat_send_all("error"..x.."--"..pos1.y.."--"..pos1.z) + corect = false + end + end + -- end entrails look for hatch + for z = pos1.z, pos2.z,pos2.z-pos1.z do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, pos.y, z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",x,pos.y,z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",x,pos.y,z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",x,pos.y,z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",x,pos.y,z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, y, pos.z) + if data[vi] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",x, y, pos.z) + item_hatch_input_count = item_hatch_input_count + 1 + end + if data[vi] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",x, y, pos.z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[vi] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",x, y, pos.z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[vi] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",x, y, pos.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + end + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_item_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_item_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",pos.x, pos.y, pos2.z) + item_hatch_output_count = item_hatch_output_count + 1 + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_energy_input_hatch then + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",pos.x, pos.y, pos2.z) + energy_hatch_input_count = energy_hatch_input_count + 1 + end + if data[a:index(pos2.x, pos.y, pos.z)] == id_fluid_output_hatch then + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",pos.x, pos.y, pos2.z) + fluid_hatch_output_count = fluid_hatch_output_count + 1 + end + --end look for hacth begin look for other nodes + for z = pos1.x, pos2.z,pos2.z-pos1.z do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, pos.y, z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + corect = false + end + end + end + for y = pos1.y, pos2.y,pos2.y-pos1.y do + for x = pos1.x+1,pos2.x-1 , 1 do + local vi = a:index(x, y, pos.z) + if not (data[vi] == id_other or data[vi] == id_item_input_hatch or data[vi] == id_item_output_hatch or data[vi] == id_energy_input_hatch or data[vi] == id_fluid_output_hatch) then + corect = false + end + end + end + if not (data[a:index(pos1.x, pos.y, pos.z)] == id_other or data[a:index(pos1.x, pos.y, pos.z)] == id_item_input_hatch or data[a:index(pos1.x, pos.y, pos.z)] == id_item_output_hatch + or data[a:index(pos1.x, pos.y, pos.z)] == id_energy_input_hatch or data[a:index(pos1.x, pos.y, pos.z)] == id_fluid_output_hatch) then + corect = false + end + if item_hatch_input_count~=1 or item_hatch_output_count~=1 or energy_hatch_input_count~=1 or fluid_hatch_output_count~=1 then--get need count of hatchs + local meta = minetest.get_meta(pos) + minetest.chat_send_all(rotation.."eror!") + owl_tech:set_hatch_ofset(meta,1,"item_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"item_hatch_output",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"energy_hatch_input",0,0,0) + owl_tech:set_hatch_ofset(meta,1,"fluid_hatch_output",0,0,0) + end + return corect end end - ---bronze_blast furnance +--wood pyrolyze controller minetest.register_node("owl_tech:wood_pyrolis", { - description = S("WIP Wood pyrolis controller"), + description = S("Wood pyrolis controller"), _doc_items_longdesc = S("A more efficient way to turn wood into coal"), tiles = { "(owl_tech_base_meshanism_side.png^[colorize:#575757:128)", @@ -95,11 +628,11 @@ minetest.register_node("owl_tech:wood_pyrolis", { "owl_tech_base_meshanism_side.png^[colorize:#575757:128", "owl_tech_base_meshanism_side.png^[colorize:#575757:128", "owl_tech_base_meshanism_side.png^[colorize:#575757:128", - "(owl_tech_base_meshanism_side.png^[colorize:#575757:128)^owl_tech_smelter_face.png", + "(owl_tech_base_meshanism_side.png^[colorize:#575757:128)^owl_tech_macerator_face.png", }, is_ground_content = false, stack_max = 64, - groups = {pickaxey=2, owl_tech_machine=1}, + groups = {pickaxey=2, owl_tech_machine=1,controller_node=1}, sounds = mcl_sounds.node_sound_metal_defaults(), paramtype2 = "facedir", _mcl_blast_resistance = 6, @@ -108,58 +641,79 @@ minetest.register_node("owl_tech:wood_pyrolis", { local meta = minetest.get_meta(pos) owl_tech.set_mashine_tire(meta,2) --all steam mishine has 1 tire owl_tech.reset_item_redines(meta) - set_formspect_wood_pyrolis(meta) local timer =minetest.get_node_timer(pos) - local inv = meta:get_inventory() - meta:set_int("fuel_burn",0) - 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 bronze_blast_furnanse_build_correct(pos) then - if meta:get_int("fuel_burn")~=0 and input_its:get_name() ~= "owl_tech:iron_ingot" then - meta:set_int("fuel_burn",0) - end - if meta:get_int("fuel_burn")==0 and input_its_add:get_name() =='owl_tech:coal' and input_its:get_name() == "owl_tech:iron_ingot" then - meta:set_int("fuel_burn",50) - input_its_add:set_count(input_its_add:get_count()-1) - inv:set_stack('input_in_add', 1,input_its_add) - end - if input_its:get_name()== "owl_tech:iron_ingot" and meta:get_int("fuel_burn")>0 then -- chek for item in slots - local name1 =input_its:get_name() -- for metal - if name1=="owl_tech:iron_ingot" and owl_tech.get_item_redines(meta)>-1 and owl_tech.get_item_redines(meta)<100 then --recipt real - owl_tech.add_item_redines(meta,1) - meta:set_int("fuel_burn",meta:get_int("fuel_burn")-1) - elseif name1=="owl_tech:iron_ingot" and owl_tech.get_item_redines(meta)>=100 then - 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()+1) - inv:set_stack('dst', 1, dst_its) - else - local item ={name="owl_tech:steel_ingot", count=1, 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) + if bronze_blast_furnanse_build_correct(pos) then + local input_stack = owl_tech:get_item_in_input_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"item_hatch_input"), + owl_tech:get_hatch_ofset_Y(meta,1,"item_hatch_input"), + owl_tech:get_hatch_ofset_Z(meta,1,"item_hatch_input") + ) + local output_stack = owl_tech:get_item_in_input_output_pos( + owl_tech:get_hatch_ofset_X(meta,1,"item_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"item_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"item_hatch_output") + ) + local input_energy = owl_tech:get_charge_in_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"energy_hatch_input"), + owl_tech:get_hatch_ofset_Y(meta,1,"energy_hatch_input"), + owl_tech:get_hatch_ofset_Z(meta,1,"energy_hatch_input") + ) + local fluid_output = owl_tech:get_volume_amount_in_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output") + ) + if owl_tech.get_item_redines(meta)>0 and owl_tech.get_item_redines(meta)<100 then + if owl_tech.get_item_redines(meta)==0 and input_stack:get_count()>=4 and output_stack:get_free_space()>=6 + and minetest.get_item_group(input_stack:get_name(),"tree" and (output_stack:get_name()=="mcl_core:charcoal_lump" or output_stack:is_empty()) ) + and owl_tech:get_max_volume_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"))-fluid_output>=250 then --has bonus coal + owl_tech.add_item_redines(meta,10) + owl_tech:set_charge_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Y(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Z(meta,1,"energy_hatch_input") + ,input_energy-10) end - else end - else - owl_tech.reset_item_redines(meta) - meta:set_int("fuel_burn",0) + if owl_tech.get_item_redines(meta)==0 and input_stack:get_count()>=4 and output_stack:get_free_space()>=6 + and minetest.get_item_group(input_stack:get_name(),"tree" and (output_stack:get_name()=="mcl_core:charcoal_lump" or output_stack:is_empty()) ) + and input_energy>=100 + and owl_tech:get_max_volume_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Y(meta,1,"fluid_hatch_output"),owl_tech:get_hatch_ofset_Z(meta,1,"fluid_hatch_output"))-fluid_output>=250 then --has bonus coal + owl_tech.add_item_redines(meta,10) + owl_tech:set_charge_in_hatch_pos(owl_tech:get_hatch_ofset_X(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Y(meta,1,"energy_hatch_input"),owl_tech:get_hatch_ofset_Z(meta,1,"energy_hatch_input") + ,input_energy-10) + end + if owl_tech.get_item_redines(meta)>=100 then + if not output_stack:is_empty() then-- Add main output + output_stack:set_count(output_stack:get_count()+6) + owl_tech:set_item_in_input_output_pos( + owl_tech:get_hatch_ofset_X(meta,1,"item_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"item_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"item_hatch_output"),output_stack + ) + else + local item ={name="mcl_core:charcoal_lump", count=6, wear=0, metadata=""} + output_stack:add_item(item) + owl_tech:set_item_in_input_output_pos( + owl_tech:get_hatch_ofset_X(meta,1,"item_hatch_output"), + owl_tech:get_hatch_ofset_Y(meta,1,"item_hatch_output"), + owl_tech:get_hatch_ofset_Z(meta,1,"item_hatch_output"),output_stack + ) + end + input_stack:set_count(input_stack:get_count()-4) + owl_tech:set_item_in_input_hatch_pos( + owl_tech:get_hatch_ofset_X(meta,1,"item_hatch_input"), + owl_tech:get_hatch_ofset_Y(meta,1,"item_hatch_input"), + owl_tech:get_hatch_ofset_Z(meta,1,"item_hatch_input"),input_stack + ) + if fluid_output==0 then ---Dont forget add fluid TODO + + end + owl_tech.reset_item_redines(meta) + end end - owl_tech.delit_name_fluid_if_0(meta) set_formspect_wood_pyrolis(meta) timer:start(0.2) end @@ -167,10 +721,10 @@ minetest.register_node("owl_tech:wood_pyrolis", { --Crafte controller minetest.register_craft({ type = "shaped", - output = "owl_tech:bronze_blast_furnace_controller", + output = "owl_tech:wood_pyrolis", recipe = { {"mcl_furnaces:furnace","owl_tech:bronze_plate","mcl_furnaces:furnace"}, {"owl_tech:bronze_plate","mcl_furnaces:furnace","owl_tech:bronze_plate"}, {"owl_tech:bronze_plate","owl_tech:bronze_plate","owl_tech:bronze_plate"} } -})]] \ No newline at end of file +}) \ No newline at end of file diff --git a/ore/node_register.lua b/ore/node_register.lua index 8a397af..80c5116 100755 --- a/ore/node_register.lua +++ b/ore/node_register.lua @@ -1,8 +1,29 @@ local S = minetest.get_translator(minetest.get_current_modname()) local name = minetest.get_current_modname() local path = minetest.get_modpath(name) +local use_select_box = minetest.settings:get_bool("mcl_buckets_use_select_box", false) ---- This crutch was suggested by the developers of Mineclone 2 - they made the functions of their shovels and hoes local +local mod_doc = minetest.get_modpath("doc") +local mod_mcl_core = minetest.get_modpath("mcl_core") +--local mod_mclx_core = minetest.get_modpath("mclx_core") + +-- Localize some functions for faster access +local vector = vector +local math = math +local string = string + +local raycast = minetest.raycast +local get_node = minetest.get_node +local set_node = minetest.set_node +local add_node = minetest.add_node +local add_item = minetest.add_item + +local registered_nodes = minetest.registered_nodes +local get_item_group = minetest.get_item_group +local is_creative_enabled = minetest.is_creative_enabled +local is_protected = minetest.is_protected +local record_protection_violation = minetest.record_protection_violation local function create_soil(pos, inv) if pos == nil then @@ -925,7 +946,146 @@ for i, value in ipairs(gems_orew_array) do _mcl_hardness = 5, }) end - +local fluid_array ={ + {"tar","Tar","owl_tech_tar_flowing_animated.png","owl_tech_tar_source_animated.png","owl_tech_tar_bucket.png","owl_tech_tar_for_sell.png"}--#8d4a00 +} +for i, value in ipairs(fluid_array) do + minetest.register_node("owl_tech:"..fluid_array[i][1].."_flowing", { + description = S(fluid_array[i][2].." Water"), + _doc_items_create_entry = false, + wield_image = fluid_array[i][3].."^[verticalframe:64:0", + drawtype = "flowingliquid", + tiles = {fluid_array[i][3].."^[verticalframe:64:0"}, + special_tiles = { + { + image="("..fluid_array[i][3]..")", + backface_culling=false, + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0} + }, + { + image="("..fluid_array[i][3]..")", + backface_culling=false, + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0} + }, + }, + sounds = mcl_sounds.node_sound_water_defaults(), + is_ground_content = false, + use_texture_alpha = USE_TEXTURE_ALPHA, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + drop = "", + drowning = 4, + liquidtype = "flowing", + liquid_alternative_flowing = "owl_tech:"..fluid_array[i][1].."_flowing", + liquid_alternative_source = "owl_tech:"..fluid_array[i][1].."_source", + liquid_viscosity = WATER_VISC, + liquid_range = 7, + waving = 3, + post_effect_color = {a=20, r=0x03, g=0x3C, b=0x5C}, + groups = { water=3, liquid=3, puts_out_fire=1, melt_around=1, dig_by_piston=1, not_in_creative_inventory=1,},--not_in_creative_inventory=1, + _mcl_blast_resistance = 100, + -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode + _mcl_hardness = -1, + }) + + minetest.register_node("owl_tech:"..fluid_array[i][1].."_source", { + description = S("Water Source"), + _doc_items_entry_name = S("Water"), + _doc_items_longdesc = + S("Сompounds from cyclic, highly volatile and non-volatile compounds, which are presented in a spectrum: from methyl esters to combustion of alcohols, acids, phenols and light compounds.").."\n\n", + _doc_items_hidden = false, + drawtype = "liquid", + waving = 3, + tiles = { + {name=fluid_array[i][4], animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}} + }, + special_tiles = { + -- New-style water source material (mostly unused) + { + name=fluid_array[i][4], + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}, + backface_culling = false, + } + }, + sounds = mcl_sounds.node_sound_water_defaults(), + is_ground_content = false, + use_texture_alpha = USE_TEXTURE_ALPHA, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + drop = "", + drowning = 4, + liquidtype = "source", + liquid_alternative_flowing = "owl_tech:"..fluid_array[i][1].."_flowing", + liquid_alternative_source = "owl_tech:"..fluid_array[i][1].."_source", + liquid_viscosity = WATER_VISC, + liquid_range = 7, + post_effect_color = {a=90, r=0x03, g=0x3C, b=0x5C}, + stack_max = 64, + groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, dig_by_piston=1}, + _mcl_blast_resistance = 100, + -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode + _mcl_hardness = -1, + }) + --capsuls + minetest.register_craftitem("owl_tech:"..fluid_array[i][1].."sell_tire_1", { + description = S("Get 1000 of "..fluid_array[i][1]), + _doc_items_longdesc = S("Contein "..fluid_array[i][1]), + inventory_image = "owl_tech_empty_sell.png^"..fluid_array[i][6], + stack_max = 64, + groups = { craftitem=1 }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + minetest.place_node(pointed_thing.above,{name="owl_tech:"..fluid_array[i][1].."_source"}) + itemstack:set_count(itemstack:get_count()-1) + return itemstack + end + end + }) +end +--empty sell +minetest.register_craftitem("owl_tech:empty_sell_tire_1", { + description = S("Sell tire 1"), + _doc_items_longdesc = S("Simple sell for fluids"), + inventory_image = "owl_tech_empty_sell.png", + stack_max = 64, + groups = { craftitem=1 }, +}) +-- water and lava sell owl_tech_lava_for_sell.png +minetest.register_craftitem("owl_tech:water_sell_tire_1", { + description = S("Get 1000 of water"), + _doc_items_longdesc = S("Contein water"), + inventory_image = "owl_tech_empty_sell.png^owl_tech_water_for_sell.png", + stack_max = 64, + groups = { craftitem=1 }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + minetest.place_node(pointed_thing.above,{name="owl_tech:water_source"}) + itemstack:set_count(itemstack:get_count()-1) + return itemstack + end + end +}) +minetest.register_craftitem("owl_tech:lava_sell_tire_1", { + description = S("Get 1000 of lava"), + _doc_items_longdesc = S("Contein lava"), + inventory_image = "owl_tech_empty_sell.png^owl_tech_lava_for_sell.png", + stack_max = 64, + groups = { craftitem=1 }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + minetest.place_node(pointed_thing.above,{name="owl_tech:lava_source"}) + itemstack:set_count(itemstack:get_count()-1) + return itemstack + end + end +}) ----------------------------------------------------------------------------------- --Some custom recips --Crafte bronze dust from copper and tin diff --git a/pipe/fluid_tank.lua b/pipe/fluid_tank.lua index 406372b..407fa63 100755 --- a/pipe/fluid_tank.lua +++ b/pipe/fluid_tank.lua @@ -27,7 +27,7 @@ minetest.register_node("owl_tech:bronze_tank", { 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)) + meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) timer:start(0.2) end, on_timer = function(pos, elapsed) @@ -56,7 +56,7 @@ minetest.register_node("owl_tech:bronze_tank", { end end owl_tech.delit_name_fluid_if_0(meta) - meta:set_string("infotext",owl_tech.get_pull_volume(meta,1)) + meta:set_string("infotext",owl_tech.get_pull_volume(meta,1).."--"..owl_tech.get_pull_max_volume(meta,1)) timer:start(0.2) end }) diff --git a/textures/owl_tech_empty_sell.png b/textures/owl_tech_empty_sell.png new file mode 100644 index 0000000..cde4db8 Binary files /dev/null and b/textures/owl_tech_empty_sell.png differ diff --git a/textures/owl_tech_item_hatch.png b/textures/owl_tech_item_hatch.png new file mode 100644 index 0000000..b60a220 Binary files /dev/null and b/textures/owl_tech_item_hatch.png differ diff --git a/textures/owl_tech_lava_for_sell.png b/textures/owl_tech_lava_for_sell.png new file mode 100644 index 0000000..fc8a95e Binary files /dev/null and b/textures/owl_tech_lava_for_sell.png differ diff --git a/textures/owl_tech_tar_bucket.png b/textures/owl_tech_tar_bucket.png new file mode 100644 index 0000000..84e6c1d Binary files /dev/null and b/textures/owl_tech_tar_bucket.png differ diff --git a/textures/owl_tech_tar_flowing_animated.png b/textures/owl_tech_tar_flowing_animated.png new file mode 100644 index 0000000..d6af5c6 Binary files /dev/null and b/textures/owl_tech_tar_flowing_animated.png differ diff --git a/textures/owl_tech_tar_for_sell.png b/textures/owl_tech_tar_for_sell.png new file mode 100644 index 0000000..f8aad01 Binary files /dev/null and b/textures/owl_tech_tar_for_sell.png differ diff --git a/textures/owl_tech_tar_source_animated.png b/textures/owl_tech_tar_source_animated.png new file mode 100644 index 0000000..1ac7df4 Binary files /dev/null and b/textures/owl_tech_tar_source_animated.png differ diff --git a/textures/owl_tech_water_for_sell.png b/textures/owl_tech_water_for_sell.png new file mode 100644 index 0000000..8fcebb8 Binary files /dev/null and b/textures/owl_tech_water_for_sell.png differ