1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-26 02:30:38 +01:00

[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: 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.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.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 1.20b- Tidied code, made api compatible with new 0.4.13 changes and changed to soil texture overlays

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

View File

@ -1,8 +1,9 @@
--= Blueberries local S = farming.intllib
-- blueberries
minetest.register_craftitem("farming:blueberries", { minetest.register_craftitem("farming:blueberries", {
description = "Blueberries", description = S("Blueberries"),
inventory_image = "farming_blueberries.png", inventory_image = "farming_blueberries.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1") 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), 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", { minetest.register_craftitem("farming:muffin_blueberry", {
description = "Blueberry Muffin", description = S("Blueberry Muffin"),
inventory_image = "farming_blueberry_muffin.png", inventory_image = "farming_blueberry_muffin.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
}) })
@ -25,9 +26,8 @@ minetest.register_craft({
} }
}) })
-- Define Blueberry growth stages -- blueberry definition
local crop_def = {
minetest.register_node("farming:blueberry_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_blueberry_1.png"}, tiles = {"farming_blueberry_1.png"},
paramtype = "light", paramtype = "light",
@ -40,64 +40,28 @@ minetest.register_node("farming:blueberry_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:blueberry_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:blueberry_3", { -- stage 2
drawtype = "plantlike", crop_def.tiles = {"farming_blueberry_2.png"}
tiles = {"farming_blueberry_3.png"}, minetest.register_node("farming:blueberry_2", table.copy(crop_def))
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(),
})
-- 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", { -- stage 4 (final)
drawtype = "plantlike", crop_def.tiles = {"farming_blueberry_4.png"}
tiles = {"farming_blueberry_4.png"}, crop_def.groups.growing = 0
paramtype = "light", crop_def.drop = {
sunlight_propagates = true, items = {
waving = 1, {items = {'farming:blueberries 2'}, rarity = 1},
walkable = false, {items = {'farming:blueberries'}, rarity = 2},
buildable_to = true, {items = {'farming:blueberries'}, rarity = 3},
drop = { }
items = { }
{items = {'farming:blueberries 2'}, rarity = 1}, minetest.register_node("farming:blueberry_4", table.copy(crop_def))
{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(),
})

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", { minetest.register_craftitem("farming:carrot", {
description = "Carrot", description = S("Carrot"),
inventory_image = "farming_carrot.png", inventory_image = "farming_carrot.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1") 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), on_use = minetest.item_eat(4),
}) })
-- Golden Carrot -- golden carrot
minetest.register_craftitem("farming:carrot_gold", { minetest.register_craftitem("farming:carrot_gold", {
description = "Golden Carrot", description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png", inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
}) })
@ -28,9 +32,8 @@ minetest.register_craft({
} }
}) })
-- Define Carrot growth stages -- carrot definition
local crop_def = {
minetest.register_node("farming:carrot_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_carrot_1.png"}, tiles = {"farming_carrot_1.png"},
paramtype = "light", paramtype = "light",
@ -43,133 +46,50 @@ minetest.register_node("farming:carrot_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:carrot_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:carrot_4", { -- stage 2
drawtype = "plantlike", crop_def.tiles = {"farming_carrot_2.png"}
tiles = {"farming_carrot_4.png"}, minetest.register_node("farming:carrot_2", table.copy(crop_def))
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_5", { -- stage 3
drawtype = "plantlike", crop_def.tiles = {"farming_carrot_3.png"}
tiles = {"farming_carrot_5.png"}, minetest.register_node("farming:carrot_3", table.copy(crop_def))
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(),
})
minetest.register_node("farming:carrot_6", { -- stage 4
drawtype = "plantlike", crop_def.tiles = {"farming_carrot_4.png"}
tiles = {"farming_carrot_6.png"}, minetest.register_node("farming:carrot_4", table.copy(crop_def))
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(),
})
minetest.register_node("farming:carrot_7", { -- stage 5
drawtype = "plantlike", crop_def.tiles = {"farming_carrot_5.png"}
tiles = {"farming_carrot_7.png"}, minetest.register_node("farming:carrot_5", table.copy(crop_def))
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(),
})
-- 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", { -- stage 7
drawtype = "plantlike", crop_def.tiles = {"farming_carrot_7.png"}
tiles = {"farming_carrot_8.png"}, crop_def.drop = {
paramtype = "light", items = {
sunlight_propagates = true, {items = {'farming:carrot'}, rarity = 1},
waving = 1, {items = {'farming:carrot 2'}, rarity = 3},
walkable = false, }
buildable_to = true, }
drop = { minetest.register_node("farming:carrot_7", table.copy(crop_def))
items = {
{items = {'farming:carrot 2'}, rarity = 1}, -- stage 8 (final)
{items = {'farming:carrot 3'}, rarity = 2}, crop_def.tiles = {"farming_carrot_8.png"}
} crop_def.groups.growing = 0
}, crop_def.drop = {
selection_box = farming.select, items = {
groups = { {items = {'farming:carrot 2'}, rarity = 1},
snappy = 3, flammable = 2, plant = 1, attached_node = 1, {items = {'farming:carrot 3'}, rarity = 2},
not_in_creative_inventory = 1 }
}, }
sounds = default.node_sound_leaves_defaults(), 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) function place_cocoa(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing local pt = pointed_thing
-- check if pointing at a node -- check if pointing at a node
if not pt and pt.type ~= "node" then if not pt or pt.type ~= "node" then
return return
end end
local under = minetest.get_node(pt.under) 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 if not minetest.registered_nodes[under.name] then
return return
end end
-- check if pointing at jungletree -- 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 return
end end
-- add the node and remove 1 item from the itemstack -- add the node and remove 1 item from the itemstack
minetest.set_node(pt.above, {name = plantname}) 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 if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()
-- check for refill -- check for refill
if itemstack:get_count() == 0 then if itemstack:get_count() == 0 then
minetest.after(0.20, minetest.after(0.20,
farming.refill_plant, farming.refill_plant,
placer, placer,
"farming:cocoa_beans", "farming:cocoa_beans",
placer:get_wield_index() placer:get_wield_index()
) )
end -- END refill end
end end
return itemstack return itemstack
end end
--= Cocoa -- cocoa beans
minetest.register_craftitem("farming:cocoa_beans", { minetest.register_craftitem("farming:cocoa_beans", {
description = "Cocoa Beans", description = S("Cocoa Beans"),
inventory_image = "farming_cocoa_beans.png", inventory_image = "farming_cocoa_beans.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1") 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", { minetest.register_craftitem("farming:cookie", {
description = "Cookie", description = S("Cookie"),
inventory_image = "farming_cookie.png", inventory_image = "farming_cookie.png",
on_use = minetest.item_eat(2), 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", { minetest.register_craftitem("farming:chocolate_dark", {
description = "Bar of Dark Chocolate", description = S("Bar of Dark Chocolate"),
inventory_image = "farming_chocolate_dark.png", inventory_image = "farming_chocolate_dark.png",
on_use = minetest.item_eat(2), --/MFF (Mg|05/26/2015) on_use = minetest.item_eat(2), --/MFF (Mg|05/26/2015)
}) })
@ -85,9 +92,8 @@ minetest.register_craft( {
} }
}) })
-- Define Coffee growth stages -- cocoa definition
local crop_def = {
minetest.register_node("farming:cocoa_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_cocoa_1.png"}, tiles = {"farming_cocoa_1.png"},
paramtype = "light", paramtype = "light",
@ -105,80 +111,63 @@ minetest.register_node("farming:cocoa_1", {
snappy = 3, flammable = 2, plant = 1, growing = 1, snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:cocoa_1", table.copy(crop_def))
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(),
})
-- 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", { -- stage 3 (final)
drawtype = "plantlike", crop_def.tiles = {"farming_cocoa_3.png"}
tiles = {"farming_cocoa_3.png"}, crop_def.groups.growing = 0
paramtype = "light", crop_def.drop = {
walkable = true, items = {
drop = { {items = {'farming:cocoa_beans 2'}, rarity = 1},
items = { {items = {'farming:cocoa_beans 1'}, rarity = 2},
{items = {'farming:cocoa_beans 2'}, rarity = 1}, }
{items = {'farming:cocoa_beans 1'}, rarity = 2}, }
} minetest.register_node("farming:cocoa_3", table.copy(crop_def))
},
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
-- add random cocoa pods to jungle tree trunks
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:jungletree"}, nodenames = {"default:jungletree"},
neighbors = {"default:jungleleaves", "moretrees:jungletree_leaves_green"}, neighbors = {"default:jungleleaves", "moretrees:jungletree_leaves_green"},
interval = 80, interval = 8,
chance = 20, chance = 80,
catch_up = false,
action = function(pos, node) 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 if dir == 1 then
elseif dir == 2 then pos.x = pos.x - 1 pos.x = pos.x + 1
elseif dir == 3 then pos.z = pos.z + 1 elseif dir == 2 then
elseif dir == 4 then pos.z = pos.z -1 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 else return
end end
local nod = minetest.get_node_or_nil(pos) local nodename = minetest.get_node(pos).name
if nod then nod = nod.name else return end
if nod == "air" if nodename == "air"
and minetest.get_node_light(pos) > 12 then 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, { minetest.set_node(pos, {
name = "farming:cocoa_"..tostring(math.random(1, 3)) name = "farming:cocoa_" .. tostring(math.random(1, 3))
}) })
end end
end, end,

View File

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

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", { minetest.register_craftitem("farming:corn", {
description = "Corn", description = S("Corn"),
inventory_image = "farming_corn.png", inventory_image = "farming_corn.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1") 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), 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", { minetest.register_craftitem("farming:corn_cob", {
description = "Corn on the Cob", description = S("Corn on the Cob"),
inventory_image = "farming_corn_cob.png", inventory_image = "farming_corn_cob.png",
on_use = minetest.item_eat(5), on_use = minetest.item_eat(5),
}) })
@ -26,10 +30,9 @@ minetest.register_craft({
recipe = "farming:corn" recipe = "farming:corn"
}) })
--= Ethanol (Thanks to JKMurray for this idea) -- ethanol (thanks to JKMurray for this idea)
minetest.register_craftitem("farming:bottle_ethanol", { minetest.register_craftitem("farming:bottle_ethanol", {
description = "Bottle of Ethanol", description = S("Bottle of Ethanol"),
inventory_image = "farming_bottle_ethanol.png", inventory_image = "farming_bottle_ethanol.png",
}) })
@ -48,9 +51,8 @@ minetest.register_craft({
replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}} replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
}) })
-- Define Corn growth stages -- corn definition
local crop_def = {
minetest.register_node("farming:corn_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_corn_1.png"}, tiles = {"farming_corn_1.png"},
paramtype = "light", paramtype = "light",
@ -63,138 +65,52 @@ minetest.register_node("farming:corn_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:corn_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:corn_3", { -- stage 2
drawtype = "plantlike", crop_def.tiles = {"farming_corn_2.png"}
tiles = {"farming_corn_3.png"}, minetest.register_node("farming:corn_2", table.copy(crop_def))
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(),
})
minetest.register_node("farming:corn_4", { -- stage 3
drawtype = "plantlike", crop_def.tiles = {"farming_corn_3.png"}
tiles = {"farming_corn_4.png"}, minetest.register_node("farming:corn_3", table.copy(crop_def))
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(),
})
minetest.register_node("farming:corn_5", { -- stage 4
drawtype = "plantlike", crop_def.tiles = {"farming_corn_4.png"}
tiles = {"farming_corn_5.png"}, minetest.register_node("farming:corn_4", table.copy(crop_def))
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(),
})
minetest.register_node("farming:corn_6", { -- stage 5
drawtype = "plantlike", crop_def.tiles = {"farming_corn_5.png"}
tiles = {"farming_corn_6.png"}, minetest.register_node("farming:corn_5", table.copy(crop_def))
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(),
})
minetest.register_node("farming:corn_7", { -- stage 6
drawtype = "plantlike", crop_def.tiles = {"farming_corn_6.png"}
tiles = {"farming_corn_7.png"}, crop_def.visual_scale = 1.45
visual_scale = 1.45, minetest.register_node("farming:corn_6", table.copy(crop_def))
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(),
})
-- 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", { -- stage 8 (final)
drawtype = "plantlike", crop_def.tiles = {"farming_corn_8.png"}
tiles = {"farming_corn_8.png"}, crop_def.groups.growing = 0
visual_scale = 1.45, crop_def.drop = {
paramtype = "light", items = {
waving = 1, {items = {'farming:corn 2'}, rarity = 1},
walkable = false, {items = {'farming:corn 2'}, rarity = 2},
buildable_to = true, {items = {'farming:corn 2'}, rarity = 2},
drop = { }
items = { }
{items = {'farming:corn 2'}, rarity = 1}, minetest.register_node("farming:corn_8", table.copy(crop_def))
{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(),
})

View File

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

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", { minetest.register_craftitem("farming:cucumber", {
description = "Cucumber", description = S("Cucumber"),
inventory_image = "farming_cucumber.png", inventory_image = "farming_cucumber.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1") 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), on_use = minetest.item_eat(4),
}) })
-- Define Cucumber growth stages -- cucumber definition
local crop_def = {
minetest.register_node("farming:cucumber_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_cucumber_1.png"}, tiles = {"farming_cucumber_1.png"},
paramtype = "light", paramtype = "light",
@ -25,60 +29,27 @@ minetest.register_node("farming:cucumber_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:cucumber_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:cucumber_3", { -- stage 2
drawtype = "plantlike", crop_def.tiles = {"farming_cucumber_2.png"}
tiles = {"farming_cucumber_3.png"}, minetest.register_node("farming:cucumber_2", table.copy(crop_def))
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(),
})
-- 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", { -- stage 4 (final)
drawtype = "plantlike", crop_def.tiles = {"farming_cucumber_4.png"}
tiles = {"farming_cucumber_4.png"}, crop_def.groups.growing = 0
paramtype = "light", crop_def.drop = {
waving = 1, items = {
walkable = false, {items = {'farming:cucumber'}, rarity = 1},
buildable_to = true, {items = {'farming:cucumber 2'}, rarity = 2},
drop = { }
items = { }
{items = {'farming:cucumber'}, rarity = 1}, minetest.register_node("farming:cucumber_4", table.copy(crop_def))
{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(),
})

View File

@ -1,2 +1,3 @@
default default
wool 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) -- Donut (thanks to Bockwurst for making the donut images)
minetest.register_craftitem("farming:donut", { minetest.register_craftitem("farming:donut", {
description = "Donut", description = S("Donut"),
inventory_image = "farming_donut.png", inventory_image = "farming_donut.png",
on_use = minetest.item_eat(4), on_use = minetest.item_eat(4),
}) })
@ -16,7 +19,7 @@ minetest.register_craft({
-- Chocolate Donut -- Chocolate Donut
minetest.register_craftitem("farming:donut_chocolate", { minetest.register_craftitem("farming:donut_chocolate", {
description = "Chocolate Donut", description = S("Chocolate Donut"),
inventory_image = "farming_donut_chocolate.png", inventory_image = "farming_donut_chocolate.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
}) })
@ -31,7 +34,7 @@ minetest.register_craft({
-- Apple Donut -- Apple Donut
minetest.register_craftitem("farming:donut_apple", { minetest.register_craftitem("farming:donut_apple", {
description = "Apple Donut", description = S("Apple Donut"),
inventory_image = "farming_donut_apple.png", inventory_image = "farming_donut_apple.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
}) })

View File

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

View File

@ -1,4 +1,6 @@
local S = farming.intllib
-- Hoe registration function -- Hoe registration function
farming.register_hoe = function(name, def) farming.register_hoe = function(name, def)
@ -39,7 +41,6 @@ farming.register_hoe = function(name, def)
}) })
-- Register its recipe -- Register its recipe
-- Registration using material made for MFF
if def.material == nil then if def.material == nil then
minetest.register_craft({ minetest.register_craft({
output = name:sub(2), output = name:sub(2),
@ -124,56 +125,56 @@ end
-- Material fields added for MFF -- Material fields added for MFF
farming.register_hoe(":farming:hoe_wood", { farming.register_hoe(":farming:hoe_wood", {
description = "Wooden Hoe", description = S("Wooden Hoe"),
inventory_image = "farming_tool_woodhoe.png", inventory_image = "farming_tool_woodhoe.png",
max_uses = 30, max_uses = 30,
material = "group:wood" material = "group:wood"
}) })
farming.register_hoe(":farming:hoe_stone", { farming.register_hoe(":farming:hoe_stone", {
description = "Stone Hoe", description = S("Stone Hoe"),
inventory_image = "farming_tool_stonehoe.png", inventory_image = "farming_tool_stonehoe.png",
max_uses = 90, max_uses = 90,
material = "group:stone" material = "group:stone"
}) })
farming.register_hoe(":farming:hoe_steel", { farming.register_hoe(":farming:hoe_steel", {
description = "Steel Hoe", description = S("Steel Hoe"),
inventory_image = "farming_tool_steelhoe.png", inventory_image = "farming_tool_steelhoe.png",
max_uses = 200, max_uses = 200,
material = "default:steel_ingot" material = "default:steel_ingot"
}) })
farming.register_hoe(":farming:hoe_bronze", { farming.register_hoe(":farming:hoe_bronze", {
description = "Bronze Hoe", description = S("Bronze Hoe"),
inventory_image = "farming_tool_bronzehoe.png", inventory_image = "farming_tool_bronzehoe.png",
max_uses = 220, max_uses = 220,
material = "default:bronze_ingot" material = "default:bronze_ingot"
}) })
farming.register_hoe(":farming:hoe_silver", { farming.register_hoe(":farming:hoe_silver", {
description = "Silver Hoe", description = S("Silver Hoe"),
inventory_image = "farming_tool_silverhoe.png", inventory_image = "farming_tool_silverhoe.png",
max_uses = 300, max_uses = 300,
material = "default:silver_ingot" material = "default:silver_ingot"
}) })
farming.register_hoe(":farming:hoe_mese", { farming.register_hoe(":farming:hoe_mese", {
description = "Mese Hoe", description = S("Mese Hoe"),
inventory_image = "farming_tool_mesehoe.png", inventory_image = "farming_tool_mesehoe.png",
max_uses = 350, max_uses = 350,
material = "default:mese_crystal" material = "default:mese_crystal"
}) })
farming.register_hoe(":farming:hoe_diamond", { farming.register_hoe(":farming:hoe_diamond", {
description = "Diamond Hoe", description = S("Diamond Hoe"),
inventory_image = "farming_tool_diamondhoe.png", inventory_image = "farming_tool_diamondhoe.png",
max_uses = 500, max_uses = 500,
material = "default:diamond" material = "default:diamond"
}) })
farming.register_hoe(":farming:hoe_mithril", { farming.register_hoe(":farming:hoe_mithril", {
description = "Mithril Hoe", description = S("Mithril Hoe"),
inventory_image = "farming_tool_mithrilhoe.png", inventory_image = "farming_tool_mithrilhoe.png",
max_uses = 1000, max_uses = 1000,
material = "default:mithril_ingot" 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 by TenPlus1
NEW growing routine by prestidigitator NEW growing routine by prestidigitator
auto-refill by crabman77 auto-refill by crabman77
@ -49,34 +49,20 @@ end
local statistics = dofile(farming.path.."/statistics.lua") local statistics = dofile(farming.path.."/statistics.lua")
dofile(farming.path.."/soil.lua") -- Intllib
dofile(farming.path.."/hoes.lua")
dofile(farming.path.."/grass.lua") local S
dofile(farming.path.."/wheat.lua") if minetest.get_modpath("intllib") then
dofile(farming.path.."/cotton.lua") S = intllib.Getter()
dofile(farming.path.."/carrot.lua") else
dofile(farming.path.."/potato.lua") S = function(s) return s end
dofile(farming.path.."/tomato.lua") end
dofile(farming.path.."/cucumber.lua") farming.intllib = S
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
-- Utility Functions -- Utility Functions
local time_speed = tonumber(minetest.setting_get("time_speed")) or 72 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) local function clamp(x, min, max)
return (x < min and min) or (x > max and max) or x 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 type(node) == 'table' then
if node.name then if node.name then
name = node.name name = node.name
elseif node.x and node.y and node.z then elseif node.x and node.y and node.z then
node = minetest.get_node_or_nil(node) node = minetest.get_node_or_nil(node)
name = node and node.name name = node and node.name
@ -189,7 +175,9 @@ local function plant_name_stage(node)
name = tostring(node) name = tostring(node)
end 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("_[^_]+$") local sep_pos = name:find("_[^_]+$")
@ -205,8 +193,9 @@ local function plant_name_stage(node)
return name, 0 return name, 0
end end
--- Map from node name to -- Map from node name to
-- { plant_name = ..., name = ..., stage = n, stages_left = { node_name, ... } } -- { plant_name = ..., name = ..., stage = n, stages_left = { node_name, ... } }
local plant_stages = {} local plant_stages = {}
farming.plant_stages = 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_name = plant_name and plant_name .. "_" .. stage
local node_def = node_name and minetest.registered_nodes[node_name] 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] 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 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, minetest.override_item(node_name,
{ {
on_construct = function(pos) on_construct = function(pos)
if old_constr then old_constr(pos) end
if old_constr then
old_constr(pos)
end
farming.handle_growth(pos) farming.handle_growth(pos)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
minetest.get_node_timer(pos):stop() minetest.get_node_timer(pos):stop()
if old_destr then old_destr(pos) end
if old_destr then
old_destr(pos)
end
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
@ -290,6 +291,7 @@ register_plant_node = function(node)
local plant_name, stage = plant_name_stage(node) local plant_name, stage = plant_name_stage(node)
if plant_name then if plant_name then
local stages = reg_plant_stages(plant_name, stage, false) local stages = reg_plant_stages(plant_name, stage, false)
return stages and #stages.stages_left return stages and #stages.stages_left
else else
@ -299,7 +301,9 @@ end
local function set_growing(pos, stages_left) 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) local timer = minetest.get_node_timer(pos)
@ -319,28 +323,33 @@ local function set_growing(pos, stages_left)
end end
end end
--- Detects a plant type node at the given position, starting or stopping the plant growth timer as appopriate -- 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 pos
-- @param node -- The node's position.
-- The cached node table if available, or nil. -- @param node
-- The cached node table if available, or nil.
function farming.handle_growth(pos, node) 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) 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 end
minetest.after(0, minetest.after(0, function()
function()
for _, node_def in pairs(minetest.registered_nodes) do for _, node_def in pairs(minetest.registered_nodes) do
register_plant_node(node_def) register_plant_node(node_def)
end end
end) end)
local abm_func = farming.handle_growth local abm_func = farming.handle_growth
@ -349,6 +358,7 @@ if farming.DEBUG then
local normal_abm_func = abm_func local normal_abm_func = abm_func
abm_func = function(...) abm_func = function(...)
local t0 = minetest.get_us_time() local t0 = minetest.get_us_time()
local r = { normal_abm_func(...) } local r = { normal_abm_func(...) }
local t1 = minetest.get_us_time() 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 -- Just in case a growing type or added node is missed (also catches existing
-- nodes added to map before timers were incorporated). -- nodes added to map before timers were incorporated).
minetest.register_abm({
minetest.register_abm({
nodenames = { "group:growing" }, nodenames = { "group:growing" },
interval = 300, interval = 300,
chance = 1, chance = 1,
action = abm_func action = abm_func
}) })
--- Plant timer function. -- Plant timer function.
-- -- Grows plants under the right conditions.
-- Grows plants under the right conditions.
function farming.plant_growth_timer(pos, elapsed, node_name) function farming.plant_growth_timer(pos, elapsed, node_name)
local stages = plant_stages[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 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 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 return true
end end
else 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 end
local growth 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 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 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) --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 growth = 1
else else
local night_light = (minetest.get_node_light(light_pos, 0) 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) -- ChANGED 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 night_growth = in_range(night_light, MIN_LIGHT, MAX_LIGHT)
local day_growth = in_range(day_light, MIN_LIGHT, MAX_LIGHT) local day_growth = in_range(day_light, MIN_LIGHT, MAX_LIGHT)
if not night_growth then 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 lambda = day_time(elapsed) / STAGE_LENGTH_AVG
elseif not day_growth then elseif not day_growth then
lambda = night_time(elapsed) / STAGE_LENGTH_AVG lambda = night_time(elapsed) / STAGE_LENGTH_AVG
end end
growth = statistics.poisson(lambda, max_growth) growth = statistics.poisson(lambda, max_growth)
if growth < 1 then return true end if growth < 1 then
return true
end
end end
if minetest.registered_nodes[stages.stages_left[growth]] then 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 else
return true return true
end end
@ -472,6 +501,7 @@ local can_refill_plant = {
["farming:beans_1"] = "farming:beans", ["farming:beans_1"] = "farming:beans",
["farming:rhubarb_1"] = "farming:rhubarb", ["farming:rhubarb_1"] = "farming:rhubarb",
["farming:cocoa_1"] = "farming:cocoa_beans", ["farming:cocoa_1"] = "farming:cocoa_beans",
["farming:barley_1"] = "farming:seed_barley",
} }
function farming.refill_plant(player, plantname, index) function farming.refill_plant(player, plantname, index)
@ -479,7 +509,9 @@ function farming.refill_plant(player, plantname, index)
local inv = player:get_inventory() local inv = player:get_inventory()
local old_stack = inv:get_stack("main", index) 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 for i, stack in pairs(inv:get_list("main")) do
@ -492,7 +524,7 @@ function farming.refill_plant(player, plantname, index)
return return
end end
end end
end -- END refill end
-- Place Seeds on Soil -- 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 under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above) 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 -- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] if not minetest.registered_nodes[under.name]
or not minetest.registered_nodes[above.name] then 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.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 if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()
@ -567,7 +606,7 @@ farming.register_plant = function(name, def)
-- Check def table -- Check def table
if not def.description then if not def.description then
def.description = "Seed" def.description = S("Seed")
end end
if not def.inventory_image then if not def.inventory_image then
@ -595,7 +634,7 @@ farming.register_plant = function(name, def)
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1") return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1")
end end,
}) })
-- Register harvest -- 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 -- Last step doesn't need growing=1 so Abm never has to check these
if i == def.steps then if i == def.steps then
g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1} g.growing = 0
end end
local node_name = mname .. ":" .. pname .. "_" .. i local node_name = mname .. ":" .. pname .. "_" .. i
@ -638,7 +677,7 @@ farming.register_plant = function(name, def)
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
register_plant_node(node_name) -- register_plant_node(node_name)
end end
-- Return info -- Return info
@ -646,9 +685,29 @@ farming.register_plant = function(name, def)
return r return r
end end
--[[ Cotton (example, is already registered in cotton.lua) -- load crops
farming.register_plant("farming:cotton", {
description = "Cotton2 seed", dofile(farming.path.."/soil.lua")
inventory_image = "farming_cotton_seed.png", dofile(farming.path.."/hoes.lua")
steps = 8, 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", { minetest.register_craftitem("farming:melon_slice", {
description = "Melon Slice", description = S("Melon Slice"),
inventory_image = "farming_melon_slice.png", inventory_image = "farming_melon_slice.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
@ -26,9 +27,8 @@ minetest.register_craft({
} }
}) })
-- Define Melon growth stages -- melon definition
local crop_def = {
minetest.register_node("farming:melon_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_melon_1.png"}, tiles = {"farming_melon_1.png"},
paramtype = "light", paramtype = "light",
@ -41,119 +41,42 @@ minetest.register_node("farming:melon_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:melon_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:melon_3", { -- stage 2
drawtype = "plantlike", crop_def.tiles = {"farming_melon_2.png"}
tiles = {"farming_melon_3.png"}, minetest.register_node("farming:melon_2", table.copy(crop_def))
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(),
})
minetest.register_node("farming:melon_4", { -- stage 3
drawtype = "plantlike", crop_def.tiles = {"farming_melon_3.png"}
tiles = {"farming_melon_4.png"}, minetest.register_node("farming:melon_3", table.copy(crop_def))
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(),
})
minetest.register_node("farming:melon_5", { -- stage 4
drawtype = "plantlike", crop_def.tiles = {"farming_melon_4.png"}
tiles = {"farming_melon_5.png"}, minetest.register_node("farming:melon_4", table.copy(crop_def))
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(),
})
minetest.register_node("farming:melon_6", { -- stage 5
drawtype = "plantlike", crop_def.tiles = {"farming_melon_5.png"}
tiles = {"farming_melon_6.png"}, minetest.register_node("farming:melon_5", table.copy(crop_def))
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(),
})
minetest.register_node("farming:melon_7", { -- stage 6
drawtype = "plantlike", crop_def.tiles = {"farming_melon_6.png"}
tiles = {"farming_melon_7.png"}, minetest.register_node("farming:melon_6", table.copy(crop_def))
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(),
})
-- 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", { -- stage 8 (final)
--drawtype = "nodebox", crop_def.drawtype = "nodebox"
description = "Melon", crop_def.description = S("Melon")
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}, crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}
paramtype = "light", crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5}
walkable = true, crop_def.walkable = true
drop = { crop_def.groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1}
items = { crop_def.drop = "farming:melon_slice 9"
{items = {'farming:melon_slice 9'}, rarity = 1}, minetest.register_node("farming:melon_8", table.copy(crop_def))
}
},
groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1},
sounds = default.node_sound_wood_defaults(),
})

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", { minetest.register_craftitem("farming:potato", {
description = "Potato", description = S("Potato"),
inventory_image = "farming_potato.png", inventory_image = "farming_potato.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1") 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), on_use = minetest.item_eat(1),
}) })
-- baked potato
minetest.register_craftitem("farming:baked_potato", { minetest.register_craftitem("farming:baked_potato", {
description = "Baked Potato", description = S("Baked Potato"),
inventory_image = "farming_baked_potato.png", inventory_image = "farming_baked_potato.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
}) })
@ -24,9 +30,8 @@ minetest.register_craft({
recipe = "farming:potato" recipe = "farming:potato"
}) })
-- Define Potato growth stages -- potato definition
local crop_def = {
minetest.register_node("farming:potato_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_potato_1.png"}, tiles = {"farming_potato_1.png"},
paramtype = "light", paramtype = "light",
@ -40,68 +45,33 @@ minetest.register_node("farming:potato_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:potato_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:potato_3", { -- stage 2
drawtype = "plantlike", crop_def.tiles = {"farming_potato_2.png"}
tiles = {"farming_potato_3.png"}, minetest.register_node("farming:potato_2", table.copy(crop_def))
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(),
})
-- 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", { -- stage 4
drawtype = "plantlike", crop_def.tiles = {"farming_potato_4.png"}
tiles = {"farming_potato_4.png"}, crop_def.groups.growing = 0
paramtype = "light", crop_def.drop = {
sunlight_propagates = true, items = {
waving = 1, {items = {'farming:potato 2'}, rarity = 1},
walkable = false, {items = {'farming:potato 3'}, rarity = 2},
buildable_to = true, }
drop = { }
items = { minetest.register_node("farming:potato_4", table.copy(crop_def))
{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(),
})

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", { minetest.register_node("farming:pumpkin", {
description = "Pumpkin", description = S("Pumpkin"),
tiles = { tiles = {
"farming_pumpkin_top.png", "farming_pumpkin_top.png",
"farming_pumpkin_top.png", "farming_pumpkin_top.png",
@ -20,8 +25,9 @@ minetest.register_node("farming:pumpkin", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
-- pumpkin slice
minetest.register_craftitem("farming:pumpkin_slice", { minetest.register_craftitem("farming:pumpkin_slice", {
description = "Pumpkin Slice", description = S("Pumpkin Slice"),
inventory_image = "farming_pumpkin_slice.png", inventory_image = "farming_pumpkin_slice.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1") 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", { minetest.register_node("farming:jackolantern", {
description = "Jack 'O Lantern", description = S("Jack 'O Lantern"),
tiles = { tiles = {
"farming_pumpkin_top.png", "farming_pumpkin_top.png",
"farming_pumpkin_top.png", "farming_pumpkin_top.png",
@ -66,7 +72,6 @@ minetest.register_node("farming:jackolantern", {
}) })
minetest.register_node("farming:jackolantern_on", { minetest.register_node("farming:jackolantern_on", {
description = "Jack 'O Lantern",
tiles = { tiles = {
"farming_pumpkin_top.png", "farming_pumpkin_top.png",
"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", { minetest.register_craftitem("farming:pumpkin_bread", {
description = ("Pumpkin Bread"), description = S("Pumpkin Bread"),
inventory_image = "farming_pumpkin_bread.png", inventory_image = "farming_pumpkin_bread.png",
on_use = minetest.item_eat(8) on_use = minetest.item_eat(8)
}) })
minetest.register_craftitem("farming:pumpkin_dough", { minetest.register_craftitem("farming:pumpkin_dough", {
description = "Pumpkin Dough", description = S("Pumpkin Dough"),
inventory_image = "farming_pumpkin_dough.png", inventory_image = "farming_pumpkin_dough.png",
}) })
@ -120,9 +125,8 @@ minetest.register_craft({
cooktime = 10 cooktime = 10
}) })
-- Define Pumpkin growth stages -- pumpkin definition
local crop_def = {
minetest.register_node("farming:pumpkin_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_pumpkin_1.png"}, tiles = {"farming_pumpkin_1.png"},
paramtype = "light", paramtype = "light",
@ -136,125 +140,42 @@ minetest.register_node("farming:pumpkin_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:pumpkin_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:pumpkin_3", { -- stage 2
drawtype = "plantlike", crop_def.tiles = {"farming_pumpkin_2.png"}
tiles = {"farming_pumpkin_3.png"}, minetest.register_node("farming:pumpkin_2", table.copy(crop_def))
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(),
})
minetest.register_node("farming:pumpkin_4", { -- stage 3
drawtype = "plantlike", crop_def.tiles = {"farming_pumpkin_3.png"}
tiles = {"farming_pumpkin_4.png"}, minetest.register_node("farming:pumpkin_3", table.copy(crop_def))
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(),
})
minetest.register_node("farming:pumpkin_5", { -- stage 4
drawtype = "plantlike", crop_def.tiles = {"farming_pumpkin_4.png"}
tiles = {"farming_pumpkin_5.png"}, minetest.register_node("farming:pumpkin_4", table.copy(crop_def))
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(),
})
minetest.register_node("farming:pumpkin_6", { -- stage 5
drawtype = "plantlike", crop_def.tiles = {"farming_pumpkin_5.png"}
tiles = {"farming_pumpkin_6.png"}, minetest.register_node("farming:pumpkin_5", table.copy(crop_def))
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(),
})
minetest.register_node("farming:pumpkin_7", { -- stage 6
drawtype = "plantlike", crop_def.tiles = {"farming_pumpkin_6.png"}
tiles = {"farming_pumpkin_7.png"}, minetest.register_node("farming:pumpkin_6", table.copy(crop_def))
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(),
})
-- 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", { -- stage 8 (final)
drawtype = "plantlike", crop_def.tiles = {"farming_pumpkin_8.png"}
tiles = {"farming_pumpkin_8.png"}, crop_def.groups.growing = 0
paramtype = "light", crop_def.drop = {
walkable = false, items = {
buildable_to = true, {items = {'farming:pumpkin_slice 9'}, rarity = 1},
drop = { }
items = { }
{items = {'farming:pumpkin_slice 9'}, rarity = 1}, minetest.register_node("farming:pumpkin_8", table.copy(crop_def))
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_defaults(),
})

View File

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

View File

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

View File

@ -1,6 +1,9 @@
local S = farming.intllib
-- normal soil -- normal soil
minetest.register_node("farming:soil", { minetest.register_node("farming:soil", {
description = "Soil", description = S("Soil"),
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"}, tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "default:dirt", drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2}, groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2},
@ -9,7 +12,7 @@ minetest.register_node("farming:soil", {
-- wet soil -- wet soil
minetest.register_node("farming:soil_wet", { 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"}, tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
drop = "default:dirt", drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3}, groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3},

View File

@ -1,8 +1,10 @@
local S = farming.intllib
--= Sugar --= Sugar
minetest.register_craftitem("farming:sugar", { minetest.register_craftitem("farming:sugar", {
description = "Sugar", description = S("Sugar"),
inventory_image = "farming_sugar.png", inventory_image = "farming_sugar.png",
}) })

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", { minetest.register_craftitem("farming:tomato", {
description = "Tomato", description = S("Tomato"),
inventory_image = "farming_tomato.png", inventory_image = "farming_tomato.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1") 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), on_use = minetest.item_eat(4),
}) })
-- Define Tomato growth stages -- tomato definition
local crop_def = {
minetest.register_node("farming:tomato_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_tomato_1.png"}, tiles = {"farming_tomato_1.png"},
paramtype = "light", paramtype = "light",
@ -26,133 +30,49 @@ minetest.register_node("farming:tomato_1", {
snappy = 3, flammable = 2, plant = 1, attached_node = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 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", { -- stage 1
drawtype = "plantlike", minetest.register_node("farming:tomato_1", table.copy(crop_def))
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(),
})
minetest.register_node("farming:tomato_3", { -- stage2
drawtype = "plantlike", crop_def.tiles = {"farming_tomato_2.png"}
tiles = {"farming_tomato_3.png"}, minetest.register_node("farming:tomato_2", table.copy(crop_def))
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(),
})
minetest.register_node("farming:tomato_4", { -- stage 3
drawtype = "plantlike", crop_def.tiles = {"farming_tomato_3.png"}
tiles = {"farming_tomato_4.png"}, minetest.register_node("farming:tomato_3", table.copy(crop_def))
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(),
})
minetest.register_node("farming:tomato_5", { -- stage 4
drawtype = "plantlike", crop_def.tiles = {"farming_tomato_4.png"}
tiles = {"farming_tomato_5.png"}, minetest.register_node("farming:tomato_4", table.copy(crop_def))
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(),
})
minetest.register_node("farming:tomato_6", { -- stage 5
drawtype = "plantlike", crop_def.tiles = {"farming_tomato_5.png"}
tiles = {"farming_tomato_6.png"}, minetest.register_node("farming:tomato_5", table.copy(crop_def))
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(),
})
minetest.register_node("farming:tomato_7", { -- stage 6
drawtype = "plantlike", crop_def.tiles = {"farming_tomato_6.png"}
tiles = {"farming_tomato_7.png"}, minetest.register_node("farming:tomato_6", table.copy(crop_def))
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(),
})
-- 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", { -- stage 8 (final)
drawtype = "plantlike", crop_def.tiles = {"farming_tomato_8.png"}
tiles = {"farming_tomato_8.png"}, crop_def.groups.growing = 0
paramtype = "light", crop_def.drop = {
waving = 1, items = {
walkable = false, {items = {'farming:tomato 3'}, rarity = 1},
buildable_to = true, {items = {'farming:tomato 3'}, rarity = 2},
drop = { }
items = { }
{items = {'farming:tomato 3'}, rarity = 1}, minetest.register_node("farming:tomato_8", table.copy(crop_def))
{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(),
})

View File

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