add strawberrys

master
tchncs 2016-05-21 23:56:18 +02:00
parent 6c7ae1f960
commit 2b7dda38da
12 changed files with 137 additions and 1 deletions

View File

@ -65,6 +65,7 @@ dofile(farming.path.."/sugar.lua")
dofile(farming.path.."/pumpkin.lua")
dofile(farming.path.."/cocoa.lua")
dofile(farming.path.."/raspberry.lua")
dofile(farming.path.."/strawberry.lua")
dofile(farming.path.."/blueberry.lua")
dofile(farming.path.."/rhubarb.lua")
dofile(farming.path.."/beanpole.lua")

View File

@ -35,6 +35,7 @@ function farming.register_mgv6_decorations()
register_plant("blueberry_4", 3, 10, "", -1)
register_plant("beanbush", 18, 35, "", -1)
register_plant("grapebush", 25, 45, "", -1)
register_plant("strawberry_4", 3, 10, "", -1)
end
-- v7 maps have a beach so plants growing near water is limited to 6 high
@ -53,6 +54,7 @@ function farming.register_mgv7_decorations()
register_plant("blueberry_4", 3, 10, "", -1)
register_plant("beanbush", 18, 35, "", -1)
register_plant("grapebush", 25, 45, "", -1)
register_plant("strawberry_4", 3, 10, "", -1)
end
-- detect mapgen
@ -60,4 +62,4 @@ if minetest.get_mapgen_params().mgname == "v6" then
farming.register_mgv6_decorations()
else
farming.register_mgv7_decorations()
end
end

133
strawberry.lua Normal file
View File

@ -0,0 +1,133 @@
-- [ strawberrys from github.com/tenplus1/farming ]
--
-- Strawberry (can also be planted as seed)
minetest.register_craftitem("farming:strawberry", {
description = "Strawberry",
inventory_image = "strawberry.png",
wield_image = "strawberry.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:strawberry_1")
end,
on_use = minetest.item_eat(1),
})
-- added by illuna
minetest.register_craftitem("farming:strawberry", {
description = "Strawberry Seeds",
inventory_image = "farming_strawberry_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:strawberry_1")
end,
})
-- Define Strawberry Bush growth stages
local crop_def = {
drawtype = "plantlike",
tiles = {"strawberry_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
},
groups = {
snappy = 3, flammable =2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
}
--stage 1
minetest.register_node("farming:strawberry_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"strawberry_2.png"}
minetest.register_node("farming:strawberry_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"strawberry_3.png"}
minetest.register_node("farming:strawberry_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"strawberry_4.png"}
minetest.register_node("farming:strawberry_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"strawberry_5.png"}
minetest.register_node("farming:strawberry_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"strawberry_6.png"}
crop_def.drop = {
items = {
{items = {"farming:strawberry 1"},rarity = 2},
{items = {"farming:strawberry 2"},rarity = 3},
}
}
minetest.register_node("farming:strawberry_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"strawberry_7.png"}
crop_def.drop = {
items = {
{items = {"farming:strawberry 1"},rarity = 1},
{items = {"farming:strawberry 2"},rarity = 3},
}
}
minetest.register_node("farming:strawberry_7", table.copy(crop_def))
-- stage 8
crop_def.tiles = {"strawberry_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {"farming:strawberry 2"},rarity = 1},
{items = {"farming:strawberry 3"},rarity = 3},
}
}
minetest.register_node("farming:strawberry_8", table.copy(crop_def))
-- growing routine if farming redo isn't present
if not farming or not farming.mod or farming.mod ~= "redo" then
minetest.register_abm({
nodenames = {
"farming:strawberry_1", "farming:strawberry_2", "farming:strawberry_3",
"farming:strawberry_4", "farming:strawberry_5", "farming:strawberry_6",
"farming:strawberry_7"
},
neighbors = {"farming:soil_wet"},
interval = 9,
chance = 20,
catch_up = false,
action = function(pos, node)
-- are we on wet soil?
pos.y = pos.y - 1
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
return
end
pos.y = pos.y + 1
-- do we have enough light?
local light = minetest.get_node_light(pos)
if not light
or light < 13 then
return
end
-- grow to next stage
local num = node.name:split("_")[2]
node.name = "farming:strawberry_" .. tonumber(num + 1)
minetest.swap_node(pos, node)
end
})
end -- END IF

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B