Begin ad plants
|
@ -2,8 +2,18 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
|||
local name = minetest.get_current_modname()
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
--Crops
|
||||
--[[minetest.register_node("owl_tech:crops",{
|
||||
minetest.register_node("owl_tech:crops",{
|
||||
description = "Crops",
|
||||
_tt_help = S("Crops for grow crops"),
|
||||
_doc_items_longdesc = S("Fence gates can be opened or closed and can't be jumped over. Fences will connect nicely to fence gates."),
|
||||
|
@ -30,34 +40,63 @@ local path = minetest.get_modpath(name)
|
|||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "crops")
|
||||
meta:set_int("look_around",1)
|
||||
meta:set_int("state",0)
|
||||
|
||||
meta:set_string("pos-x", 'none')
|
||||
meta:set_string("pos+x", 'none')
|
||||
meta:set_string("pos-z", 'none')
|
||||
meta:set_string("pos+z", 'none')
|
||||
|
||||
meta:set_string("crop1", 'none')
|
||||
meta:set_string("crop2", 'none')
|
||||
|
||||
local timer =minetest.get_node_timer(pos)
|
||||
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("look_around") then
|
||||
local get_two_seed_around = 0
|
||||
if meta:get_int("look_around")==0 then
|
||||
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)
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
if get_two_seed_around==2 then
|
||||
meta:set_int("look_around",1)
|
||||
end
|
||||
end
|
||||
if meta:get_int("look_around")==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
|
||||
set_crops_in_meta_name(meta,meta:get_string("pos+x"))
|
||||
elseif meta:get_string("pos-y")~='none' then
|
||||
set_crops_in_meta_name(meta,meta:get_string("pos-z"))
|
||||
elseif meta:get_string("pos-y")~='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)
|
||||
end
|
||||
end
|
||||
if meta:get_int("look_around")==2 then --spawn new crop
|
||||
|
||||
end
|
||||
timer:start(0.2)
|
||||
end
|
||||
})]]
|
||||
})
|
|
@ -3,3 +3,4 @@ local name = minetest.get_current_modname()
|
|||
local path = minetest.get_modpath(name)
|
||||
|
||||
dofile(path .. "/farming/crops.lua") --Farming
|
||||
dofile(path .. "/farming/seeds.lua") --Farming
|
|
@ -0,0 +1,117 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local name = minetest.get_current_modname()
|
||||
local path = minetest.get_modpath(name)
|
||||
|
||||
local function spawn_crop_from_seed(pos,itemstack,crop_name)
|
||||
minetest.place_node(pos, crop_name)
|
||||
local item_amount = itemstack:get_count()
|
||||
if item_amount==1 then
|
||||
itemstack:clear()
|
||||
end
|
||||
end
|
||||
|
||||
local sel_heights = {
|
||||
-5/16,
|
||||
-2/16,
|
||||
0,
|
||||
3/16,
|
||||
5/16,
|
||||
6/16,
|
||||
7/16,
|
||||
}
|
||||
|
||||
--1)name 2)Name 3)texture base name 4)stages 5)seed texture 6)drop name 7)drop amount
|
||||
|
||||
local list_all_crops ={
|
||||
{"ruber_wheat","Ruber Wheat","owl_tech_ruber_wheat_",8,"owl_tech.seed_ruber_wheat.png"},
|
||||
}
|
||||
|
||||
for i = 1, #list_all_crops, 1 do
|
||||
|
||||
local create, name, longdesc
|
||||
if i == 1 then
|
||||
create = true
|
||||
name = S("Premature "..list_all_crops[i][2] )
|
||||
longdesc = S(
|
||||
"Premature plants grow on farmland under sunlight in 8 stages.On hydrated farmland, they grow faster. They can be harvested at any time but will only yield a profit when mature.")
|
||||
else
|
||||
create = false
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craftitem("owl_tech:seeds_"..list_all_crops[i][1], {
|
||||
description = S(list_all_crops[i][2].." Seeds"),
|
||||
_tt_help = S("Grows on farmland"),
|
||||
_doc_items_longdesc = S("Grows into a wheat plant."),
|
||||
_doc_items_usagehelp = S(" Place the wheat seeds on farmland (which can be created with a hoe) to plant plant."),
|
||||
groups = {craftitem = 1, compostability = 30},
|
||||
inventory_image = list_all_crops[i][5],
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type =="node" then
|
||||
local node_chek = minetest.get_node(pointed_thing.under)
|
||||
if node_chek.name=="mcl_farming:soil" or node_chek.name=="mcl_farming:soil_wet" then
|
||||
minetest.set_node({x=pointed_thing.under.x,y=pointed_thing.under.y+1,z=pointed_thing.under.z},{name="owl_tech:plant_"..list_all_crops[i][1]..1})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
for j = 1, list_all_crops[i][4]-1, 1 do
|
||||
minetest.register_node("owl_tech:plant_"..list_all_crops[i][1]..j, {
|
||||
description = S("Premature "..list_all_crops[i][2]),
|
||||
_doc_items_create_entry = create,
|
||||
_doc_items_entry_name = name,
|
||||
_doc_items_longdesc = longdesc,
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "owl_tech:seeds_"..list_all_crops[i][1],
|
||||
tiles = {"owl_tech_ruber_wheat_"..j..".png"},
|
||||
inventory_image = "owl_tech_ruber_wheat_"..j..".png",
|
||||
wield_image = "owl_tech_ruber_wheat_"..j..".png",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5}
|
||||
},
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1,
|
||||
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_timer = function(pos, elapsed)
|
||||
minetest.chat_send_all("its me!")
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("owl_tech:plant_"..list_all_crops[i][1].."8", {
|
||||
description = S("Mature "..list_all_crops[i][2]),
|
||||
_doc_items_longdesc = S("Mature plants are ready to be harvested for wheat and seeds."),
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {list_all_crops[i][3].."8.png"},
|
||||
inventory_image = list_all_crops[i][3].."8.png",
|
||||
wield_image = list_all_crops[i][3].."8.png",
|
||||
drop = {
|
||||
max_items = 4,
|
||||
items = {
|
||||
{ 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"} }
|
||||
}
|
||||
},
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1, attached_node=1,
|
||||
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 0,
|
||||
})
|
||||
end
|
|
@ -74,3 +74,7 @@ FORGE_HAMMER_RECIPS={
|
|||
LIST_ALL_CROPS={
|
||||
"mcl_farming:wheat","mcl_farming:pumpkintige_unconnct","mcl_farming:beetroot","mcl_farming:melotige_unconnct"
|
||||
}
|
||||
--List all crops breed 1)second crop 2)time ,3)name new crop
|
||||
CROPS_BREED={
|
||||
wheat={"wheat",100},
|
||||
}
|
|
@ -686,7 +686,7 @@ local gems_orew_array={
|
|||
{"sulfur","Sulfur ",true,1,"#c2a800","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",0},
|
||||
{"saltpeter","Saltpeter ",true,1,"#b3e6ee","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",0},
|
||||
{"diamond","Diamond ",true,3,"#77cefb","owl_tech_gem_2.png","owl_tech_gem_block_2.png","owl_tech_dust_block_1.png",0},
|
||||
|
||||
{"raw_ruber","Raw Ruber ",false,1,"#dace00","owl_tech_gem_3.png","owl_tech_gem_block_3.png","owl_tech_dust_block_1.png",0},
|
||||
}
|
||||
for i, value in ipairs(gems_orew_array) do
|
||||
--ore
|
||||
|
|
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |