72 lines
3.4 KiB
Lua
Executable File
72 lines
3.4 KiB
Lua
Executable File
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
|
|
})
|
|
--Crafte iron fluid pipe
|
|
minetest.register_craft({
|
|
type = "shaped",
|
|
output = "owl_tech:bronze_tank",
|
|
recipe = {
|
|
{"owl_tech:bronze_plate","owl_tech:bronze_plate","owl_tech:bronze_plate"},
|
|
{"owl_tech:bronze_plate","mcl_core:glass","owl_tech:bronze_plate"},
|
|
{"owl_tech:bronze_plate","owl_tech:bronze_fluid_pipe","owl_tech:bronze_plate"}
|
|
}
|
|
}) |