[farming] Update for #443

This commit is contained in:
LeMagnesium 2016-06-18 11:59:26 +02:00
parent 6d50e91204
commit b698f85c0f
44 changed files with 1057 additions and 1823 deletions

View File

@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
Changelog:
1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also.
1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks).
1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs
1.20b- Tidied code, made api compatible with new 0.4.13 changes and changed to soil texture overlays
@ -146,4 +147,4 @@ Created by TenPlus1
farming_rhubarb_2.png
farming_rhubarb_3.png
farming_rhubarb.png
farming_rhubarb_pie.png
farming_rhubarb_pie.png

View File

@ -0,0 +1,98 @@
local S = farming.intllib
-- barley seeds
minetest.register_node("farming:seed_barley", {
description = S("Barley Seed"),
tiles = {"farming_barley_seed.png"},
inventory_image = "farming_barley_seed.png",
wield_image = "farming_barley_seed.png",
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:barley_1")
end,
})
-- harvested barley
minetest.register_craftitem("farming:barley", {
description = S("Barley"),
inventory_image = "farming_barley.png",
})
-- flour
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {"farming:barley", "farming:barley", "farming:barley", "farming:barley"}
})
-- barley definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_barley_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:barley_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_barley_2.png"}
minetest.register_node("farming:barley_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_barley_3.png"}
minetest.register_node("farming:barley_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_barley_4.png"}
minetest.register_node("farming:barley_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_barley_5.png"}
crop_def.drop = {
items = {
{items = {'farming:barley'}, rarity = 2},
{items = {'farming:seed_barley'}, rarity = 2},
}
}
minetest.register_node("farming:barley_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_barley_6.png"}
crop_def.drop = {
items = {
{items = {'farming:barley'}, rarity = 2},
{items = {'farming:seed_barley'}, rarity = 1},
}
}
minetest.register_node("farming:barley_6", table.copy(crop_def))
-- stage 7 (final)
crop_def.tiles = {"farming_barley_7.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:barley'}, rarity = 1},
{items = {'farming:barley'}, rarity = 3},
{items = {'farming:seed_barley'}, rarity = 1},
{items = {'farming:seed_barley'}, rarity = 3},
}
}
minetest.register_node("farming:barley_7", table.copy(crop_def))

View File

@ -2,39 +2,53 @@
All textures by
(C) Auke Kok <sofar@foo-projects.org>
CC-BY-SA-3.0
--]]
]]
local S = farming.intllib
-- beans
minetest.register_craftitem("farming:beans", {
description = "Green Beans",
description = S("Green Beans"),
inventory_image = "farming_beans.png",
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
return
end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and nod.name == "farming:beanpole" then
minetest.set_node(pointed_thing.under, {name="farming:beanpole_1"})
local nodename = minetest.get_node(pointed_thing.under).name
if nodename == "farming:beanpole" then
minetest.set_node(pointed_thing.under, {name = "farming:beanpole_1"})
minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0})
else
return
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:beans",
placer:get_wield_index()
)
end -- END refill
end
end
return itemstack
end
})
-- Beans can be used for green dye
-- beans can be used for green dye
minetest.register_craft({
output = "dye:green",
recipe = {
@ -42,10 +56,9 @@ minetest.register_craft({
}
})
-- Beanpole
-- beanpole
minetest.register_node("farming:beanpole", {
description = "Bean Pole (place on soil before planting beans)",
description = S("Bean Pole (place on soil before planting beans)"),
drawtype = "plantlike",
tiles = {"farming_beanpole.png"},
inventory_image = "farming_beanpole.png",
@ -54,34 +67,41 @@ minetest.register_node("farming:beanpole", {
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
}
},
drop = "farming:beanpole",
selection_box = farming.select,
groups = {snappy = 3, flammable = 2, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
return
end
local nodename = minetest.get_node(pointed_thing.under).name
if minetest.get_item_group(nodename, "soil") < 2 then
return
end
local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) or minetest.is_protected(top, placer:get_player_name()) then
return
end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
}
nodename = minetest.get_node(top).name
if nodename ~= "air" then
return
end
nod = minetest.get_node_or_nil(top)
if nod and nod.name ~= "air" then return end
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
})
@ -101,9 +121,8 @@ minetest.register_craft({
burntime = 10,
})
-- Define Green Bean growth stages
minetest.register_node("farming:beanpole_1", {
-- green bean definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_beanpole_1.png"},
visual_scale = 1.45,
@ -121,101 +140,38 @@ minetest.register_node("farming:beanpole_1", {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:beanpole_2", {
drawtype = "plantlike",
tiles = {"farming_beanpole_2.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = farming.select,
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:beanpole_1", table.copy(crop_def))
minetest.register_node("farming:beanpole_3", {
drawtype = "plantlike",
tiles = {"farming_beanpole_3.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage2
crop_def.tiles = {"farming_beanpole_2.png"}
minetest.register_node("farming:beanpole_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_beanpole_3.png"}
minetest.register_node("farming:beanpole_3", table.copy(crop_def))
minetest.register_node("farming:beanpole_4", {
drawtype = "plantlike",
tiles = {"farming_beanpole_4.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_beanpole_4.png"}
minetest.register_node("farming:beanpole_4", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:beanpole_5", {
drawtype = "plantlike",
tiles = {"farming_beanpole_5.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
{items = {'farming:beans 3'}, rarity = 1},
{items = {'farming:beans 2'}, rarity = 2},
{items = {'farming:beans 2'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- Wild Green Bean Bush (this is what you find on the map)
-- stage 5 (final)
crop_def.tiles = {"farming_beanpole_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
{items = {'farming:beans 3'}, rarity = 1},
{items = {'farming:beans 2'}, rarity = 2},
{items = {'farming:beans 2'}, rarity = 3},
}
}
minetest.register_node("farming:beanpole_5", table.copy(crop_def))
-- wild green bean bush (this is what you find on the map)
minetest.register_node("farming:beanbush", {
drawtype = "plantlike",
tiles = {"farming_beanbush.png"},
@ -237,4 +193,4 @@ minetest.register_node("farming:beanbush", {
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})
})

View File

@ -1,8 +1,9 @@
--= Blueberries
local S = farming.intllib
-- blueberries
minetest.register_craftitem("farming:blueberries", {
description = "Blueberries",
description = S("Blueberries"),
inventory_image = "farming_blueberries.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1")
@ -10,10 +11,10 @@ minetest.register_craftitem("farming:blueberries", {
on_use = minetest.item_eat(1),
})
-- Blueberry Muffin (Thanks to sosogirl123 for muffin image in deviantart.com)
-- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image)
minetest.register_craftitem("farming:muffin_blueberry", {
description = "Blueberry Muffin",
description = S("Blueberry Muffin"),
inventory_image = "farming_blueberry_muffin.png",
on_use = minetest.item_eat(2),
})
@ -25,9 +26,8 @@ minetest.register_craft({
}
})
-- Define Blueberry growth stages
minetest.register_node("farming:blueberry_1", {
-- blueberry definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_blueberry_1.png"},
paramtype = "light",
@ -40,64 +40,28 @@ minetest.register_node("farming:blueberry_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:blueberry_2", {
drawtype = "plantlike",
tiles = {"farming_blueberry_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:blueberry_1", table.copy(crop_def))
minetest.register_node("farming:blueberry_3", {
drawtype = "plantlike",
tiles = {"farming_blueberry_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_blueberry_2.png"}
minetest.register_node("farming:blueberry_2", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 3
crop_def.tiles = {"farming_blueberry_3.png"}
minetest.register_node("farming:blueberry_3", table.copy(crop_def))
minetest.register_node("farming:blueberry_4", {
drawtype = "plantlike",
tiles = {"farming_blueberry_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:blueberries 2'}, rarity = 1},
{items = {'farming:blueberries'}, rarity = 2},
{items = {'farming:blueberries'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4 (final)
crop_def.tiles = {"farming_blueberry_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:blueberries 2'}, rarity = 1},
{items = {'farming:blueberries'}, rarity = 2},
{items = {'farming:blueberries'}, rarity = 3},
}
}
minetest.register_node("farming:blueberry_4", table.copy(crop_def))

View File

@ -1,9 +1,14 @@
--= Carrot (Original textures from PixelBox texture pack)
-- https://forum.minetest.net/viewtopic.php?id=4990
--[[
Original textures from PixelBox texture pack
https://forum.minetest.net/viewtopic.php?id=4990
]]
local S = farming.intllib
-- carrot
minetest.register_craftitem("farming:carrot", {
description = "Carrot",
description = S("Carrot"),
inventory_image = "farming_carrot.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
@ -11,10 +16,9 @@ minetest.register_craftitem("farming:carrot", {
on_use = minetest.item_eat(4),
})
-- Golden Carrot
-- golden carrot
minetest.register_craftitem("farming:carrot_gold", {
description = "Golden Carrot",
description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(6),
})
@ -28,9 +32,8 @@ minetest.register_craft({
}
})
-- Define Carrot growth stages
minetest.register_node("farming:carrot_1", {
-- carrot definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_carrot_1.png"},
paramtype = "light",
@ -43,133 +46,50 @@ minetest.register_node("farming:carrot_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:carrot_2", {
drawtype = "plantlike",
tiles = {"farming_carrot_2.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:carrot_3", {
drawtype = "plantlike",
tiles = {"farming_carrot_3.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:carrot_1", table.copy(crop_def))
minetest.register_node("farming:carrot_4", {
drawtype = "plantlike",
tiles = {"farming_carrot_4.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_carrot_2.png"}
minetest.register_node("farming:carrot_2", table.copy(crop_def))
minetest.register_node("farming:carrot_5", {
drawtype = "plantlike",
tiles = {"farming_carrot_5.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_carrot_3.png"}
minetest.register_node("farming:carrot_3", table.copy(crop_def))
minetest.register_node("farming:carrot_6", {
drawtype = "plantlike",
tiles = {"farming_carrot_6.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_carrot_4.png"}
minetest.register_node("farming:carrot_4", table.copy(crop_def))
minetest.register_node("farming:carrot_7", {
drawtype = "plantlike",
tiles = {"farming_carrot_7.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:carrot'}, rarity = 1},
{items = {'farming:carrot 2'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_carrot_5.png"}
minetest.register_node("farming:carrot_5", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 6
crop_def.tiles = {"farming_carrot_6.png"}
minetest.register_node("farming:carrot_6", table.copy(crop_def))
minetest.register_node("farming:carrot_8", {
drawtype = "plantlike",
tiles = {"farming_carrot_8.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:carrot 2'}, rarity = 1},
{items = {'farming:carrot 3'}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 7
crop_def.tiles = {"farming_carrot_7.png"}
crop_def.drop = {
items = {
{items = {'farming:carrot'}, rarity = 1},
{items = {'farming:carrot 2'}, rarity = 3},
}
}
minetest.register_node("farming:carrot_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_carrot_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:carrot 2'}, rarity = 1},
{items = {'farming:carrot 3'}, rarity = 2},
}
}
minetest.register_node("farming:carrot_8", table.copy(crop_def))

View File

@ -1,47 +1,56 @@
-- Place Cocoa
local S = farming.intllib
-- place cocoa
function place_cocoa(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt and pt.type ~= "node" then
if not pt or pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
-- return if any of the nodes is not registered
-- return if any of the nodes are not registered
if not minetest.registered_nodes[under.name] then
return
end
-- check if pointing at jungletree
if under.name ~= "default:jungletree" then
if under.name ~= "default:jungletree"
or minetest.get_node(pt.above).name ~= "air" then
return
end
-- add the node and remove 1 item from the itemstack
minetest.set_node(pt.above, {name = plantname})
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:cocoa_beans",
placer:get_wield_index()
)
end -- END refill
end
end
return itemstack
end
--= Cocoa
-- cocoa beans
minetest.register_craftitem("farming:cocoa_beans", {
description = "Cocoa Beans",
description = S("Cocoa Beans"),
inventory_image = "farming_cocoa_beans.png",
on_place = function(itemstack, placer, pointed_thing)
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1")
@ -55,10 +64,9 @@ minetest.register_craft( {
}
})
-- Cookie
-- chocolate cookie
minetest.register_craftitem("farming:cookie", {
description = "Cookie",
description = S("Cookie"),
inventory_image = "farming_cookie.png",
on_use = minetest.item_eat(2),
})
@ -70,10 +78,9 @@ minetest.register_craft( {
}
})
-- Bar of Dark Chocolate (Thanks to Ice Pandora for her deviantart.com chocolate tutorial)
-- bar of dark chocolate (thanks to Ice Pandora for her deviantart.com chocolate tutorial)
minetest.register_craftitem("farming:chocolate_dark", {
description = "Bar of Dark Chocolate",
description = S("Bar of Dark Chocolate"),
inventory_image = "farming_chocolate_dark.png",
on_use = minetest.item_eat(2), --/MFF (Mg|05/26/2015)
})
@ -85,9 +92,8 @@ minetest.register_craft( {
}
})
-- Define Coffee growth stages
minetest.register_node("farming:cocoa_1", {
-- cocoa definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_cocoa_1.png"},
paramtype = "light",
@ -105,81 +111,64 @@ minetest.register_node("farming:cocoa_1", {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:cocoa_2", {
drawtype = "plantlike",
tiles = {"farming_cocoa_2.png"},
paramtype = "light",
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 1'}, rarity = 1},
}
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 1
minetest.register_node("farming:cocoa_1", table.copy(crop_def))
-- Last stage of Cocoa growth does not have growing=1 so abm never has to check these
-- stage2
crop_def.tiles = {"farming_cocoa_2.png"}
crop_def.drop = {
items = {
{items = {'farming:cocoa_beans 1'}, rarity = 1},
}
}
minetest.register_node("farming:cocoa_2", table.copy(crop_def))
minetest.register_node("farming:cocoa_3", {
drawtype = "plantlike",
tiles = {"farming_cocoa_3.png"},
paramtype = "light",
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 2'}, rarity = 1},
{items = {'farming:cocoa_beans 1'}, rarity = 2},
}
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1,
not_in_creative_inventory = 1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- Abm to add random Cocoa Pod to Jungle Tree trunks
-- stage 3 (final)
crop_def.tiles = {"farming_cocoa_3.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:cocoa_beans 2'}, rarity = 1},
{items = {'farming:cocoa_beans 1'}, rarity = 2},
}
}
minetest.register_node("farming:cocoa_3", table.copy(crop_def))
-- add random cocoa pods to jungle tree trunks
minetest.register_abm({
nodenames = {"default:jungletree"},
neighbors = {"default:jungleleaves", "moretrees:jungletree_leaves_green"},
interval = 80,
chance = 20,
interval = 8,
chance = 80,
catch_up = false,
action = function(pos, node)
local dir = math.random(1,50)
local dir = math.random(1, 50)
if dir == 1 then pos.x = pos.x + 1
elseif dir == 2 then pos.x = pos.x - 1
elseif dir == 3 then pos.z = pos.z + 1
elseif dir == 4 then pos.z = pos.z -1
if dir == 1 then
pos.x = pos.x + 1
elseif dir == 2 then
pos.x = pos.x - 1
elseif dir == 3 then
pos.z = pos.z + 1
elseif dir == 4 then
pos.z = pos.z -1
else return
end
local nod = minetest.get_node_or_nil(pos)
if nod then nod = nod.name else return end
local nodename = minetest.get_node(pos).name
if nod == "air"
if nodename == "air"
and minetest.get_node_light(pos) > 12 then
-- print ("COCOA", pos.x, pos.y, pos.z)
--print ("Cocoa Pod added at " .. minetest.pos_to_string(pos))
minetest.set_node(pos, {
name = "farming:cocoa_"..tostring(math.random(1, 3))
name = "farming:cocoa_" .. tostring(math.random(1, 3))
})
end
end,
})
})

View File

@ -1,22 +1,19 @@
--= Coffee
local S = farming.intllib
-- coffee
minetest.register_craftitem("farming:coffee_beans", {
description = "Coffee Beans",
description = S("Coffee Beans"),
inventory_image = "farming_coffee_beans.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1")
end,
})
--= Glass Cup
--minetest.register_craftitem("farming:drinking_cup", {
-- description = "Drinking Cup",
-- inventory_image = "vessels_drinking_cup.png",
--})
-- drinking cup
minetest.register_node("farming:drinking_cup", {
description = "Drinking Cup (empty)",
description = S("Drinking Cup (empty)"),
drawtype = "plantlike",
tiles = {"vessels_drinking_cup.png"},
inventory_image = "vessels_drinking_cup.png",
@ -39,15 +36,9 @@ minetest.register_craft( {
}
})
--= Cold Cup of Coffee
--minetest.register_craftitem("farming:coffee_cup", {
-- description = "Cold Cup of Coffee",
-- inventory_image = "farming_coffee_cup.png",
-- on_use = minetest.item_eat(2, "farming:drinking_cup"),
--})
-- cold cup of coffee
minetest.register_node("farming:coffee_cup", {
description = "Cup of Coffee (cold)",
description = S("Cold Cup of Coffee"),
drawtype = "plantlike",
tiles = {"farming_coffee_cup.png"},
inventory_image = "farming_coffee_cup.png",
@ -67,8 +58,6 @@ minetest.register_craft( {
output = "farming:coffee_cup",
recipe = {
{"farming:drinking_cup", "farming:coffee_beans","bucket:bucket_water"},
{"","",""},
{"","",""}
},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
})
@ -80,15 +69,9 @@ minetest.register_craft({
recipe = "farming:coffee_cup"
})
--= Hot Cup of Coffee
--minetest.register_craftitem("farming:coffee_cup_hot", {
-- description = "Hot Cup of Coffee",
-- inventory_image = "farming_coffee_cup_hot.png",
-- on_use = minetest.item_eat(3, "farming:drinking_cup"),
--})
-- hot cup of coffee
minetest.register_node("farming:coffee_cup_hot", {
description = "Cup of Coffee (hot)",
description = S("Hot Cup of Coffee"),
drawtype = "plantlike",
tiles = {"farming_coffee_cup_hot.png"},
inventory_image = "farming_coffee_cup_hot.png",
@ -104,9 +87,8 @@ minetest.register_node("farming:coffee_cup_hot", {
sounds = default.node_sound_glass_defaults(),
})
-- Define Coffee growth stages
minetest.register_node("farming:coffee_1", {
-- coffee definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_coffee_1.png"},
paramtype = "light",
@ -119,81 +101,32 @@ minetest.register_node("farming:coffee_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:coffee_2", {
drawtype = "plantlike",
tiles = {"farming_coffee_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:coffee_1", table.copy(crop_def))
minetest.register_node("farming:coffee_3", {
drawtype = "plantlike",
tiles = {"farming_coffee_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_coffee_2.png"}
minetest.register_node("farming:coffee_2", table.copy(crop_def))
minetest.register_node("farming:coffee_4", {
drawtype = "plantlike",
tiles = {"farming_coffee_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_coffee_3.png"}
minetest.register_node("farming:coffee_3", table.copy(crop_def))
-- Last stage of growth doesn not have growing group so abm never checks these
-- stage 4
crop_def.tiles = {"farming_coffee_4.png"}
minetest.register_node("farming:coffee_4", table.copy(crop_def))
minetest.register_node("farming:coffee_5", {
drawtype = "plantlike",
tiles = {"farming_coffee_5.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:coffee_beans 2'}, rarity = 1},
{items = {'farming:coffee_beans 2'}, rarity = 2},
{items = {'farming:coffee_beans 2'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5 (final)
crop_def.tiles = {"farming_coffee_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:coffee_beans 2'}, rarity = 1},
{items = {'farming:coffee_beans 2'}, rarity = 2},
{items = {'farming:coffee_beans 2'}, rarity = 3},
}
}
minetest.register_node("farming:coffee_5", table.copy(crop_def))

View File

@ -1,9 +1,14 @@
--= Corn (Original textures from GeMinecraft)
-- http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and
--[[
Original textures from GeMinecraft
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and
]]
local S = farming.intllib
-- corn
minetest.register_craftitem("farming:corn", {
description = "Corn",
description = S("Corn"),
inventory_image = "farming_corn.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
@ -11,10 +16,9 @@ minetest.register_craftitem("farming:corn", {
on_use = minetest.item_eat(3),
})
--= Corn on the Cob (Texture by TenPlus1)
-- corn on the cob (texture by TenPlus1)
minetest.register_craftitem("farming:corn_cob", {
description = "Corn on the Cob",
description = S("Corn on the Cob"),
inventory_image = "farming_corn_cob.png",
on_use = minetest.item_eat(5),
})
@ -26,10 +30,9 @@ minetest.register_craft({
recipe = "farming:corn"
})
--= Ethanol (Thanks to JKMurray for this idea)
minetest.register_craftitem("farming:bottle_ethanol", {
description = "Bottle of Ethanol",
-- ethanol (thanks to JKMurray for this idea)
minetest.register_craftitem("farming:bottle_ethanol", {
description = S("Bottle of Ethanol"),
inventory_image = "farming_bottle_ethanol.png",
})
@ -48,9 +51,8 @@ minetest.register_craft({
replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
})
-- Define Corn growth stages
minetest.register_node("farming:corn_1", {
-- corn definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_corn_1.png"},
paramtype = "light",
@ -63,138 +65,52 @@ minetest.register_node("farming:corn_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:corn_2", {
drawtype = "plantlike",
tiles = {"farming_corn_2.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:corn_1", table.copy(crop_def))
minetest.register_node("farming:corn_3", {
drawtype = "plantlike",
tiles = {"farming_corn_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_corn_2.png"}
minetest.register_node("farming:corn_2", table.copy(crop_def))
minetest.register_node("farming:corn_4", {
drawtype = "plantlike",
tiles = {"farming_corn_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_corn_3.png"}
minetest.register_node("farming:corn_3", table.copy(crop_def))
minetest.register_node("farming:corn_5", {
drawtype = "plantlike",
tiles = {"farming_corn_5.png"},
paramtype = "light",
waving = 1,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_corn_4.png"}
minetest.register_node("farming:corn_4", table.copy(crop_def))
minetest.register_node("farming:corn_6", {
drawtype = "plantlike",
tiles = {"farming_corn_6.png"},
visual_scale = 1.45,
paramtype = "light",
waving = 1,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_corn_5.png"}
minetest.register_node("farming:corn_5", table.copy(crop_def))
minetest.register_node("farming:corn_7", {
drawtype = "plantlike",
tiles = {"farming_corn_7.png"},
visual_scale = 1.45,
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:corn'}, rarity = 1},
{items = {'farming:corn'}, rarity = 2},
{items = {'farming:corn'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 6
crop_def.tiles = {"farming_corn_6.png"}
crop_def.visual_scale = 1.45
minetest.register_node("farming:corn_6", table.copy(crop_def))
-- Last stage of growth doesn not have growing group so abm never checks these
-- stage 7
crop_def.tiles = {"farming_corn_7.png"}
crop_def.drop = {
items = {
{items = {'farming:corn'}, rarity = 1},
{items = {'farming:corn'}, rarity = 2},
{items = {'farming:corn'}, rarity = 3},
}
}
minetest.register_node("farming:corn_7", table.copy(crop_def))
minetest.register_node("farming:corn_8", {
drawtype = "plantlike",
tiles = {"farming_corn_8.png"},
visual_scale = 1.45,
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:corn 2'}, rarity = 1},
{items = {'farming:corn 2'}, rarity = 2},
{items = {'farming:corn 2'}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 8 (final)
crop_def.tiles = {"farming_corn_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:corn 2'}, rarity = 1},
{items = {'farming:corn 2'}, rarity = 2},
{items = {'farming:corn 2'}, rarity = 2},
}
}
minetest.register_node("farming:corn_8", table.copy(crop_def))

View File

@ -1,15 +1,9 @@
-- Cotton Seed
--minetest.register_craftitem("farming:seed_cotton", {
-- description = "Cotton Seed",
-- inventory_image = "farming_cotton_seed.png",
-- on_place = function(itemstack, placer, pointed_thing)
-- return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
-- end,
--})
local S = farming.intllib
-- cotton seeds
minetest.register_node("farming:seed_cotton", {
description = "Cotton Seed",
description = S("Cotton Seed"),
tiles = {"farming_cotton_seed.png"},
inventory_image = "farming_cotton_seed.png",
wield_image = "farming_cotton_seed.png",
@ -25,17 +19,16 @@ minetest.register_node("farming:seed_cotton", {
end,
})
-- Cotton
-- cotton / string
minetest.register_craftitem("farming:cotton", {
description = "Cotton",
description = S("Cotton"),
inventory_image = "farming_cotton.png",
})
minetest.register_alias("farming:string", "farming:cotton")
-- String to Wool
-- cotton to wool
minetest.register_craft({
output = "wool:white",
recipe = {
@ -44,9 +37,8 @@ minetest.register_craft({
}
})
-- Define Cotton growth stages
minetest.register_node("farming:cotton_1", {
-- cotton definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_cotton_1.png"},
paramtype = "light",
@ -59,147 +51,73 @@ minetest.register_node("farming:cotton_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:cotton_2", {
drawtype = "plantlike",
tiles = {"farming_cotton_2.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:cotton_1", table.copy(crop_def))
minetest.register_node("farming:cotton_3", {
drawtype = "plantlike",
tiles = {"farming_cotton_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_cotton_2.png"}
minetest.register_node("farming:cotton_2", table.copy(crop_def))
minetest.register_node("farming:cotton_4", {
drawtype = "plantlike",
tiles = {"farming_cotton_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_cotton_3.png"}
minetest.register_node("farming:cotton_3", table.copy(crop_def))
minetest.register_node("farming:cotton_5", {
drawtype = "plantlike",
tiles = {"farming_cotton_5.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {"farming:seed_cotton"}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_cotton_4.png"}
minetest.register_node("farming:cotton_4", table.copy(crop_def))
minetest.register_node("farming:cotton_6", {
drawtype = "plantlike",
tiles = {"farming_cotton_6.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_cotton_5.png"}
crop_def.drop = {
items = {
{items = {"farming:seed_cotton"}, rarity = 1},
}
}
minetest.register_node("farming:cotton_5", table.copy(crop_def))
minetest.register_node("farming:cotton_7", {
drawtype = "plantlike",
tiles = {"farming_cotton_7.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 6
crop_def.tiles = {"farming_cotton_6.png"}
crop_def.drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
}
}
minetest.register_node("farming:cotton_6", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 7
crop_def.tiles = {"farming_cotton_7.png"}
crop_def.drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
}
}
minetest.register_node("farming:cotton_7", table.copy(crop_def))
minetest.register_node("farming:cotton_8", {
drawtype = "plantlike",
tiles = {"farming_cotton_8.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {"farming:string"}, rarity = 1},
{items = {"farming:string"}, rarity = 2},
{items = {"farming:string"}, rarity = 3},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 8 (final)
crop_def.tiles = {"farming_cotton_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {"farming:string"}, rarity = 1},
{items = {"farming:string"}, rarity = 2},
{items = {"farming:string"}, rarity = 3},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 3},
}
}
minetest.register_node("farming:cotton_8", table.copy(crop_def))
--[[ Cotton (example, is already registered in cotton.lua)
farming.register_plant("farming:cotton", {
description = "Cotton seed",
inventory_image = "farming_cotton_seed.png",
steps = 8,
})]]

View File

@ -1,9 +1,14 @@
--= Cucumber (Original textures from DocFarming mod)
-- https://forum.minetest.net/viewtopic.php?id=3948
--[[
Original textures from DocFarming mod
https://forum.minetest.net/viewtopic.php?id=3948
]]
local S = farming.intllib
-- cucumber
minetest.register_craftitem("farming:cucumber", {
description = "Cucumber",
description = S("Cucumber"),
inventory_image = "farming_cucumber.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")
@ -11,9 +16,8 @@ minetest.register_craftitem("farming:cucumber", {
on_use = minetest.item_eat(4),
})
-- Define Cucumber growth stages
minetest.register_node("farming:cucumber_1", {
-- cucumber definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_cucumber_1.png"},
paramtype = "light",
@ -25,60 +29,27 @@ minetest.register_node("farming:cucumber_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:cucumber_2", {
drawtype = "plantlike",
tiles = {"farming_cucumber_2.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:cucumber_1", table.copy(crop_def))
minetest.register_node("farming:cucumber_3", {
drawtype = "plantlike",
tiles = {"farming_cucumber_3.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_cucumber_2.png"}
minetest.register_node("farming:cucumber_2", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 3
crop_def.tiles = {"farming_cucumber_3.png"}
minetest.register_node("farming:cucumber_3", table.copy(crop_def))
minetest.register_node("farming:cucumber_4", {
drawtype = "plantlike",
tiles = {"farming_cucumber_4.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:cucumber'}, rarity = 1},
{items = {'farming:cucumber 2'}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4 (final)
crop_def.tiles = {"farming_cucumber_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:cucumber'}, rarity = 1},
{items = {'farming:cucumber 2'}, rarity = 2},
}
}
minetest.register_node("farming:cucumber_4", table.copy(crop_def))

View File

@ -1,2 +1,3 @@
default
wool
intllib?

View File

@ -0,0 +1 @@
Adds many plants and food to Minetest

View File

@ -1,6 +1,9 @@
local S = farming.intllib
-- Donut (thanks to Bockwurst for making the donut images)
minetest.register_craftitem("farming:donut", {
description = "Donut",
description = S("Donut"),
inventory_image = "farming_donut.png",
on_use = minetest.item_eat(4),
})
@ -16,7 +19,7 @@ minetest.register_craft({
-- Chocolate Donut
minetest.register_craftitem("farming:donut_chocolate", {
description = "Chocolate Donut",
description = S("Chocolate Donut"),
inventory_image = "farming_donut_chocolate.png",
on_use = minetest.item_eat(6),
})
@ -31,7 +34,7 @@ minetest.register_craft({
-- Apple Donut
minetest.register_craftitem("farming:donut_apple", {
description = "Apple Donut",
description = S("Apple Donut"),
inventory_image = "farming_donut_apple.png",
on_use = minetest.item_eat(6),
})

View File

@ -1,36 +1,49 @@
-- Grapes
local S = farming.intllib
-- grapes
minetest.register_craftitem("farming:grapes", {
description = "Grapes",
description = S("Grapes"),
inventory_image = "farming_grapes.png",
on_use = minetest.item_eat(2),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
return
end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and nod.name == "farming:trellis" then
minetest.set_node(pointed_thing.under, {name="farming:grapes_1"})
local nodename = minetest.get_node(pointed_thing.under).name
if nodename == "farming:trellis" then
minetest.set_node(pointed_thing.under, {name = "farming:grapes_1"})
minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0})
else
return
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:grapes",
placer:get_wield_index()
)
end -- END refill
end
end
return itemstack
end
})
-- Grapes can be used for violet dye
-- grapes can be used for violet dye
minetest.register_craft({
output = "dye:violet",
recipe = {
@ -38,10 +51,9 @@ minetest.register_craft({
}
})
-- Trellis
-- trellis
minetest.register_node("farming:trellis", {
description = "Trellis (place on soil before planting grapes)",
description = S("Trellis (place on soil before planting grapes)"),
drawtype = "plantlike",
tiles = {"farming_trellis.png"},
inventory_image = "farming_trellis.png",
@ -50,34 +62,41 @@ minetest.register_node("farming:trellis", {
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
drop = "farming:trellis",
selection_box = farming.select,
groups = {snappy = 3, flammable = 2, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
return
end
local nodename = minetest.get_node(pointed_thing.under).name
if minetest.get_item_group(nodename, "soil") < 2 then
return
end
local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) or minetest.is_protected(top, placer:get_player_name()) then
return
end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
nodename = minetest.get_node(top).name
if nodename ~= "air" then
return
end
nod = minetest.get_node_or_nil(top)
if nod and nod.name ~= "air" then return end
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
})
@ -97,9 +116,8 @@ minetest.register_craft({
burntime = 15,
})
-- Define Grapes growth stages
minetest.register_node("farming:grapes_1", {
-- grapes definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_grapes_1.png"},
visual_scale = 1.45,
@ -117,163 +135,50 @@ minetest.register_node("farming:grapes_1", {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:grapes_2", {
drawtype = "plantlike",
tiles = {"farming_grapes_2.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
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:grapes_1", table.copy(crop_def))
minetest.register_node("farming:grapes_3", {
drawtype = "plantlike",
tiles = {"farming_grapes_3.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage2
crop_def.tiles = {"farming_grapes_2.png"}
minetest.register_node("farming:grapes_2", table.copy(crop_def))
minetest.register_node("farming:grapes_4", {
drawtype = "plantlike",
tiles = {"farming_grapes_4.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_grapes_3.png"}
minetest.register_node("farming:grapes_3", table.copy(crop_def))
minetest.register_node("farming:grapes_5", {
drawtype = "plantlike",
tiles = {"farming_grapes_5.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_grapes_4.png"}
minetest.register_node("farming:grapes_4", table.copy(crop_def))
minetest.register_node("farming:grapes_6", {
drawtype = "plantlike",
tiles = {"farming_grapes_6.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_grapes_5.png"}
minetest.register_node("farming:grapes_5", table.copy(crop_def))
minetest.register_node("farming:grapes_7", {
drawtype = "plantlike",
tiles = {"farming_grapes_7.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 6
crop_def.tiles = {"farming_grapes_6.png"}
minetest.register_node("farming:grapes_6", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 7
crop_def.tiles = {"farming_grapes_7.png"}
minetest.register_node("farming:grapes_7", table.copy(crop_def))
minetest.register_node("farming:grapes_8", {
drawtype = "plantlike",
tiles = {"farming_grapes_8.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
{items = {'farming:grapes 3'}, rarity = 1},
{items = {'farming:grapes 1'}, rarity = 2},
{items = {'farming:grapes 1'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- Wild Grape Vine (this is what you find on the map)
-- stage 8 (final)
crop_def.tiles = {"farming_grapes_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
{items = {'farming:grapes 3'}, rarity = 1},
{items = {'farming:grapes 1'}, rarity = 2},
{items = {'farming:grapes 1'}, rarity = 3},
}
}
minetest.register_node("farming:grapes_8", table.copy(crop_def))
-- wild grape vine (this is what you find on the map)
minetest.register_node("farming:grapebush", {
drawtype = "plantlike",
tiles = {"farming_grapebush.png"},

View File

@ -1,7 +1,7 @@
-- Override default grass and have it drop Wheat Seeds
for i = 3, 5 do
for i = 1, 5 do
-- Override default grass and have it drop Wheat Seeds
minetest.override_item("default:grass_" .. i, {
drop = {
@ -13,6 +13,20 @@ for i = 1, 5 do
},
})
-- Override default dry grass and have it drop Barley Seeds
if minetest.registered_nodes["default:dry_grass_1"] then
minetest.override_item("default:dry_grass_" .. i, {
drop = {
max_items = 1,
items = {
{items = {'farming:seed_barley'}, rarity = 6},
{items = {'default:dry_grass_1'}},
}
},
})
end
end
-- Override default Jungle Grass and have it drop Cotton Seeds

View File

@ -1,4 +1,6 @@
local S = farming.intllib
-- Hoe registration function
farming.register_hoe = function(name, def)
@ -39,7 +41,6 @@ farming.register_hoe = function(name, def)
})
-- Register its recipe
-- Registration using material made for MFF
if def.material == nil then
minetest.register_craft({
output = name:sub(2),
@ -124,56 +125,56 @@ end
-- Material fields added for MFF
farming.register_hoe(":farming:hoe_wood", {
description = "Wooden Hoe",
description = S("Wooden Hoe"),
inventory_image = "farming_tool_woodhoe.png",
max_uses = 30,
material = "group:wood"
})
farming.register_hoe(":farming:hoe_stone", {
description = "Stone Hoe",
description = S("Stone Hoe"),
inventory_image = "farming_tool_stonehoe.png",
max_uses = 90,
material = "group:stone"
})
farming.register_hoe(":farming:hoe_steel", {
description = "Steel Hoe",
description = S("Steel Hoe"),
inventory_image = "farming_tool_steelhoe.png",
max_uses = 200,
material = "default:steel_ingot"
})
farming.register_hoe(":farming:hoe_bronze", {
description = "Bronze Hoe",
description = S("Bronze Hoe"),
inventory_image = "farming_tool_bronzehoe.png",
max_uses = 220,
material = "default:bronze_ingot"
})
farming.register_hoe(":farming:hoe_silver", {
description = "Silver Hoe",
description = S("Silver Hoe"),
inventory_image = "farming_tool_silverhoe.png",
max_uses = 300,
material = "default:silver_ingot"
})
farming.register_hoe(":farming:hoe_mese", {
description = "Mese Hoe",
description = S("Mese Hoe"),
inventory_image = "farming_tool_mesehoe.png",
max_uses = 350,
material = "default:mese_crystal"
})
farming.register_hoe(":farming:hoe_diamond", {
description = "Diamond Hoe",
description = S("Diamond Hoe"),
inventory_image = "farming_tool_diamondhoe.png",
max_uses = 500,
material = "default:diamond"
})
farming.register_hoe(":farming:hoe_mithril", {
description = "Mithril Hoe",
description = S("Mithril Hoe"),
inventory_image = "farming_tool_mithrilhoe.png",
max_uses = 1000,
material = "default:mithril_ingot"

View File

@ -1,5 +1,5 @@
--[[
Minetest Farming Redo Mod 1.22 (8th December 2015)
Minetest Farming Redo Mod 1.22 (4th June 2016)
by TenPlus1
NEW growing routine by prestidigitator
auto-refill by crabman77
@ -49,34 +49,20 @@ end
local statistics = dofile(farming.path.."/statistics.lua")
dofile(farming.path.."/soil.lua")
dofile(farming.path.."/hoes.lua")
dofile(farming.path.."/grass.lua")
dofile(farming.path.."/wheat.lua")
dofile(farming.path.."/cotton.lua")
dofile(farming.path.."/carrot.lua")
dofile(farming.path.."/potato.lua")
dofile(farming.path.."/tomato.lua")
dofile(farming.path.."/cucumber.lua")
dofile(farming.path.."/corn.lua")
dofile(farming.path.."/coffee.lua")
dofile(farming.path.."/melon.lua")
dofile(farming.path.."/sugar.lua")
dofile(farming.path.."/pumpkin.lua")
dofile(farming.path.."/cocoa.lua")
dofile(farming.path.."/raspberry.lua")
dofile(farming.path.."/blueberry.lua")
dofile(farming.path.."/rhubarb.lua")
dofile(farming.path.."/beanpole.lua")
dofile(farming.path.."/grapes.lua")
dofile(farming.path.."/donut.lua")
dofile(farming.path.."/mapgen.lua")
dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility
-- Intllib
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s) return s end
end
farming.intllib = S
-- Utility Functions
local time_speed = tonumber(minetest.setting_get("time_speed")) or 72
local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or 0 --nil
local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or 0
local function clamp(x, min, max)
return (x < min and min) or (x > max and max) or x
@ -180,7 +166,7 @@ local function plant_name_stage(node)
if type(node) == 'table' then
if node.name then
name = node.name
name = node.name
elseif node.x and node.y and node.z then
node = minetest.get_node_or_nil(node)
name = node and node.name
@ -189,7 +175,9 @@ local function plant_name_stage(node)
name = tostring(node)
end
if not name or name == "ignore" then return nil end
if not name or name == "ignore" then
return nil
end
local sep_pos = name:find("_[^_]+$")
@ -205,8 +193,9 @@ local function plant_name_stage(node)
return name, 0
end
--- Map from node name to
-- { plant_name = ..., name = ..., stage = n, stages_left = { node_name, ... } }
-- Map from node name to
-- { plant_name = ..., name = ..., stage = n, stages_left = { node_name, ... } }
local plant_stages = {}
farming.plant_stages = plant_stages
@ -227,11 +216,15 @@ local function reg_plant_stages(plant_name, stage, force_last)
local node_name = plant_name and plant_name .. "_" .. stage
local node_def = node_name and minetest.registered_nodes[node_name]
if not node_def then return nil end
if not node_def then
return nil
end
local stages = plant_stages[node_name]
if stages then return stages end
if stages then
return stages
end
if minetest.get_item_group(node_name, "growing") > 0 then
@ -253,13 +246,21 @@ local function reg_plant_stages(plant_name, stage, force_last)
minetest.override_item(node_name,
{
on_construct = function(pos)
if old_constr then old_constr(pos) end
if old_constr then
old_constr(pos)
end
farming.handle_growth(pos)
end,
on_destruct = function(pos)
minetest.get_node_timer(pos):stop()
if old_destr then old_destr(pos) end
if old_destr then
old_destr(pos)
end
end,
on_timer = function(pos, elapsed)
@ -290,6 +291,7 @@ register_plant_node = function(node)
local plant_name, stage = plant_name_stage(node)
if plant_name then
local stages = reg_plant_stages(plant_name, stage, false)
return stages and #stages.stages_left
else
@ -299,7 +301,9 @@ end
local function set_growing(pos, stages_left)
if not stages_left then return end
if not stages_left then
return
end
local timer = minetest.get_node_timer(pos)
@ -319,28 +323,33 @@ local function set_growing(pos, stages_left)
end
end
--- Detects a plant type node at the given position, starting or stopping the plant growth timer as appopriate
--
-- @param pos
-- The node's position.
-- @param node
-- The cached node table if available, or nil.
-- Detects a plant type node at the given position, starting
-- or stopping the plant growth timer as appopriate
-- @param pos
-- The node's position.
-- @param node
-- The cached node table if available, or nil.
function farming.handle_growth(pos, node)
if not pos then return end
if not pos then
return
end
local stages_left = register_plant_node(node or pos)
if stages_left then set_growing(pos, stages_left) end
if stages_left then
set_growing(pos, stages_left)
end
end
minetest.after(0,
function()
for _, node_def in pairs(minetest.registered_nodes) do
register_plant_node(node_def)
end
end)
minetest.after(0, function()
for _, node_def in pairs(minetest.registered_nodes) do
register_plant_node(node_def)
end
end)
local abm_func = farming.handle_growth
@ -349,6 +358,7 @@ if farming.DEBUG then
local normal_abm_func = abm_func
abm_func = function(...)
local t0 = minetest.get_us_time()
local r = { normal_abm_func(...) }
local t1 = minetest.get_us_time()
@ -362,73 +372,92 @@ end
-- Just in case a growing type or added node is missed (also catches existing
-- nodes added to map before timers were incorporated).
minetest.register_abm({
minetest.register_abm({
nodenames = { "group:growing" },
interval = 300,
chance = 1,
action = abm_func
})
--- Plant timer function.
--
-- Grows plants under the right conditions.
-- Plant timer function.
-- Grows plants under the right conditions.
function farming.plant_growth_timer(pos, elapsed, node_name)
local stages = plant_stages[node_name]
if not stages then return false end
if not stages then
return false
end
local max_growth = #stages.stages_left
if max_growth <= 0 then return false end
if max_growth <= 0 then
return false
end
if stages.plant_name == "farming:cocoa" then
if not minetest.find_node_near(pos, 1, { "default:jungletree", "moretrees:jungletree_leaves_green" }) then
if not minetest.find_node_near(pos, 1,
{"default:jungletree", "moretrees:jungletree_leaves_green"}) then
return true
end
else
local under = minetest.get_node_or_nil({ x = pos.x, y = pos.y - 1, z = pos.z })
local under = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z })
if not under or under.name ~= "farming:soil_wet" then return true end
if minetest.get_item_group(under.name, "soil") < 3 then
return true
end
end
local growth
local light_pos = { x = pos.x, y = pos.y, z = pos.z }
local light_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
local lambda = elapsed / STAGE_LENGTH_AVG
if lambda < 0.1 then return true end
if lambda < 0.1 then
return true
end
if max_growth == 1 or lambda < 2.0 then
local light = (minetest.get_node_light(light_pos) or 0) -- CHANGED
local light = (minetest.get_node_light(light_pos) or 0)
--print ("light level:", light)
if not in_range(light, MIN_LIGHT, MAX_LIGHT) then return true end
if not in_range(light, MIN_LIGHT, MAX_LIGHT) then
return true
end
growth = 1
else
local night_light = (minetest.get_node_light(light_pos, 0) or 0) -- CHANGED
local day_light = (minetest.get_node_light(light_pos, 0.5) or 0) -- ChANGED
local night_light = (minetest.get_node_light(light_pos, 0) or 0)
local day_light = (minetest.get_node_light(light_pos, 0.5) or 0)
local night_growth = in_range(night_light, MIN_LIGHT, MAX_LIGHT)
local day_growth = in_range(day_light, MIN_LIGHT, MAX_LIGHT)
if not night_growth then
if not day_growth then return true end
if not day_growth then
return true
end
lambda = day_time(elapsed) / STAGE_LENGTH_AVG
elseif not day_growth then
lambda = night_time(elapsed) / STAGE_LENGTH_AVG
end
growth = statistics.poisson(lambda, max_growth)
if growth < 1 then return true end
if growth < 1 then
return true
end
end
if minetest.registered_nodes[stages.stages_left[growth]] then
minetest.swap_node(pos, { name = stages.stages_left[growth] })
minetest.swap_node(pos, {name = stages.stages_left[growth]})
else
return true
end
@ -472,6 +501,7 @@ local can_refill_plant = {
["farming:beans_1"] = "farming:beans",
["farming:rhubarb_1"] = "farming:rhubarb",
["farming:cocoa_1"] = "farming:cocoa_beans",
["farming:barley_1"] = "farming:seed_barley",
}
function farming.refill_plant(player, plantname, index)
@ -479,7 +509,9 @@ function farming.refill_plant(player, plantname, index)
local inv = player:get_inventory()
local old_stack = inv:get_stack("main", index)
if old_stack:get_name() ~= "" then return end
if old_stack:get_name() ~= "" then
return
end
for i, stack in pairs(inv:get_list("main")) do
@ -492,7 +524,7 @@ function farming.refill_plant(player, plantname, index)
return
end
end
end -- END refill
end
-- Place Seeds on Soil
@ -508,6 +540,11 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y + 1 then
return
end
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name]
or not minetest.registered_nodes[above.name] then
@ -537,6 +574,8 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
minetest.set_node(pt.above, {name = plantname, param2 = 1})
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
@ -567,7 +606,7 @@ farming.register_plant = function(name, def)
-- Check def table
if not def.description then
def.description = "Seed"
def.description = S("Seed")
end
if not def.inventory_image then
@ -595,7 +634,7 @@ farming.register_plant = function(name, def)
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1")
end
end,
})
-- Register harvest
@ -620,7 +659,7 @@ farming.register_plant = function(name, def)
-- Last step doesn't need growing=1 so Abm never has to check these
if i == def.steps then
g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}
g.growing = 0
end
local node_name = mname .. ":" .. pname .. "_" .. i
@ -638,7 +677,7 @@ farming.register_plant = function(name, def)
sounds = default.node_sound_leaves_defaults(),
})
register_plant_node(node_name)
-- register_plant_node(node_name)
end
-- Return info
@ -646,9 +685,29 @@ farming.register_plant = function(name, def)
return r
end
--[[ Cotton (example, is already registered in cotton.lua)
farming.register_plant("farming:cotton", {
description = "Cotton2 seed",
inventory_image = "farming_cotton_seed.png",
steps = 8,
})]]
-- load crops
dofile(farming.path.."/soil.lua")
dofile(farming.path.."/hoes.lua")
dofile(farming.path.."/grass.lua")
dofile(farming.path.."/wheat.lua")
dofile(farming.path.."/cotton.lua")
dofile(farming.path.."/carrot.lua")
dofile(farming.path.."/potato.lua")
dofile(farming.path.."/tomato.lua")
dofile(farming.path.."/cucumber.lua")
dofile(farming.path.."/corn.lua")
dofile(farming.path.."/coffee.lua")
dofile(farming.path.."/melon.lua")
dofile(farming.path.."/sugar.lua")
dofile(farming.path.."/pumpkin.lua")
dofile(farming.path.."/cocoa.lua")
dofile(farming.path.."/raspberry.lua")
dofile(farming.path.."/blueberry.lua")
dofile(farming.path.."/rhubarb.lua")
dofile(farming.path.."/beanpole.lua")
dofile(farming.path.."/grapes.lua")
dofile(farming.path.."/barley.lua")
dofile(farming.path.."/donut.lua")
dofile(farming.path.."/mapgen.lua")
dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility

View File

@ -1,8 +1,9 @@
--= Melon
local S = farming.intllib
-- melon
minetest.register_craftitem("farming:melon_slice", {
description = "Melon Slice",
description = S("Melon Slice"),
inventory_image = "farming_melon_slice.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
@ -26,9 +27,8 @@ minetest.register_craft({
}
})
-- Define Melon growth stages
minetest.register_node("farming:melon_1", {
-- melon definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_melon_1.png"},
paramtype = "light",
@ -41,119 +41,42 @@ minetest.register_node("farming:melon_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:melon_2", {
drawtype = "plantlike",
tiles = {"farming_melon_2.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:melon_1", table.copy(crop_def))
minetest.register_node("farming:melon_3", {
drawtype = "plantlike",
tiles = {"farming_melon_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_melon_2.png"}
minetest.register_node("farming:melon_2", table.copy(crop_def))
minetest.register_node("farming:melon_4", {
drawtype = "plantlike",
tiles = {"farming_melon_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_melon_3.png"}
minetest.register_node("farming:melon_3", table.copy(crop_def))
minetest.register_node("farming:melon_5", {
drawtype = "plantlike",
tiles = {"farming_melon_5.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_melon_4.png"}
minetest.register_node("farming:melon_4", table.copy(crop_def))
minetest.register_node("farming:melon_6", {
drawtype = "plantlike",
tiles = {"farming_melon_6.png"},
paramtype = "light",
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_melon_5.png"}
minetest.register_node("farming:melon_5", table.copy(crop_def))
minetest.register_node("farming:melon_7", {
drawtype = "plantlike",
tiles = {"farming_melon_7.png"},
paramtype = "light",
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 6
crop_def.tiles = {"farming_melon_6.png"}
minetest.register_node("farming:melon_6", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 7
crop_def.tiles = {"farming_melon_7.png"}
minetest.register_node("farming:melon_7", table.copy(crop_def))
minetest.register_node("farming:melon_8", {
--drawtype = "nodebox",
description = "Melon",
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"},
paramtype = "light",
walkable = true,
drop = {
items = {
{items = {'farming:melon_slice 9'}, rarity = 1},
}
},
groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1},
sounds = default.node_sound_wood_defaults(),
})
-- stage 8 (final)
crop_def.drawtype = "nodebox"
crop_def.description = S("Melon")
crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}
crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5}
crop_def.walkable = true
crop_def.groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1}
crop_def.drop = "farming:melon_slice 9"
minetest.register_node("farming:melon_8", table.copy(crop_def))

View File

@ -0,0 +1 @@
name = farming

View File

@ -1,9 +1,14 @@
--= Potato (Original textures from DocFarming mod)
-- https://forum.minetest.net/viewtopic.php?id=3948
--[[
Original textures from DocFarming mod
https://forum.minetest.net/viewtopic.php?id=3948
]]
local S = farming.intllib
-- potato
minetest.register_craftitem("farming:potato", {
description = "Potato",
description = S("Potato"),
inventory_image = "farming_potato.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
@ -11,8 +16,9 @@ minetest.register_craftitem("farming:potato", {
on_use = minetest.item_eat(1),
})
-- baked potato
minetest.register_craftitem("farming:baked_potato", {
description = "Baked Potato",
description = S("Baked Potato"),
inventory_image = "farming_baked_potato.png",
on_use = minetest.item_eat(6),
})
@ -24,9 +30,8 @@ minetest.register_craft({
recipe = "farming:potato"
})
-- Define Potato growth stages
minetest.register_node("farming:potato_1", {
-- potato definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_potato_1.png"},
paramtype = "light",
@ -40,68 +45,33 @@ minetest.register_node("farming:potato_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:potato_2", {
drawtype = "plantlike",
tiles = {"farming_potato_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:potato_1", table.copy(crop_def))
minetest.register_node("farming:potato_3", {
drawtype = "plantlike",
tiles = {"farming_potato_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:potato'}, rarity = 1},
{items = {'farming:potato'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_potato_2.png"}
minetest.register_node("farming:potato_2", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 3
crop_def.tiles = {"farming_potato_3.png"}
crop_def.drop = {
items = {
{items = {'farming:potato'}, rarity = 1},
{items = {'farming:potato'}, rarity = 3},
}
}
minetest.register_node("farming:potato_3", table.copy(crop_def))
minetest.register_node("farming:potato_4", {
drawtype = "plantlike",
tiles = {"farming_potato_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:potato 2'}, rarity = 1},
{items = {'farming:potato 3'}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_potato_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:potato 2'}, rarity = 1},
{items = {'farming:potato 3'}, rarity = 2},
}
}
minetest.register_node("farming:potato_4", table.copy(crop_def))

View File

@ -1,8 +1,13 @@
--= Pumpkin (Big thanks to the PainterlyPack.net for Minecraft for allowing me to use these textures)
--[[
Big thanks to PainterlyPack.net for allowing me to use these textures
]]
local S = farming.intllib
-- pumpkin
minetest.register_node("farming:pumpkin", {
description = "Pumpkin",
description = S("Pumpkin"),
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
@ -20,8 +25,9 @@ minetest.register_node("farming:pumpkin", {
sounds = default.node_sound_wood_defaults(),
})
-- pumpkin slice
minetest.register_craftitem("farming:pumpkin_slice", {
description = "Pumpkin Slice",
description = S("Pumpkin Slice"),
inventory_image = "farming_pumpkin_slice.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
@ -45,9 +51,9 @@ minetest.register_craft({
}
})
-- Jack 'O Lantern
-- jack 'o lantern
minetest.register_node("farming:jackolantern", {
description = "Jack 'O Lantern",
description = S("Jack 'O Lantern"),
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
@ -66,7 +72,6 @@ minetest.register_node("farming:jackolantern", {
})
minetest.register_node("farming:jackolantern_on", {
description = "Jack 'O Lantern",
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
@ -95,15 +100,15 @@ minetest.register_craft({
}
})
-- Pumpkin Bread
-- pumpkin bread
minetest.register_craftitem("farming:pumpkin_bread", {
description = ("Pumpkin Bread"),
description = S("Pumpkin Bread"),
inventory_image = "farming_pumpkin_bread.png",
on_use = minetest.item_eat(8)
})
minetest.register_craftitem("farming:pumpkin_dough", {
description = "Pumpkin Dough",
description = S("Pumpkin Dough"),
inventory_image = "farming_pumpkin_dough.png",
})
@ -120,9 +125,8 @@ minetest.register_craft({
cooktime = 10
})
-- Define Pumpkin growth stages
minetest.register_node("farming:pumpkin_1", {
-- pumpkin definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_pumpkin_1.png"},
paramtype = "light",
@ -136,125 +140,42 @@ minetest.register_node("farming:pumpkin_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:pumpkin_2", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:pumpkin_1", table.copy(crop_def))
minetest.register_node("farming:pumpkin_3", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_pumpkin_2.png"}
minetest.register_node("farming:pumpkin_2", table.copy(crop_def))
minetest.register_node("farming:pumpkin_4", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_pumpkin_3.png"}
minetest.register_node("farming:pumpkin_3", table.copy(crop_def))
minetest.register_node("farming:pumpkin_5", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_5.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_pumpkin_4.png"}
minetest.register_node("farming:pumpkin_4", table.copy(crop_def))
minetest.register_node("farming:pumpkin_6", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_6.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_pumpkin_5.png"}
minetest.register_node("farming:pumpkin_5", table.copy(crop_def))
minetest.register_node("farming:pumpkin_7", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_7.png"},
paramtype = "light",
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 6
crop_def.tiles = {"farming_pumpkin_6.png"}
minetest.register_node("farming:pumpkin_6", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 7
crop_def.tiles = {"farming_pumpkin_7.png"}
minetest.register_node("farming:pumpkin_7", table.copy(crop_def))
minetest.register_node("farming:pumpkin_8", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_8.png"},
paramtype = "light",
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:pumpkin_slice 9'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_defaults(),
})
-- stage 8 (final)
crop_def.tiles = {"farming_pumpkin_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:pumpkin_slice 9'}, rarity = 1},
}
}
minetest.register_node("farming:pumpkin_8", table.copy(crop_def))

View File

@ -1,8 +1,9 @@
--= Raspberries
local S = farming.intllib
-- raspberries
minetest.register_craftitem("farming:raspberries", {
description = "Raspberries",
description = S("Raspberries"),
inventory_image = "farming_raspberries.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1")
@ -10,10 +11,9 @@ minetest.register_craftitem("farming:raspberries", {
on_use = minetest.item_eat(1),
})
-- Raspberry Smoothie
-- raspberry smoothie
minetest.register_craftitem("farming:smoothie_raspberry", {
description = "Raspberry Smoothie",
description = S("Raspberry Smoothie"),
inventory_image = "farming_raspberry_smoothie.png",
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
})
@ -27,9 +27,8 @@ minetest.register_craft({
}
})
-- Define Raspberry growth stages
minetest.register_node("farming:raspberry_1", {
-- raspberries definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_raspberry_1.png"},
paramtype = "light",
@ -42,64 +41,28 @@ minetest.register_node("farming:raspberry_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:raspberry_2", {
drawtype = "plantlike",
tiles = {"farming_raspberry_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:raspberry_1", table.copy(crop_def))
minetest.register_node("farming:raspberry_3", {
drawtype = "plantlike",
tiles = {"farming_raspberry_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_raspberry_2.png"}
minetest.register_node("farming:raspberry_2", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 3
crop_def.tiles = {"farming_raspberry_3.png"}
minetest.register_node("farming:raspberry_3", table.copy(crop_def))
minetest.register_node("farming:raspberry_4", {
drawtype = "plantlike",
tiles = {"farming_raspberry_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:raspberries 2'}, rarity = 1},
{items = {'farming:raspberries'}, rarity = 2},
{items = {'farming:raspberries'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4 (final)
crop_def.tiles = {"farming_raspberry_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:raspberries 2'}, rarity = 1},
{items = {'farming:raspberries'}, rarity = 2},
{items = {'farming:raspberries'}, rarity = 3},
}
}
minetest.register_node("farming:raspberry_4", table.copy(crop_def))

View File

@ -1,8 +1,9 @@
--= Rhubarb
local S = farming.intllib
-- rhubarb
minetest.register_craftitem("farming:rhubarb", {
description = "Rhubarb",
description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
@ -10,8 +11,9 @@ minetest.register_craftitem("farming:rhubarb", {
on_use = minetest.item_eat(1),
})
-- rhubarb pie
minetest.register_craftitem("farming:rhubarb_pie", {
description = "Rhubarb Pie",
description = S("Rhubarb Pie"),
inventory_image = "farming_rhubarb_pie.png",
on_use = minetest.item_eat(6),
})
@ -25,9 +27,8 @@ minetest.register_craft({
}
})
-- Define Rhubarb growth stages
minetest.register_node("farming:rhubarb_1", {
-- rhubarb definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_rhubarb_1.png"},
paramtype = "light",
@ -40,47 +41,24 @@ minetest.register_node("farming:rhubarb_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:rhubarb_2", {
drawtype = "plantlike",
tiles = {"farming_rhubarb_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:rhubarb_1", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage2
crop_def.tiles = {"farming_rhubarb_2.png"}
minetest.register_node("farming:rhubarb_2", table.copy(crop_def))
minetest.register_node("farming:rhubarb_3", {
drawtype = "plantlike",
tiles = {"farming_rhubarb_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:rhubarb 2'}, rarity = 1},
{items = {'farming:rhubarb'}, rarity = 2},
{items = {'farming:rhubarb'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3 (final)
crop_def.tiles = {"farming_rhubarb_3.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:rhubarb 2'}, rarity = 1},
{items = {'farming:rhubarb'}, rarity = 2},
{items = {'farming:rhubarb'}, rarity = 3},
}
}
minetest.register_node("farming:rhubarb_3", table.copy(crop_def))

View File

@ -1,6 +1,9 @@
local S = farming.intllib
-- normal soil
minetest.register_node("farming:soil", {
description = "Soil",
description = S("Soil"),
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2},
@ -9,7 +12,7 @@ minetest.register_node("farming:soil", {
-- wet soil
minetest.register_node("farming:soil_wet", {
description = "Wet Soil",
description = S("Wet Soil"),
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3},
@ -61,4 +64,4 @@ minetest.register_abm({
minetest.set_node(pos, {name = "default:dirt"})
end
end,
})
})

View File

@ -1,8 +1,10 @@
local S = farming.intllib
--= Sugar
minetest.register_craftitem("farming:sugar", {
description = "Sugar",
description = S("Sugar"),
inventory_image = "farming_sugar.png",
})
@ -11,4 +13,4 @@ minetest.register_craft({
cooktime = 3,
output = "farming:sugar 2",
recipe = "default:papyrus",
})
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 193 B

View File

@ -1,9 +1,14 @@
--= Tomato (Original textures from link below)
-- http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1288375-food-plus-mod-more-food-than-you-can-imagine-v2-9)
--[[
Textures edited from:
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1288375-food-plus-mod-more-food-than-you-can-imagine-v2-9)
]]
local S = farming.intllib
-- tomato
minetest.register_craftitem("farming:tomato", {
description = "Tomato",
description = S("Tomato"),
inventory_image = "farming_tomato.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
@ -11,9 +16,8 @@ minetest.register_craftitem("farming:tomato", {
on_use = minetest.item_eat(4),
})
-- Define Tomato growth stages
minetest.register_node("farming:tomato_1", {
-- tomato definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_tomato_1.png"},
paramtype = "light",
@ -26,133 +30,49 @@ minetest.register_node("farming:tomato_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:tomato_2", {
drawtype = "plantlike",
tiles = {"farming_tomato_2.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:tomato_1", table.copy(crop_def))
minetest.register_node("farming:tomato_3", {
drawtype = "plantlike",
tiles = {"farming_tomato_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage2
crop_def.tiles = {"farming_tomato_2.png"}
minetest.register_node("farming:tomato_2", table.copy(crop_def))
minetest.register_node("farming:tomato_4", {
drawtype = "plantlike",
tiles = {"farming_tomato_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_tomato_3.png"}
minetest.register_node("farming:tomato_3", table.copy(crop_def))
minetest.register_node("farming:tomato_5", {
drawtype = "plantlike",
tiles = {"farming_tomato_5.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_tomato_4.png"}
minetest.register_node("farming:tomato_4", table.copy(crop_def))
minetest.register_node("farming:tomato_6", {
drawtype = "plantlike",
tiles = {"farming_tomato_6.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_tomato_5.png"}
minetest.register_node("farming:tomato_5", table.copy(crop_def))
minetest.register_node("farming:tomato_7", {
drawtype = "plantlike",
tiles = {"farming_tomato_7.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:tomato'}, rarity = 1},
{items = {'farming:tomato'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 6
crop_def.tiles = {"farming_tomato_6.png"}
minetest.register_node("farming:tomato_6", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 7
crop_def.tiles = {"farming_tomato_7.png"}
crop_def.drop = {
items = {
{items = {'farming:tomato'}, rarity = 1},
{items = {'farming:tomato'}, rarity = 3},
}
}
minetest.register_node("farming:tomato_7", table.copy(crop_def))
minetest.register_node("farming:tomato_8", {
drawtype = "plantlike",
tiles = {"farming_tomato_8.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:tomato 3'}, rarity = 1},
{items = {'farming:tomato 3'}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 8 (final)
crop_def.tiles = {"farming_tomato_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:tomato 3'}, rarity = 1},
{items = {'farming:tomato 3'}, rarity = 2},
}
}
minetest.register_node("farming:tomato_8", table.copy(crop_def))

View File

@ -1,18 +1,9 @@
--= Wheat
-- Wheat Seed
--minetest.register_craftitem("farming:seed_wheat", {
-- description = "Wheat Seed",
-- inventory_image = "farming_wheat_seed.png",
-- on_place = function(itemstack, placer, pointed_thing)
-- return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
-- end,
--})
local S = farming.intllib
-- wheat seeds
minetest.register_node("farming:seed_wheat", {
description = "Wheat Seed",
description = S("Wheat Seed"),
tiles = {"farming_wheat_seed.png"},
inventory_image = "farming_wheat_seed.png",
wield_image = "farming_wheat_seed.png",
@ -28,17 +19,15 @@ minetest.register_node("farming:seed_wheat", {
end,
})
-- Harvested Wheat
-- harvested wheat
minetest.register_craftitem("farming:wheat", {
description = "Wheat",
description = S("Wheat"),
inventory_image = "farming_wheat.png",
})
-- Straw
-- straw
minetest.register_node("farming:straw", {
description = "Straw",
description = S("Straw"),
tiles = {"farming_straw.png"},
is_ground_content = false,
groups = {snappy = 3, flammable = 4},
@ -62,9 +51,8 @@ minetest.register_craft({
})
-- flour
minetest.register_craftitem("farming:flour", {
description = "Flour",
description = S("Flour"),
inventory_image = "farming_flour.png",
})
@ -74,12 +62,11 @@ minetest.register_craft({
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
})
-- Bread
-- bread
minetest.register_craftitem("farming:bread", {
description = "Bread",
description = S("Bread"),
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(4), --MFF 4
on_use = minetest.item_eat(5),
})
minetest.register_craft({
@ -89,9 +76,8 @@ minetest.register_craft({
recipe = "farming:flour"
})
-- Define Wheat growth stages
minetest.register_node("farming:wheat_1", {
-- wheat definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_wheat_1.png"},
paramtype = "light",
@ -100,152 +86,69 @@ minetest.register_node("farming:wheat_1", {
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing=1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:wheat_2", {
drawtype = "plantlike",
tiles = {"farming_wheat_2.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
sounds = default.node_sound_leaves_defaults()
}
minetest.register_node("farming:wheat_3", {
drawtype = "plantlike",
tiles = {"farming_wheat_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
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:wheat_1", table.copy(crop_def))
minetest.register_node("farming:wheat_4", {
drawtype = "plantlike",
tiles = {"farming_wheat_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 2
crop_def.tiles = {"farming_wheat_2.png"}
minetest.register_node("farming:wheat_2", table.copy(crop_def))
minetest.register_node("farming:wheat_5", {
drawtype = "plantlike",
tiles = {"farming_wheat_5.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 3
crop_def.tiles = {"farming_wheat_3.png"}
minetest.register_node("farming:wheat_3", table.copy(crop_def))
minetest.register_node("farming:wheat_6", {
drawtype = "plantlike",
tiles = {"farming_wheat_6.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 4
crop_def.tiles = {"farming_wheat_4.png"}
minetest.register_node("farming:wheat_4", table.copy(crop_def))
minetest.register_node("farming:wheat_7", {
drawtype = "plantlike",
tiles = {"farming_wheat_7.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 5
crop_def.tiles = {"farming_wheat_5.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 2},
}
}
minetest.register_node("farming:wheat_5", table.copy(crop_def))
-- Last stage of growth does not have growing group so abm never checks these
-- stage 6
crop_def.tiles = {"farming_wheat_6.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 1},
}
}
minetest.register_node("farming:wheat_6", table.copy(crop_def))
minetest.register_node("farming:wheat_8", {
drawtype = "plantlike",
tiles = {"farming_wheat_8.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 2},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- stage 7
crop_def.tiles = {"farming_wheat_7.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
}
minetest.register_node("farming:wheat_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_wheat_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
}
minetest.register_node("farming:wheat_8", table.copy(crop_def))