Add steam furnance

This commit is contained in:
ConfidentOwl 2023-01-01 19:03:44 +03:00
parent 15b4bbc08a
commit 88815c9ea9
3 changed files with 152 additions and 3 deletions

View File

@ -1,6 +1,6 @@
--Global lists
GLOBAL_FLUID_LIST ={
"mcl_core:lava_source","mcl_core:lava_source"
"mcl_core:lava_source","mcl_core:water_source","mclx_core:river_water_source"
}
INPUT_SLOT_NAME= {
"fluid_in","fuel",'input_in'

View File

@ -428,6 +428,7 @@ minetest.register_craft({
{"owl_tech:bronze_plate","owl_tech:bronze_plate","owl_tech:bronze_plate"}
}
})
--Forge hammer bronze
local function set_formspect_base_forge_hammer(meta)
local fluid_1_name = owl_tech.get_pull_fluid_name(meta,1)
local fluid_1_volume = owl_tech.get_pull_volume(meta,1)
@ -568,6 +569,132 @@ minetest.register_craft({
{"owl_tech:bronze_plate","mcl_anvils:anvil","owl_tech:bronze_plate"}
}
})
--------------------------------------------
--Steam furnance
--[[
local aftercooked
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
]]
local function set_formspect_base_furnance(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("Bronze furnance"))).."]"..
"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)..
"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[current_player;main]"..
"listring[current_player;main]"
meta:set_string("formspec", formspec)
end
--froge hammer"
minetest.register_node("owl_tech:bronze_furnance", {
description = S("Bronze furnance"),
_doc_items_longdesc = S("Just a furnance - but use steam energy"),
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_forge_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_furnance(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)
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 aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = {input_its:get_name()}})
if aftercooked.time>0 then
if owl_tech.get_item_redines(meta)>0 and owl_tech.get_item_redines(meta)<100 then --recipt real
local steam_new =owl_tech.get_pull_volume(meta,1)-10
owl_tech.set_pull_volume(meta,1,steam_new)
owl_tech.add_item_redines(meta,1)
elseif 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()+aftercooked.item:get_count())
inv:set_stack('dst', 1, dst_its)
else
local item =aftercooked.item
dst_its:add_item(item)
inv:set_stack('dst', 1, dst_its)
end
local steam_new =owl_tech.get_pull_volume(meta,1)-10
owl_tech.set_pull_volume(meta,1,steam_new)
owl_tech.reset_item_redines(meta)
elseif 1000<= owl_tech.get_pull_volume(meta,1) and owl_tech.get_item_redines(meta)==0 then --begin for work
local steam_new =owl_tech.get_pull_volume(meta,1)-10
owl_tech.set_pull_volume(meta,1,steam_new)
owl_tech.add_item_redines(meta,1)
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_furnance(meta)
timer:start(0.2)
end
})
--Crafte
minetest.register_craft({
type = "shaped",
output ="owl_tech:bronze_furnance",
recipe = {
{"owl_tech:bronze_plate","owl_tech:bronze_plate","owl_tech:bronze_plate"},
{"owl_tech:bronze_plate","owl_tech:bronze_frames","owl_tech:bronze_plate"},
{"owl_tech:bronze_plate","mcl_furnaces:furnace","owl_tech:bronze_plate"}
}
})
--------------------------------------------
--Steel mashins
local function set_formspect_steeel_macerator(meta)
local fluid_1_name = owl_tech.get_pull_fluid_name(meta,1)

View File

@ -58,7 +58,7 @@ minetest.register_node("owl_tech:bronze_boiler", {
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.set_pull_fluid_whitlist(meta,1,"mcl_core:water_source") --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)
@ -112,6 +112,17 @@ minetest.register_node("owl_tech:bronze_boiler", {
owl_tech.set_pull_volume(meta,2,difer)
end
end
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"fluid_pipe")
and owl_tech.get_pull_fluid_name(minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z}),1)=="mcl_core:water_source" then --get from pipe water
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
owl_tech.delit_name_fluid_if_0(meta)
set_formspect_base_boiler(meta)
timer:start(0.2)
@ -149,7 +160,7 @@ minetest.register_node("owl_tech:steel_boiler", {
on_construct = function(pos)
local meta = minetest.get_meta(pos)
owl_tech.add_new_pull(meta,12000,1,0) --water
owl_tech.set_pull_fluid_whitlist(meta,1,"mcl_water") --whitlist for make input ONLY Water
owl_tech.set_pull_fluid_whitlist(meta,1,"mcl_core:water_source") --whitlist for make input ONLY Water
owl_tech.add_new_pull(meta,12000,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)
@ -203,6 +214,17 @@ minetest.register_node("owl_tech:steel_boiler", {
owl_tech.set_pull_volume(meta,2,difer)
end
end
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"fluid_pipe")
and owl_tech.get_pull_fluid_name(minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z}),1)=="mcl_core:water_source" then --get from pipe water
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
owl_tech.delit_name_fluid_if_0(meta)
set_formspect_base_boiler(meta)
timer:start(0.2)