owl_tech/custom_recips/recips_table_and_some_metod...

43 lines
2.0 KiB
Lua
Executable File

--setter and getter mashine tire
function owl_tech.get_mashine_tire(meta)
return meta:get_int("_tire")
end
function owl_tech.set_mashine_tire(meta,value)
meta:set_int("_tire",value)
end
--------------------------------
-- maceratro recips func
function owl_tech.can_macaerat_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) -- chek for tire , and slots for free space for res and add res
local ret =false
if MACERATO_RECIPS[name][2]<=owl_tech.get_mashine_tire(meta)
and (dst_its:is_empty() or(dst_its:get_name()==MACERATO_RECIPS[name][3] and dst_its:get_count()+MACERATO_RECIPS[name][4]<=dst_its:get_stack_max()))
and (dst_add_its:is_empty() or(dst_add_its:get_name()==MACERATO_RECIPS[name][7] and dst_add_its:get_count()+MACERATO_RECIPS[name][8]<=dst_add_its:get_stack_max())) then
ret =true
end
return ret
end
--------------------------------
-- sieve recips func
function owl_tech.can_recips_go_in_this_mashien(meta,name,dst_its,dst_add_its) -- chek for tire , and slots for free space for res and add res
local ret =false
if SIEV_RESIPS[name][2]<=owl_tech.get_mashine_tire(meta)
and (dst_its:is_empty() or(dst_its:get_name()==SIEV_RESIPS[name][3] and dst_its:get_count()+SIEV_RESIPS[name][4]<=dst_its:get_stack_max()))
and (dst_add_its:is_empty() or(dst_add_its:get_name()==SIEV_RESIPS[name][7] and dst_add_its:get_count()+SIEV_RESIPS[name][8]<=dst_add_its:get_stack_max())) then
ret =true
end
return ret
end
--------------------------------
-- smelter recips func
function owl_tech.can_smelter_recips_recips_go_in_this_mashien(meta,name,dst_its) -- chek for tire , and slots for free space for res and add res
local ret =false
if SMELTER_RECIPS[name][5]<=owl_tech.get_mashine_tire(meta)
and (dst_its:is_empty() or(dst_its:get_name()==SMELTER_RECIPS[name][3] and dst_its:get_count()+SMELTER_RECIPS[name][4]<=dst_its:get_stack_max())) then
ret =true
end
return ret
end
--------------------------------