Add base electro steam_machins
This commit is contained in:
parent
048ff796c4
commit
6eaeb8c1a1
|
@ -40,7 +40,7 @@ minetest.register_node("owl_tech:base_battery", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"owl_tech_electro_wire")>0
|
if minetest.get_item_group((minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})).name,"owl_tech_electro_wire")>0
|
||||||
and owl_tech:get_charge_max(meta)-owl_tech:get_voltage(meta)>=0 then --Send to wire electro
|
and owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)>=0 then --Send to wire electro
|
||||||
local meta_up = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z})
|
local meta_up = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z})
|
||||||
if owl_tech:get_charge(meta_up)+owl_tech:get_voltage(meta_up)<=owl_tech:get_charge_max(meta_up) and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
if owl_tech:get_charge(meta_up)+owl_tech:get_voltage(meta_up)<=owl_tech:get_charge_max(meta_up) and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
||||||
owl_tech.send_electro_from_wire_in_pos(meta,{x=pos.x,y=pos.y-1,z=pos.z})
|
owl_tech.send_electro_from_wire_in_pos(meta,{x=pos.x,y=pos.y-1,z=pos.z})
|
||||||
|
|
|
@ -0,0 +1,684 @@
|
||||||
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
local name = minetest.get_current_modname()
|
||||||
|
local path = minetest.get_modpath(name)
|
||||||
|
|
||||||
|
--USE for get tire machine 1)Name 2)name 3)voltage 4)max_charge 5)color_code 6)metal name for crafte 7)has_macerator 8)help item list 9)has_alloy_smeter 10)has_siev 11)has_furnance 12)forge hammer
|
||||||
|
-- 10)forge hammer for i, value in ipairs(metals_ore_array) do
|
||||||
|
|
||||||
|
local table_all_machines={
|
||||||
|
{"Base","base",32,1600,"#575757","steel",true,{"owl_tech:diamond","owl_tech:copper_heat_element","owl_tech:steel_mesh","mesecons_pistons:piston_normal_off"},true,true,true,true}
|
||||||
|
}
|
||||||
|
|
||||||
|
for i = 1, #table_all_machines, 1 do
|
||||||
|
if table_all_machines[i][7]then
|
||||||
|
local function set_formspect_base_electro_macerator(meta)
|
||||||
|
local max_charge = owl_tech:get_charge_max(meta)
|
||||||
|
local curent_charge = owl_tech:get_charge(meta)
|
||||||
|
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( table_all_machines[i][1].." 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", (max_charge.."--"..curent_charge.."--"..table_all_machines[i][3]))).."]"..
|
||||||
|
"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
|
||||||
|
|
||||||
|
--base macerator
|
||||||
|
minetest.register_node("owl_tech:"..table_all_machines[i][2].."_macerator", {
|
||||||
|
description = S(table_all_machines[i][1].."electro macerator"),
|
||||||
|
_doc_items_longdesc = S("Firts electro macerater (tire"..i..")"),
|
||||||
|
tiles = {
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^owl_tech_steam_input.png",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":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,owl_tech_electro_mashine=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_electro(pos,table_all_machines[i][3],table_all_machines[i][4])
|
||||||
|
owl_tech.set_mashine_tire(meta,i+1) --all steam mishine has 1 tire
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
set_formspect_base_electro_macerator(meta)
|
||||||
|
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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
end
|
||||||
|
elseif MACERATO_RECIPS[name]~=nil and 100/MACERATO_RECIPS[name][5]*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,MACERATO_RECIPS[name][2],MACERATO_RECIPS[name][5])
|
||||||
|
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,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,"owl_tech_electro_wire")>0
|
||||||
|
and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro
|
||||||
|
local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z})
|
||||||
|
if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
||||||
|
owl_tech.send_electro_from_wire_in_pos(meta_up,pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
meta:set_string("infotext",owl_tech:get_charge(meta))
|
||||||
|
set_formspect_base_electro_macerator(meta)
|
||||||
|
timer:start(0.2)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--Crafte
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output = "owl_tech:"..table_all_machines[i][2].."_macerator",
|
||||||
|
recipe = {
|
||||||
|
{table_all_machines[i][8][1],table_all_machines[i][8][1],table_all_machines[i][8][1]},
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:"..table_all_machines[i][6].."_frames","owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:circuit_tire_"..i,"owl_tech:"..table_all_machines[i][6].."_plate"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if table_all_machines[i][9] then
|
||||||
|
--alloy smelter
|
||||||
|
local function set_formspect_base_alloy_smelter(meta)
|
||||||
|
local max_charge = owl_tech:get_charge_max(meta)
|
||||||
|
local curent_charge = owl_tech:get_charge(meta)
|
||||||
|
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", (max_charge.."--"..curent_charge.."--"..table_all_machines[i][3]))).."]"..
|
||||||
|
"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
|
||||||
|
-------------------------------------------
|
||||||
|
--alloy_smelter
|
||||||
|
minetest.register_node("owl_tech:"..table_all_machines[i][2].."_alloy_smelter", {
|
||||||
|
description = S( table_all_machines[i][1].." alloy smelter"),
|
||||||
|
_doc_items_longdesc = S("Smelt alll"),
|
||||||
|
tiles = {
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^owl_tech_steam_input.png",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":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_electro(pos,table_all_machines[i][3],table_all_machines[i][4])
|
||||||
|
owl_tech.set_mashine_tire(meta,i+1) --all steam mishine has 1 tire
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
set_formspect_base_alloy_smelter(meta)
|
||||||
|
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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,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()-SMELTER_RECIPS[name][1]) --Remove item from input slot
|
||||||
|
inv:set_stack('input_in', 1, input_its)
|
||||||
|
input_its_add:set_count(input_its_add:get_count()-SMELTER_RECIPS[name][2]) --Remove item from input slot
|
||||||
|
inv:set_stack('input_in_add', 1, input_its_add )
|
||||||
|
|
||||||
|
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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
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 steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,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,"owl_tech_electro_wire")>0
|
||||||
|
and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro
|
||||||
|
local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z})
|
||||||
|
if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
||||||
|
owl_tech.send_electro_from_wire_in_pos(meta_up,pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
meta:set_string("infotext",owl_tech:get_charge(meta))
|
||||||
|
set_formspect_base_alloy_smelter(meta)
|
||||||
|
timer:start(0.2)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--Crafte
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output ="owl_tech:"..table_all_machines[i][2].."_alloy_smelter",
|
||||||
|
recipe = {
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate",table_all_machines[i][8][2],"owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||||
|
{"owl_tech:circuit_tire_"..i,"owl_tech:"..table_all_machines[i][6].."_frames","owl_tech:circuit_tire_"..i},
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:"..table_all_machines[i][6].."_plate"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if table_all_machines[i][10] then
|
||||||
|
local function set_formspect_base_sieve(meta)
|
||||||
|
local max_charge = owl_tech:get_charge_max(meta)
|
||||||
|
local curent_charge = owl_tech:get_charge(meta)
|
||||||
|
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", (max_charge.."--"..curent_charge.."--"..table_all_machines[i][3]))).."]"..
|
||||||
|
"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
|
||||||
|
--siev
|
||||||
|
minetest.register_node("owl_tech:"..table_all_machines[i][2].."_sieve", {
|
||||||
|
description = S( table_all_machines[i][2].." sieve"),
|
||||||
|
_doc_items_longdesc = S("Siev tire "..i),
|
||||||
|
tiles = {
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^owl_tech_steam_input.png",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":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_electro(pos,table_all_machines[i][3],table_all_machines[i][4])
|
||||||
|
owl_tech.set_mashine_tire(meta,i+1) --all steam mishine has 1 tire
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
set_formspect_base_sieve(meta)
|
||||||
|
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_siev_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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,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_siev_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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
end
|
||||||
|
elseif SIEV_RESIPS[name]~=nil and 100/SIEV_RESIPS[name][5]*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,SIEV_RESIPS[name][2],SIEV_RESIPS[name][5])
|
||||||
|
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,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,"owl_tech_electro_wire")>0
|
||||||
|
and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro
|
||||||
|
local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z})
|
||||||
|
if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
||||||
|
owl_tech.send_electro_from_wire_in_pos(meta_up,pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
meta:set_string("infotext",owl_tech:get_charge(meta))
|
||||||
|
set_formspect_base_sieve(meta)
|
||||||
|
timer:start(0.2)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--Crafte
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output ="owl_tech:"..table_all_machines[i][2].."_sieve",
|
||||||
|
recipe = {
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate",table_all_machines[i][8][3],"owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||||
|
{"owl_tech:circuit_tire_"..i,"owl_tech:"..table_all_machines[i][6].."_frames","owl_tech:circuit_tire_"..i},
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:bronze_plate","owl_tech:"..table_all_machines[i][6].."_plate"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if table_all_machines[i][11] then
|
||||||
|
local function set_formspect_base_furnance(meta)
|
||||||
|
local max_charge = owl_tech:get_charge_max(meta)
|
||||||
|
local curent_charge = owl_tech:get_charge(meta)
|
||||||
|
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", (max_charge.."--"..curent_charge.."--"..table_all_machines[i][3]))).."]"..
|
||||||
|
"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
|
||||||
|
--furnance
|
||||||
|
minetest.register_node("owl_tech:"..table_all_machines[i][2].."_furnance", {
|
||||||
|
description = S(table_all_machines[i][1].." furnance"),
|
||||||
|
_doc_items_longdesc = S("Just a furnance - but use electro energy tire"..i),
|
||||||
|
tiles = {
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^owl_tech_steam_input.png",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":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_electro(pos,table_all_machines[i][3],table_all_machines[i][4])
|
||||||
|
owl_tech.set_mashine_tire(meta,i+1) --all steam mishine has 1 tire
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
set_formspect_base_furnance(meta)
|
||||||
|
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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
owl_tech.add_item_redines(meta,10)
|
||||||
|
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 100<= owl_tech:get_charge(meta) and owl_tech.get_item_redines(meta)==0 then --begin for work
|
||||||
|
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
owl_tech.add_item_redines(meta,10)
|
||||||
|
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,"owl_tech_electro_wire")>0
|
||||||
|
and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro
|
||||||
|
local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z})
|
||||||
|
if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
||||||
|
owl_tech.send_electro_from_wire_in_pos(meta_up,pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
meta:set_string("infotext",owl_tech:get_charge(meta))
|
||||||
|
set_formspect_base_furnance(meta)
|
||||||
|
timer:start(0.2)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--Crafte
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output ="owl_tech:"..table_all_machines[i][2].."_furnance",
|
||||||
|
recipe = {
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate",table_all_machines[i][8][2],"owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||||
|
{"owl_tech:circuit_tire_"..i,"owl_tech:"..table_all_machines[i][6].."_frames","owl_tech:circuit_tire_"..i},
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate",table_all_machines[i][8][2],"owl_tech:"..table_all_machines[i][6].."_plate"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if table_all_machines[i][12] then
|
||||||
|
local function set_formspect_base_forge_hammer(meta)
|
||||||
|
local max_charge = owl_tech:get_charge_max(meta)
|
||||||
|
local curent_charge = owl_tech:get_charge(meta)
|
||||||
|
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(table_all_machines[i][2].." Forge Hammer"))).."]"..
|
||||||
|
"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", (max_charge.."--"..curent_charge.."--"..table_all_machines[i][3]))).."]"..
|
||||||
|
"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
|
||||||
|
--froge hammer"
|
||||||
|
minetest.register_node("owl_tech:"..table_all_machines[i][2].."_forge_hammer", {
|
||||||
|
description = S(table_all_machines[i][1].." forge hammer"),
|
||||||
|
_doc_items_longdesc = S("Automative forge tire"..i),
|
||||||
|
tiles = {
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)^owl_tech_steam_input.png",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128)",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":128",
|
||||||
|
"(owl_tech_base_meshanism_side.png^[colorize:"..table_all_machines[i][5]..":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_electro(pos,table_all_machines[i][3],table_all_machines[i][4])
|
||||||
|
owl_tech.set_mashine_tire(meta,i+1) --all steam mishine has 1 tire
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
set_formspect_base_forge_hammer(meta)
|
||||||
|
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 FORGE_HAMMER_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_forge_hammer_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,FORGE_HAMMER_RECIPS[name][2],FORGE_HAMMER_RECIPS[name][5])
|
||||||
|
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
minetest.chat_send_all(steam_new)
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
owl_tech.add_item_redines(meta,amount)
|
||||||
|
end
|
||||||
|
elseif FORGE_HAMMER_RECIPS[name]~=nil and owl_tech.get_item_redines(meta)>=100 then
|
||||||
|
if owl_tech.can_forge_hammer_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()+FORGE_HAMMER_RECIPS[name][4])
|
||||||
|
inv:set_stack('dst', 1, dst_its)
|
||||||
|
else
|
||||||
|
local item ={name=FORGE_HAMMER_RECIPS[name][3], count=FORGE_HAMMER_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 FORGE_HAMMER_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()+FORGE_HAMMER_RECIPS[name][8])
|
||||||
|
inv:set_stack('dst_add', 1, dst_add_its)
|
||||||
|
else
|
||||||
|
local item ={name=FORGE_HAMMER_RECIPS[name][7], count=FORGE_HAMMER_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_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,steam_new)
|
||||||
|
owl_tech.reset_item_redines(meta)
|
||||||
|
end
|
||||||
|
elseif FORGE_HAMMER_RECIPS[name]~=nil and 100/FORGE_HAMMER_RECIPS[name][5]*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,FORGE_HAMMER_RECIPS[name][2],FORGE_HAMMER_RECIPS[name][5])
|
||||||
|
local steam_new =owl_tech:get_charge(meta)-owl_tech:get_voltage(meta)
|
||||||
|
owl_tech:set_charge(meta,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,"owl_tech_electro_wire")>0
|
||||||
|
and owl_tech:get_charge_max(meta)-owl_tech:get_charge(meta)>=owl_tech:get_voltage(meta) then --get from wire electro
|
||||||
|
local meta_up = minetest.get_meta({x=pos.x,y=pos.y+1,z=pos.z})
|
||||||
|
if owl_tech:get_charge(meta_up)>0 and owl_tech:get_voltage(meta)==owl_tech:get_voltage(meta_up) then
|
||||||
|
owl_tech.send_electro_from_wire_in_pos(meta_up,pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
meta:set_string("infotext",owl_tech:get_charge(meta))
|
||||||
|
set_formspect_base_forge_hammer(meta)
|
||||||
|
timer:start(0.2)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--Crafte
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output ="owl_tech:bronze_forge_hammer",
|
||||||
|
recipe = {
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate","owl_tech:circuit_tire_"..i,"owl_tech:"..table_all_machines[i][6].."_plate"},
|
||||||
|
{table_all_machines[i][8][4],"owl_tech:"..table_all_machines[i][6].."_frames","owl_tech:circuit_tire_"..i},
|
||||||
|
{"owl_tech:"..table_all_machines[i][6].."_plate","mcl_anvils:anvil","owl_tech:"..table_all_machines[i][6].."_plate"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,5 +3,6 @@ local name = minetest.get_current_modname()
|
||||||
local path = minetest.get_modpath(name)
|
local path = minetest.get_modpath(name)
|
||||||
|
|
||||||
dofile(path .. "/mashins/steam_machins.lua") --steam mashins
|
dofile(path .. "/mashins/steam_machins.lua") --steam mashins
|
||||||
dofile(path .. "/mashins/vertical_miner.lua") --steam mashins
|
dofile(path .. "/mashins/vertical_miner.lua")
|
||||||
dofile(path .. "/mashins/quarry.lua")
|
dofile(path .. "/mashins/quarry.lua")
|
||||||
|
dofile(path .. "/mashins/electro_machins.lua")
|
|
@ -1,6 +1,7 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local name = minetest.get_current_modname()
|
local name = minetest.get_current_modname()
|
||||||
local path = minetest.get_modpath(name)
|
local path = minetest.get_modpath(name)
|
||||||
|
|
||||||
--Bronze mashins
|
--Bronze mashins
|
||||||
local function set_formspect_base_macerator(meta)
|
local function set_formspect_base_macerator(meta)
|
||||||
local fluid_1_name = owl_tech.get_pull_fluid_name(meta,1)
|
local fluid_1_name = owl_tech.get_pull_fluid_name(meta,1)
|
||||||
|
@ -236,10 +237,10 @@ minetest.register_node("owl_tech:bronze_alloy_smelter", {
|
||||||
end
|
end
|
||||||
elseif recipt_true and owl_tech.get_item_redines(meta)>=100 then
|
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
|
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
|
input_its:set_count(input_its:get_count()-SMELTER_RECIPS[name][1]) --Remove item from input slot
|
||||||
inv:set_stack('input_in', 1, input_its)
|
inv:set_stack('input_in', 1, input_its)
|
||||||
input_its_add:set_count(input_its_add:get_count()-1) --Remove item from input slot
|
input_its_add:set_count(input_its_add:get_count()-SMELTER_RECIPS[name][2]) --Remove item from input slot
|
||||||
inv:set_stack('input_in_add', 1, input_its)
|
inv:set_stack('input_in_add', 1, input_its_add )
|
||||||
|
|
||||||
if not dst_its:is_empty() then-- Add main output
|
if not dst_its:is_empty() then-- Add main output
|
||||||
dst_its:set_count(dst_its:get_count()+SMELTER_RECIPS[name][4])
|
dst_its:set_count(dst_its:get_count()+SMELTER_RECIPS[name][4])
|
||||||
|
@ -254,6 +255,7 @@ minetest.register_node("owl_tech:bronze_alloy_smelter", {
|
||||||
owl_tech.reset_item_redines(meta)
|
owl_tech.reset_item_redines(meta)
|
||||||
end
|
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
|
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 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
|
local steam_new =owl_tech.get_pull_volume(meta,1)-25
|
||||||
owl_tech.set_pull_volume(meta,1,steam_new)
|
owl_tech.set_pull_volume(meta,1,steam_new)
|
||||||
|
@ -930,10 +932,10 @@ minetest.register_node("owl_tech:steel_alloy_smelter", {
|
||||||
end
|
end
|
||||||
elseif recipt_true and owl_tech.get_item_redines(meta)>=100 then
|
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
|
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
|
input_its:set_count(input_its:get_count()-SMELTER_RECIPS[name][1]) --Remove item from input slot
|
||||||
inv:set_stack('input_in', 1, input_its)
|
inv:set_stack('input_in', 1, input_its)
|
||||||
input_its_add:set_count(input_its_add:get_count()-1) --Remove item from input slot
|
input_its_add:set_count(input_its_add:get_count()-SMELTER_RECIPS[name][2]) --Remove item from input slot
|
||||||
inv:set_stack('input_in_add', 1, input_its)
|
inv:set_stack('input_in_add', 1, input_its_add )
|
||||||
|
|
||||||
if not dst_its:is_empty() then-- Add main output
|
if not dst_its:is_empty() then-- Add main output
|
||||||
dst_its:set_count(dst_its:get_count()+SMELTER_RECIPS[name][4])
|
dst_its:set_count(dst_its:get_count()+SMELTER_RECIPS[name][4])
|
||||||
|
@ -1125,12 +1127,12 @@ minetest.register_node("owl_tech:steel_furnance", {
|
||||||
description = S("Steel furnance"),
|
description = S("Steel furnance"),
|
||||||
_doc_items_longdesc = S("Just a furnance - but use steam energy"),
|
_doc_items_longdesc = S("Just a furnance - but use steam energy"),
|
||||||
tiles = {
|
tiles = {
|
||||||
"(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)",
|
"(owl_tech_base_meshanism_side.png^[colorize:#575757:128)",
|
||||||
"(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_steam_input.png",
|
"(owl_tech_base_meshanism_side.png^[colorize:#575757:128)^owl_tech_steam_input.png",
|
||||||
"owl_tech_base_meshanism_side.png^[colorize:#a35900:128",
|
"owl_tech_base_meshanism_side.png^[colorize:#575757:128",
|
||||||
"owl_tech_base_meshanism_side.png^[colorize:#a35900:128",
|
"owl_tech_base_meshanism_side.png^[colorize:#575757:128",
|
||||||
"owl_tech_base_meshanism_side.png^[colorize:#a35900:128",
|
"owl_tech_base_meshanism_side.png^[colorize:#575757:128",
|
||||||
"(owl_tech_base_meshanism_side.png^[colorize:#a35900:128)^owl_tech_forge_face.png",
|
"(owl_tech_base_meshanism_side.png^[colorize:#575757:128)^owl_tech_forge_face.png",
|
||||||
},
|
},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
|
@ -1165,7 +1167,7 @@ minetest.register_node("owl_tech:steel_furnance", {
|
||||||
if owl_tech.get_item_redines(meta)>0 and owl_tech.get_item_redines(meta)<100 then --recipt real
|
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
|
local steam_new =owl_tech.get_pull_volume(meta,1)-10
|
||||||
owl_tech.set_pull_volume(meta,1,steam_new)
|
owl_tech.set_pull_volume(meta,1,steam_new)
|
||||||
owl_tech.add_item_redines(meta,1)
|
owl_tech.add_item_redines(meta,10)
|
||||||
elseif owl_tech.get_item_redines(meta)>=100 then
|
elseif owl_tech.get_item_redines(meta)>=100 then
|
||||||
|
|
||||||
input_its:set_count(input_its:get_count()-1) --Remove item from input slot
|
input_its:set_count(input_its:get_count()-1) --Remove item from input slot
|
||||||
|
@ -1185,7 +1187,7 @@ minetest.register_node("owl_tech:steel_furnance", {
|
||||||
elseif 100<= owl_tech.get_pull_volume(meta,1) and owl_tech.get_item_redines(meta)==0 then --begin for work
|
elseif 100<= 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
|
local steam_new =owl_tech.get_pull_volume(meta,1)-10
|
||||||
owl_tech.set_pull_volume(meta,1,steam_new)
|
owl_tech.set_pull_volume(meta,1,steam_new)
|
||||||
owl_tech.add_item_redines(meta,1)
|
owl_tech.add_item_redines(meta,10)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
owl_tech.reset_item_redines(meta)
|
owl_tech.reset_item_redines(meta)
|
||||||
|
|
|
@ -216,6 +216,49 @@ for i, value in ipairs(metals_ore_array) do
|
||||||
{"","",""}
|
{"","",""}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
--heat element
|
||||||
|
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_heat_element", {
|
||||||
|
description = S(metals_ore_array[i][2].. " heat element"),
|
||||||
|
_doc_items_longdesc = S("simple and reliable heat element"),
|
||||||
|
inventory_image = "owl_tech_base_heat_element.png^[colorize:"..metals_ore_array[i][5]..":128",
|
||||||
|
stack_max = 64,
|
||||||
|
groups = { craftitem=1 },
|
||||||
|
})
|
||||||
|
--Cafte heat element
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output = "owl_tech:"..metals_ore_array[i][1].."_heat_element 2" ,
|
||||||
|
recipe = {
|
||||||
|
{"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_ingot"},
|
||||||
|
{"owl_tech:work_hammer","","owl_tech:work_file",},
|
||||||
|
{"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_ingot"}
|
||||||
|
},
|
||||||
|
replacements = {
|
||||||
|
{"owl_tech:work_hammer", "owl_tech:work_hammer"},
|
||||||
|
{"owl_tech:work_file", "owl_tech:work_file"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
--mesh owl_tech_base_mesh.png
|
||||||
|
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_mesh", {
|
||||||
|
description = S(metals_ore_array[i][2].. " mesh"),
|
||||||
|
_doc_items_longdesc = S("Metallic mesh"),
|
||||||
|
inventory_image = "owl_tech_base_mesh.png^[colorize:"..metals_ore_array[i][5]..":128",
|
||||||
|
stack_max = 64,
|
||||||
|
groups = { craftitem=1 },
|
||||||
|
})
|
||||||
|
--Cafte mesh
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output = "owl_tech:"..metals_ore_array[i][1].."_mesh 2" ,
|
||||||
|
recipe = {
|
||||||
|
{"mcl_mobitems:string","owl_tech:"..metals_ore_array[i][1].."_ingot","mcl_mobitems:string"},
|
||||||
|
{"mcl_mobitems:string","owl_tech:work_file","mcl_mobitems:string"},
|
||||||
|
{"mcl_mobitems:string","owl_tech:"..metals_ore_array[i][1].."_ingot","mcl_mobitems:string"}
|
||||||
|
},
|
||||||
|
replacements = {
|
||||||
|
{"owl_tech:work_file", "owl_tech:work_file"},
|
||||||
|
}
|
||||||
|
})
|
||||||
--dirt dust
|
--dirt dust
|
||||||
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dirt_dust", {
|
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dirt_dust", {
|
||||||
description = S(metals_ore_array[i][2].. " dirt dust"),
|
description = S(metals_ore_array[i][2].. " dirt dust"),
|
||||||
|
@ -999,7 +1042,7 @@ minetest.register_craft({
|
||||||
{"mcl_core:stick", ""}
|
{"mcl_core:stick", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
--lamp
|
--circuit
|
||||||
minetest.register_craftitem("owl_tech:circuit_tire_1", {
|
minetest.register_craftitem("owl_tech:circuit_tire_1", {
|
||||||
description = S("Circuit tire 1"),
|
description = S("Circuit tire 1"),
|
||||||
_doc_items_longdesc = S("Simple lamp circuit"),
|
_doc_items_longdesc = S("Simple lamp circuit"),
|
||||||
|
@ -1007,7 +1050,7 @@ minetest.register_craftitem("owl_tech:circuit_tire_1", {
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = { craftitem=1 },
|
groups = { craftitem=1 },
|
||||||
})
|
})
|
||||||
--Cafte lamp
|
--Cafte circuit
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shaped",
|
type = "shaped",
|
||||||
output = "owl_tech:circuit_tire_1 2",
|
output = "owl_tech:circuit_tire_1 2",
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 764 B |
Binary file not shown.
After Width: | Height: | Size: 943 B |
Loading…
Reference in New Issue