Fix crops
This commit is contained in:
parent
c79ee075cf
commit
f50c8276ad
|
@ -57,31 +57,32 @@ minetest.register_node("owl_tech:crops",{
|
|||
meta:set_string("grow_in",'')
|
||||
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
timer:start(10)
|
||||
timer:start(0.2)
|
||||
end,
|
||||
on_timer = function (pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
if meta:get_int("state")==0 and minetest.get_node(pos).name== 'mcl_core:soil_wet' then
|
||||
if meta:get_int("state")==0 and minetest.get_node({x=pos.x ,y=pos.y-1,z=pos.z}).name== 'mcl_farming:soil_wet' then
|
||||
local get_two_seed_around = 0
|
||||
for i = 1, #LIST_ALL_CROPS ,1 do
|
||||
if minetest.get_node({x=pos.x-1 ,y=pos.y,z=pos.z}).name == LIST_ALL_CROPS[i] then
|
||||
for j, value1 in pairs(LIST_CROSS_CROPS) do
|
||||
if minetest.get_node({x=pos.x-1 ,y=pos.y,z=pos.z}).name == LIST_CROSS_CROPS[j] and meta:get_string("pos-x")=="none" then
|
||||
meta:set_string("pos-x",minetest.get_node({x=pos.x-1 ,y=pos.y,z=pos.z}).name)
|
||||
get_two_seed_around = get_two_seed_around + 1
|
||||
end
|
||||
if minetest.get_node({x=pos.x+1 ,y=pos.y,z=pos.z}).name == LIST_ALL_CROPS[i] then
|
||||
if minetest.get_node({x=pos.x+1 ,y=pos.y,z=pos.z}).name == LIST_CROSS_CROPS[j] and meta:get_string("pos+x")=="none"then
|
||||
meta:set_string("pos+x",minetest.get_node({x=pos.x+1 ,y=pos.y,z=pos.z}).name)
|
||||
get_two_seed_around = get_two_seed_around + 1
|
||||
end
|
||||
if minetest.get_node({x=pos.x ,y=pos.y,z=pos.z-1}).name == LIST_ALL_CROPS[i] then
|
||||
if minetest.get_node({x=pos.x ,y=pos.y,z=pos.z-1}).name == LIST_CROSS_CROPS[j] and meta:get_string("pos-z")=="none"then
|
||||
meta:set_string("pos-z",minetest.get_node({x=pos.x ,y=pos.y,z=pos.z-1}).name)
|
||||
get_two_seed_around = get_two_seed_around + 1
|
||||
end
|
||||
if minetest.get_node({x=pos.x ,y=pos.y,z=pos.z+1}).name == LIST_ALL_CROPS[i] then
|
||||
if minetest.get_node({x=pos.x ,y=pos.y,z=pos.z+1}).name == LIST_CROSS_CROPS[j] and meta:get_string("pos+z")=="none"then
|
||||
meta:set_string("pos+z",minetest.get_node({x=pos.x ,y=pos.y,z=pos.z+1}).name)
|
||||
get_two_seed_around = get_two_seed_around + 1
|
||||
end
|
||||
end
|
||||
minetest.chat_send_all(get_two_seed_around)
|
||||
if get_two_seed_around==2 then
|
||||
meta:set_int("state",1)
|
||||
end
|
||||
|
@ -127,6 +128,6 @@ minetest.register_node("owl_tech:crops",{
|
|||
minetest.set_node(pos, {name=meta:get_string("grow_in")})
|
||||
end
|
||||
end
|
||||
timer:start(10)
|
||||
timer:start(0.2)
|
||||
end
|
||||
})
|
|
@ -120,9 +120,9 @@ FORGE_HAMMER_RECIPS={
|
|||
bronze_ingot = {(1),(1),("owl_tech:bronze_plate"),(1),(ingot_duration),(0),("none"),(0),("owl_tech:bronze_ingot")},
|
||||
}
|
||||
--List of all crops
|
||||
LIST_ALL_CROPS={
|
||||
"owl_tech:steel_ball","owl_tech:silverr_char","owl_tech:tin_plague","owl_tech:diamond_king","owl_tech:iron_maiden"
|
||||
,"owl_tech:copgrow","owl_tech:coaltus","owl_tech:ruber_wheat","mcl_farming:wheat","mcl_farming:pumpkintige_unconnct","mcl_farming:beetroot","mcl_farming:melotige_unconnct","mcl_farming:carrot","mcl_farming:potato_item"
|
||||
LIST_CROSS_CROPS={
|
||||
"owl_tech:ruber_wheat","mcl_farming:wheat","mcl_farming:pumpkintige_unconnct","mcl_farming:beetroot","mcl_farming:melotige_unconnct","mcl_farming:carrot","mcl_farming:potato_item","mcl_farming:wheat","owl_tech:steel_ball","owl_tech:silverr_char","owl_tech:tin_plague","owl_tech:diamond_king","owl_tech:iron_maiden"
|
||||
,"owl_tech:copgrow","owl_tech:coaltus"
|
||||
}
|
||||
--List all crops breed 1)time ,2)name new crop
|
||||
CROPS_BREED={
|
||||
|
|
|
@ -948,7 +948,7 @@ for i = 1, #table_all_machines, 1 do
|
|||
if meta:get_int("work_delay")>0 then
|
||||
meta:set_int("work_delay",meta:get_int("work_delay")-1)
|
||||
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")>01
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue