changed local definitions; all crops are spawning, which should spawn.

master
A. Demant 2018-09-28 06:33:31 +02:00
parent 511ac254db
commit 9a44e11c90
5 changed files with 125 additions and 72 deletions

View File

@ -170,7 +170,6 @@ farming.register_plant = function(name, def)
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,pointed_thing) or itemstack
end
return farming.place_seed(itemstack, placer, pointed_thing, seed_name)
end,
next_plant = harvest_name .. "_1",
@ -218,8 +217,7 @@ farming.register_plant = function(name, def)
local drop = {
items = {
{items = {harvest_name}},
}
}
}}
-- if seeds are not crafted out of harvest, drop additional seeds
if def.groups.drop_seed ~= nil then
table.insert(drop.items,1,{items={seed_name}})
@ -335,7 +333,7 @@ farming.register_plant = function(name, def)
if def.groups.no_spawn == nil then
-- print("spawn "..dump(def.spawnon))
for j,onpl in ipairs(def.spawnon.spawnon) do
local sdef={
local deco_def={
deco_type = "simple",
place_on = onpl,
sidelen = 16,
@ -354,7 +352,7 @@ farming.register_plant = function(name, def)
num_spawn_by = def.spawnon.spawn_num,
biomes = farming.get_biomes(def)
}
minetest.register_decoration(sdef)
minetest.register_decoration(deco_def)
end
end
-- Return

View File

@ -58,27 +58,4 @@ for name,def in pairs(minetest.registered_biomes) do
end
--print(table.maxn(farming.possible_biomes))
farming.plant_def={
paramtype2 = "meshoptions",
steps = 8, -- steps till full-grown plant
mean_grow_time=20, -- mean time till next step
range_grow_time=3, -- plus/minus for random generator
max_harvest=2, -- max amount of harvesting item for full grown plant
-- eat_hp=1, -- set in config for eatable plants
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"},
groups = {grain = 1, flammable = 4},
place_param2 = 3,
min_temp=10,
max_temp=50,
min_humidity=10,
max_humidity=70,
spawnon = { spawnon = farming.change_soil or {"default:dirt_with_grass"},
spawn_min = 0,
spawn_max = 42,
spawnby = nil,
scale = 0.006, -- 0.006
spawn_num = -1}
}

View File

@ -1,17 +1,37 @@
-- Cotton
local S = farming.intllib
--[[
local possible_biomes={}
for name,def in pairs(minetest.registered_biomes) do
if def.heat_point > 20 and def.heat_point < 60 and def.humidity_point > 20 and def.humidity_point < 70 then
table.insert(possible_biomes,1,name)
end
end
local def=farming.plant_def
def.description = S("Cotton Seed")
def.inventory_image = "farming_cotton_seed.png"
def.groups.cotton=1
]]
local cdef={
paramtype2 = "meshoptions",
steps = 8, -- steps till full-grown plant
mean_grow_time=20, -- mean time till next step
range_grow_time=3, -- plus/minus for random generator
max_harvest=2, -- max amount of harvesting item for full grown plant
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"},
groups = {cotton = 1, flammable = 4},
place_param2 = 3,
min_temp=10,
max_temp=50,
min_humidity=10,
max_humidity=70,
spawnon = { spawnon = farming.change_soil or {"default:dirt_with_grass"},
spawn_min = 0,
spawn_max = 42,
spawnby = nil,
scale = 0.006, -- 0.006
spawn_num = -1},
description = S("Cotton Seed"),
inventory_image = "farming_cotton_seed.png",
}
--[[
local def={
description = S("Cotton Seed"),
@ -33,9 +53,12 @@ local def={
spawn_num = -1}
}
]]
if(table.getn(possible_biomes)>0) then
def.biomes=possible_biomes
end
farming.register_plant("farming:cotton", def)
--if(table.getn(possible_biomes)>0) then
-- cdef.biomes=possible_biomes
--end
print("cotton")
print(dump(cdef))
print(dump(def))
farming.register_plant("farming:cotton", cdef)

View File

@ -7,18 +7,41 @@ for name,def in pairs(minetest.registered_biomes) do
table.insert(possible_biomes,1,name)
end
end
local def=farming.plant_def
def.description = S("Strawberry")
def.inventory_image = "farming_strawberry.png"
def.eat_hp=2
def.groups.food=1
def.steps=4
def.max_harvest=2
def.groups.food_wheat=1
local sdef={
paramtype2 = "meshoptions",
steps = 8, -- steps till full-grown plant
mean_grow_time=20, -- mean time till next step
range_grow_time=3, -- plus/minus for random generator
max_harvest=2, -- max amount of harvesting item for full grown plant
-- eat_hp=1, -- set in config for eatable plants
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"},
groups = {food=1,grain = 1, flammable = 4},
place_param2 = 3,
min_temp=10,
max_temp=50,
min_humidity=10,
max_humidity=70,
spawnon = { spawnon = farming.change_soil or {"default:dirt_with_grass"},
spawn_min = 0,
spawn_max = 42,
spawnby = nil,
scale = 0.006, -- 0.006
spawn_num = -1},
description = S("Strawberry"),
inventory_image = "farming_strawberry.png",
eat_hp=2,
steps=4,
max_harvest=2,
}
--if(table.getn(possible_biomes)>0) then
-- def.biomes=possible_biomes
--end
print("strawberry")
print(dump(sdef))
print(dump(def))
farming.register_plant("farming:strawberry", def)
farming.register_plant("farming:strawberry", sdef)

View File

@ -1,33 +1,65 @@
-- WHEAT
local S = farming.intllib
local def=farming.plant_def
def.description = S("Wheat Seed")
def.inventory_image = "farming_wheat_seed.png"
def.eat_hp=1
def.next_plant="farming:culturewheat"
def.next_plant_rarity=12
def.groups.food_wheat=1
--print(dump(def))
local w1def={
paramtype2 = "meshoptions",
steps = 8, -- steps till full-grown plant
mean_grow_time=20, -- mean time till next step
range_grow_time=3, -- plus/minus for random generator
max_harvest=2, -- max amount of harvesting item for full grown plant
-- eat_hp=1, -- set in config for eatable plants
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"},
groups = {food_wheat=1,grain = 1, flammable = 4},
place_param2 = 3,
min_temp=10,
max_temp=50,
min_humidity=10,
max_humidity=70,
spawnon = { spawnon = farming.change_soil or {"default:dirt_with_grass"},
spawn_min = 0,
spawn_max = 42,
spawnby = nil,
scale = 0.006, -- 0.006
spawn_num = -1},
description = S("Wheat Seed"),
inventory_image = "farming_wheat_seed.png",
eat_hp=1,
next_plant="farming:culturewheat",
next_plant_rarity=12,
}
print(dump(w1def))
--if(table.getn(farming.possible_biomes)>0) then
-- def.biomes=farming.possible_biomes
--end
farming.register_plant("farming:wheat", def)
farming.register_plant("farming:wheat", w1def)
local def=farming.plant_def
def.description = S("Culture Wheat Seed")
def.inventory_image = "farming_culturewheat_seed.png"
def.eat_hp=1
def.steps=4
def.eat_hp=1
def.max_harvest=4
def.min_light=11
def.mean_grow_time=20
def.range_grow_time=5
def.groups.food_wheat=1
def.groups.no_spawn=1
if(table.getn(farming.possible_biomes)>0) then
def.biomes=farming.possible_biomes
end
farming.register_plant("farming:culturewheat", def)
local wdef={
paramtype2 = "meshoptions",
steps = 8, -- steps till full-grown plant
mean_grow_time=20, -- mean time till next step
range_grow_time=3, -- plus/minus for random generator
max_harvest=2, -- max amount of harvesting item for full grown plant
-- eat_hp=1, -- set in config for eatable plants
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"},
groups = {food_wheat=1,no_spawn=1,grain = 1, flammable = 4},
place_param2 = 3,
min_temp=10,
max_temp=50,
min_humidity=10,
max_humidity=70,
description = S("Culture Wheat Seed"),
inventory_image = "farming_culturewheat_seed.png",
eat_hp=1,
steps=4,
eat_hp=1,
max_harvest=4,
min_light=11,
mean_grow_time=20,
range_grow_time=5,
}
farming.register_plant("farming:culturewheat", wdef)