New plant
|
@ -20,13 +20,15 @@ minetest.register_craftitem("owl_tech:stick_of_truef", {
|
|||
minetest.chat_send_player(name, "Node name-"..((minetest.get_node(pos)).name))
|
||||
minetest.chat_send_player(name, "Biom name -"..(biomeinfo.get_v6_biome(pos)))
|
||||
minetest.chat_send_player(name, "Biom humidity -"..(biomeinfo.get_v6_humidity(pos)))
|
||||
minetest.chat_send_player(name, "Biom heat -"..(biomeinfo.get_v6_heat(pos)))
|
||||
minetest.chat_send_player(name, "Biom heat -"..(biomeinfo.get_v6_heat(pos)))
|
||||
minetest.chat_send_player(name, "Time of day -"..(minetest.get_timeofday()))
|
||||
elseif pointed_thing.type == "object" then
|
||||
pos = pointed_thing.ref:get_pos()
|
||||
minetest.chat_send_player(name, "Object pos-"..(minetest.pos_to_string(pos)))
|
||||
minetest.chat_send_player(name, "Biom name -"..(biomeinfo.get_v6_biome(pos)))
|
||||
minetest.chat_send_player(name, "Biom humidity -"..(biomeinfo.get_v6_humidity(pos)))
|
||||
minetest.chat_send_player(name, "Biom heat -"..(biomeinfo.get_v6_heat(pos)))
|
||||
minetest.chat_send_player(name, "Time of day -"..(minetest.get_timeofday()))
|
||||
else
|
||||
minetest.chat_send_player(name, "Dont use it in air -finde node or some object")
|
||||
end
|
||||
|
|
|
@ -5,10 +5,11 @@ local path = minetest.get_modpath(name)
|
|||
local function set_crops_in_meta_name(meta,name)
|
||||
if meta:get_string("crop1")=='none' then
|
||||
meta:set_string("crop1",name)
|
||||
do return end
|
||||
elseif meta:get_string("crop2")=='none' then
|
||||
meta:set_string("crop1",name)
|
||||
do return end
|
||||
return
|
||||
end
|
||||
if meta:get_string("crop2")=='none' then
|
||||
meta:set_string("crop2",name)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,7 +30,7 @@ minetest.register_node("owl_tech:crops",{
|
|||
node_box = {
|
||||
type = "fixed",
|
||||
fixed ={{-0.45,-0.5,-0.45,-0.4,0.5,-0.4},
|
||||
{-0.45,-0.5,-0.45,-0.4,0.5,-0.4},
|
||||
{0.45,-0.5,-0.45,0.4,0.5,-0.4},
|
||||
{-0.45,-0.5,0.45,-0.4,0.5,0.4},
|
||||
{0.45,-0.5,0.45,0.4,0.5,0.4}
|
||||
},
|
||||
|
@ -39,8 +40,11 @@ minetest.register_node("owl_tech:crops",{
|
|||
_mcl_blast_resistance = 0.1,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "crops")
|
||||
|
||||
meta:set_string("infotext", "empty")
|
||||
meta:set_int("state",0)
|
||||
meta:set_int("max_redines",0)
|
||||
meta:set_int("redines",0)
|
||||
|
||||
meta:set_string("pos-x", 'none')
|
||||
meta:set_string("pos+x", 'none')
|
||||
|
@ -50,14 +54,17 @@ minetest.register_node("owl_tech:crops",{
|
|||
meta:set_string("crop1", 'none')
|
||||
meta:set_string("crop2", 'none')
|
||||
|
||||
meta:set_string("grow_in",'')
|
||||
|
||||
meta:set_string()
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
timer:start(0.2)
|
||||
timer:start(10)
|
||||
end,
|
||||
on_timer = function (pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
local get_two_seed_around = 0
|
||||
if meta:get_int("look_around")==0 then
|
||||
if meta:get_int("state")==0 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
|
||||
meta:set_string("pos-x",minetest.get_node({x=pos.x-1 ,y=pos.y,z=pos.z}).name)
|
||||
|
@ -77,26 +84,51 @@ minetest.register_node("owl_tech:crops",{
|
|||
end
|
||||
end
|
||||
if get_two_seed_around==2 then
|
||||
meta:set_int("look_around",1)
|
||||
meta:set_int("state",1)
|
||||
end
|
||||
end
|
||||
if meta:get_int("look_around")==1 then --look for name of crops found
|
||||
if meta:get_int("state")==1 then --look for name of crops found
|
||||
if meta:get_string("pos-x")~='none' then
|
||||
set_crops_in_meta_name(meta,meta:get_string("pos-x"))
|
||||
elseif meta:get_string("pos+x")~='none' then
|
||||
end
|
||||
if meta:get_string("pos+x")~='none' then
|
||||
set_crops_in_meta_name(meta,meta:get_string("pos+x"))
|
||||
elseif meta:get_string("pos-y")~='none' then
|
||||
end
|
||||
if meta:get_string("pos-z")~='none' then
|
||||
set_crops_in_meta_name(meta,meta:get_string("pos-z"))
|
||||
elseif meta:get_string("pos-y")~='none' then
|
||||
end
|
||||
if meta:get_string("pos+z")~='none' then
|
||||
set_crops_in_meta_name(meta,meta:get_string("pos+z"))
|
||||
end
|
||||
if meta:get_string("crop1")=='none'and meta:get_string("crop2")=='none' then
|
||||
meta:set_int("look_around",2)
|
||||
if meta:get_string("crop1")~='none'and meta:get_string("crop2")~='none' then
|
||||
meta:set_int("state",2)
|
||||
end
|
||||
end
|
||||
if meta:get_int("look_around")==2 then --spawn new crop
|
||||
|
||||
if meta:get_int("state")==2 then --spawn new crop
|
||||
meta:set_string('crop1',string.gsub(meta:get_string("crop1"),"mcl_farming:",''))
|
||||
meta:set_string('crop2',string.gsub(meta:get_string("crop2"),"mcl_farming:",''))
|
||||
meta:set_string('crop1',string.gsub(meta:get_string("crop1"),"owl_tech:",''))
|
||||
meta:set_string('crop2',string.gsub(meta:get_string("crop2"),"owl_tech:",''))
|
||||
|
||||
minetest.chat_send_all(meta:get_string("crop1").." "..meta:get_string("crop2"))
|
||||
if CROPS_BREED[meta:get_string("crop1")..meta:get_string("crop2")] then
|
||||
meta:set_int("state",3)
|
||||
meta:set_string("grow_in",CROPS_BREED[meta:get_string("crop1")..meta:get_string("crop2")][2])
|
||||
meta:set_int("max_redines", CROPS_BREED[meta:get_string("crop1")..meta:get_string("crop2")][1])
|
||||
elseif CROPS_BREED[meta:get_string("crop2")..meta:get_string("crop1")] then
|
||||
meta:set_int("state",3)
|
||||
meta:set_string("grow_in",CROPS_BREED[meta:get_string("crop2")..meta:get_string("crop1")][2])
|
||||
meta:set_int("max_redines", CROPS_BREED[meta:get_string("crop2")..meta:get_string("crop1")][1])
|
||||
end
|
||||
end
|
||||
timer:start(0.2)
|
||||
if meta:get_int("state")==3 then
|
||||
meta:set_string("infotext", "somthing_grow")
|
||||
if meta:get_int("redines")>=meta:get_int("max_redines") then
|
||||
meta:set_int("redines",meta:get_int("redines")+1)
|
||||
else
|
||||
minetest.set_node(pos, {name=meta:get_string("grow_in")})
|
||||
end
|
||||
end
|
||||
timer:start(10)
|
||||
end
|
||||
})
|
|
@ -20,10 +20,47 @@ local sel_heights = {
|
|||
7/16,
|
||||
}
|
||||
|
||||
--1)name 2)Name 3)texture base name 4)stages 5)seed texture 6)drop name 7)drop amount
|
||||
local function get_dirt_under(pos)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name =='mcl_core:soil_wet' then
|
||||
if minetest.get_node({x=pos.x,y=pos.y-2,z=pos.z}).name =='mcl_core:dirt' then
|
||||
if minetest.get_node({x=pos.x,y=pos.y-3,z=pos.z}).name =='mcl_core:dirt' then
|
||||
return 3
|
||||
else
|
||||
return 2
|
||||
end
|
||||
else
|
||||
return 1
|
||||
end
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
local function get_air_aboth(pos)
|
||||
local a = 0
|
||||
for i = 1, 30, 1 do
|
||||
if minetest.get_node({x=pos.x,y=pos.y+i,z=pos.z}).name =='air' then
|
||||
a = i
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
return math.modf(a/10)
|
||||
end
|
||||
|
||||
local function calculate_grow_cof(pos)
|
||||
local a = get_dirt_under(pos) --dirt under
|
||||
local b = get_air_aboth(pos) -- air aboth
|
||||
local c = biomeinfo.get_v6_humidity(pos)*3 -- humidity (0-1)
|
||||
local d = biomeinfo.get_v6_heat(pos)*3 --heat (0-1)
|
||||
return a+b+c+d
|
||||
end
|
||||
|
||||
--1)name 2)Name 3)texture base name 4)stages 5)seed texture 6)drop name 7)drop amount 8)cof of grow to up 9) Special node under dirt
|
||||
|
||||
local list_all_crops ={
|
||||
{"ruber_wheat","Ruber Wheat","owl_tech_ruber_wheat_",8,"owl_tech.seed_ruber_wheat.png"},
|
||||
{"ruber_wheat","Ruber Wheat","owl_tech_ruber_wheat_",8,"owl_tech.seed_ruber_wheat.png","owl_tech:ruber_dust",2,200,"none"},
|
||||
{"coaltus","Coaltus","owl_tech_coaltus_",8,"owl_tech.seed_coaltus.png","owl_tech:coal_dust",1,200,"owl_tech:coal_block"},
|
||||
}
|
||||
|
||||
for i = 1, #list_all_crops, 1 do
|
||||
|
@ -88,6 +125,23 @@ for i = 1, #list_all_crops, 1 do
|
|||
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 0,
|
||||
on_construct = function(pos)
|
||||
local meta= minetest.get_meta(pos)--calculate_grow_cof(pos)
|
||||
meta:set_int("curent_grow",0)
|
||||
meta:set_int("max_cof",list_all_crops[i][8])
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
timer:start(10)
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("curent_grow",meta:get_int("curent_grow")+calculate_grow_cof(pos))
|
||||
if meta:get_int("max_cof")<=meta:get_int("curent_grow")
|
||||
and (list_all_crops[i][9]=="none" or list_all_crops[i][9] == minetest.get_node({x=pos.x,y=pos.y-4,z=pos.z}).name ) then
|
||||
minetest.set_node(pos,{name="owl_tech:plant_"..list_all_crops[i][1]..j+1})
|
||||
end
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
timer:start(10)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -109,7 +163,8 @@ for i = 1, #list_all_crops, 1 do
|
|||
{ items = {"owl_tech:seeds_"..list_all_crops[i][1]} },
|
||||
{ items = {"owl_tech:seeds_"..list_all_crops[i][1]}, rarity = 2},
|
||||
{ items = {"owl_tech:seeds_"..list_all_crops[i][1]}, rarity = 5},
|
||||
{ items = {"owl_tech:raw_ruber_dust"} }
|
||||
{ items = {list_all_crops[i][6].." "..list_all_crops[i][7]} },
|
||||
{ items = {list_all_crops[i][6].." "..list_all_crops[i][7]+1} , rarity = 4}
|
||||
}
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1, attached_node=1,
|
||||
|
|
|
@ -72,9 +72,9 @@ FORGE_HAMMER_RECIPS={
|
|||
}
|
||||
--List of all crops
|
||||
LIST_ALL_CROPS={
|
||||
"mcl_farming:wheat","mcl_farming:pumpkintige_unconnct","mcl_farming:beetroot","mcl_farming:melotige_unconnct"
|
||||
"mcl_farming:wheat","mcl_farming:pumpkintige_unconnct","mcl_farming:beetroot","mcl_farming:melotige_unconnct","mcl_farming:carrot"
|
||||
}
|
||||
--List all crops breed 1)second crop 2)time ,3)name new crop
|
||||
--List all crops breed 1)time ,2)name new crop
|
||||
CROPS_BREED={
|
||||
wheat={"wheat",100},
|
||||
wheatwheat={100,"owl_tech:plant_ruber_wheat"},
|
||||
}
|
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.1 KiB |