Update Farming Redo

Much better, ja?
master
Chris N 2014-08-18 12:26:49 -10:00
parent cb3b35760b
commit 57c4e11d1b
69 changed files with 998 additions and 27 deletions

View File

@ -1,4 +1,4 @@
Minetest Farming Redo Mod 0.4 by TenPlus1
Minetest Farming Redo Mod 1.0 by TenPlus1
based on
@ -95,4 +95,23 @@ Created by JoseTheCrafter and edited by TenPlus1:
farming_tomato_5.png
farming_tomato_6.png
farming_tomato_7.png
farming_tomato_8.png
farming_tomato_8.png
Created by GeMinecraft and edited by TenPlus1:
farming_corn.png
farming_corn_cob.png
farming_corn_1.png
farming_corn_2.png
farming_corn_3.png
farming_corn_4.png
farming_corn_5.png
farming_corn_6.png
farming_corn_7.png
farming_corn_8.png
Created by TenPlus1
farming_cocoa_1.png
farming_cocoa_2.png
farming_cocoa_3.png
farming_cocoa_beans.png
farming_cookie.png

View File

@ -11,6 +11,23 @@ minetest.register_craftitem("farming:carrot", {
on_use = minetest.item_eat(4),
})
-- Golden Carrot
minetest.register_craftitem("farming:carrot_gold", {
description = "Golden Carrot",
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
output = "farming:carrot_gold",
recipe = {
{"", "default:gold_lump", ""},
{"default:gold_lump", "farming:carrot", "default:gold_lump"},
{"", "default:gold_lump", ""},
}
})
-- Define Carrot growth stages
minetest.register_node("farming:carrot_1", {
@ -98,6 +115,7 @@ minetest.register_node("farming:carrot_7", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:carrot'},rarity=1},
@ -118,6 +136,7 @@ minetest.register_node("farming:carrot_8", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:carrot 2'},rarity=1},

173
mods/farming/cocoa.lua Normal file
View File

@ -0,0 +1,173 @@
-- Re-register Jungletree (tree=2 for placement below)
minetest.register_node(":default:jungletree", {
description = "Jungle Tree",
tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=2,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
-- Place Cocoa
function place_cocoa(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
-- check if pointing at jungletree
if minetest.get_item_group(under.name, "tree") == 2 then
else
return
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name=plantname})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
--= Cocoa
minetest.register_craftitem("farming:cocoa_beans", {
description = "Cocoa Beans",
inventory_image = "farming_cocoa_beans.png",
on_place = function(itemstack, placer, pointed_thing)
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1")
end,
})
minetest.register_craft( {
output = "dye:brown 2",
recipe = {
{ "farming:cocoa_beans" },
}
})
-- Cookie
minetest.register_craftitem("farming:cookie", {
description = "Cookie",
inventory_image = "farming_cookie.png",
on_use = minetest.item_eat(2),
})
minetest.register_craft( {
output = "farming:cookie 8",
recipe = {
{ "farming:wheat", "farming:cocoa_beans", "farming:wheat" },
}
})
-- Bar of Dark Chocolate (Thanks to Ice Pandora for her deviantart.com chocolate tutorial)
minetest.register_craftitem("farming:chocolate_dark", {
description = "Bar of Dark Chocolate",
inventory_image = "farming_chocolate_dark.png",
on_use = minetest.item_eat(3),
})
minetest.register_craft( {
output = "farming:chocolate_dark",
recipe = {
{ "farming:cocoa_beans", "farming:cocoa_beans", "farming:cocoa_beans" },
}
})
-- Define Coffee growth stages
minetest.register_node("farming:cocoa_1", {
drawtype = "plantlike",
tiles = {"farming_cocoa_1.png"},
paramtype = "light",
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 1'},rarity=2},
}
},
selection_box = {type = "fixed",fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer:is_player() then
minetest.set_node(pos, {name="ethereal:banana", param2=1})
end
end,
})
minetest.register_node("farming:cocoa_2", {
drawtype = "plantlike",
tiles = {"farming_cocoa_2.png"},
paramtype = "light",
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 1'},rarity=1},
}
},
selection_box = {type = "fixed",fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
-- Last stage of Cocoa growth does not have growing=1 so abm never has to check these
minetest.register_node("farming:cocoa_3", {
drawtype = "plantlike",
tiles = {"farming_cocoa_3.png"},
paramtype = "light",
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 2'},rarity=1},
{items = {'farming:cocoa_beans 1'},rarity=2},
}
},
selection_box = {type = "fixed",fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
})
-- Abm to add random Cocoa Pod to Jungle Tree trunks
minetest.register_abm({
nodenames = {"default:jungletree"},
neighbors = {"default:jungleleaves"},
interval = 80,
chance = 20,
action = function(pos, node)
local dir = math.random(1,50)
if dir == 1 then pos.x = pos.x + 1
elseif dir == 2 then pos.x = pos.x - 1
elseif dir == 3 then pos.z = pos.z + 1
elseif dir == 4 then pos.z = pos.z -1
else return
end
if minetest.get_node(pos).name == "air" then
-- print ("COCOA", pos.x, pos.y, pos.z)
minetest.set_node(pos,{name="farming:cocoa_"..tostring(math.random(1,3))})
end
end,
})

181
mods/farming/coffee.lua Normal file
View File

@ -0,0 +1,181 @@
--= Coffee
minetest.register_craftitem("farming:coffee_beans", {
description = "Coffee Beans",
inventory_image = "farming_coffee_beans.png",
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "farming:coffee_1")
end,
})
--= Glass Cup
--minetest.register_craftitem("farming:drinking_cup", {
-- description = "Drinking Cup",
-- inventory_image = "vessels_drinking_cup.png",
--})
minetest.register_node("farming:drinking_cup", {
description = "Drinking Cup (empty)",
drawtype = "plantlike",
tiles = {"vessels_drinking_cup.png"},
inventory_image = "vessels_drinking_cup.png",
wield_image = "vessels_drinking_cup.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
},
groups = {vessel=1,dig_immediate=3,attached_node=1},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft( {
output = "farming:drinking_cup 5",
recipe = {
{ "default:glass", "", "default:glass" },
{"", "default:glass",""},
}
})
--= 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", {
description = "Cup of Coffee (cold)",
drawtype = "plantlike",
tiles = {"farming_coffee_cup.png"},
inventory_image = "farming_coffee_cup.png",
wield_image = "farming_coffee_cup.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
},
groups = {vessel=1,dig_immediate=3,attached_node=1},
on_use = minetest.item_eat(2, "farming:drinking_cup"),
sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft( {
output = "farming:coffee_cup",
recipe = {
{"farming:drinking_cup", "farming:coffee_beans","bucket:bucket_water"},
{"","",""},
{"","",""}
},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
})
minetest.register_craft({
type = "cooking",
cooktime = 5,
output = "farming:coffee_cup_hot",
recipe = "farming:coffee_cup"
})
--= Hot Cup of Coffee
--minetest.register_craftitem("farming:coffee_cup_hot", {
-- description = "Hot Cup of Coffee",
-- inventory_image = "farming_coffee_cup_hot.png",
-- on_use = minetest.item_eat(3, "farming:drinking_cup"),
--})
minetest.register_node("farming:coffee_cup_hot", {
description = "Cup of Coffee (hot)",
drawtype = "plantlike",
tiles = {"farming_coffee_cup_hot.png"},
inventory_image = "farming_coffee_cup_hot.png",
wield_image = "farming_coffee_cup_hot.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
},
groups = {vessel=1,dig_immediate=3,attached_node=1},
on_use = minetest.item_eat(3, "farming:drinking_cup"),
sounds = default.node_sound_glass_defaults(),
})
-- Define Coffee growth stages
minetest.register_node("farming:coffee_1", {
drawtype = "plantlike",
tiles = {"farming_coffee_1.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:coffee_2", {
drawtype = "plantlike",
tiles = {"farming_coffee_2.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:coffee_3", {
drawtype = "plantlike",
tiles = {"farming_coffee_3.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:coffee_4", {
drawtype = "plantlike",
tiles = {"farming_coffee_4.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
-- Last stage of Coffee growth doesnnot have growing=1 so abm never has to check these
minetest.register_node("farming:coffee_5", {
drawtype = "plantlike",
tiles = {"farming_coffee_5.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:coffee_beans 2'},rarity=1},
{items = {'farming:coffee_beans 2'},rarity=2},
{items = {'farming:coffee_beans 2'},rarity=3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})

167
mods/farming/corn.lua Normal file
View File

@ -0,0 +1,167 @@
--= 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
minetest.register_craftitem("farming:corn", {
description = "Corn",
inventory_image = "farming_corn.png",
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
end,
on_use = minetest.item_eat(3),
})
--= Corn on the Cob (Texture by TenPlus1)
minetest.register_craftitem("farming:corn_cob", {
description = "Corn on the Cob",
inventory_image = "farming_corn_cob.png",
on_use = minetest.item_eat(5),
})
minetest.register_craft({
type = "cooking",
cooktime = 10,
output = "farming:corn_cob",
recipe = "farming:corn"
})
--= Ethanol (Thanks to JKMurray for this idea)
minetest.register_craftitem("farming:bottle_ethanol", {
description = "Bottle of Ethanol",
inventory_image = "farming_bottle_ethanol.png",
})
minetest.register_craft( {
output = "farming:bottle_ethanol",
recipe = {
{ "vessels:glass_bottle", "farming:corn", "farming:corn" },
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:bottle_ethanol",
burntime = 60,
replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
})
-- Define Corn growth stages
minetest.register_node("farming:corn_1", {
drawtype = "plantlike",
tiles = {"farming_corn_1.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:corn_2", {
drawtype = "plantlike",
tiles = {"farming_corn_2.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:corn_3", {
drawtype = "plantlike",
tiles = {"farming_corn_3.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:corn_4", {
drawtype = "plantlike",
tiles = {"farming_corn_4.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:corn_5", {
drawtype = "plantlike",
tiles = {"farming_corn_5.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:corn_6", {
drawtype = "plantlike",
tiles = {"farming_corn_6.png"},
paramtype = "light",
waving = 1,
walkable = true,
buildable_to = true,
drop = "",
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,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:corn_7", {
drawtype = "plantlike",
tiles = {"farming_corn_7.png"},
paramtype = "light",
waving = 1,
walkable = true,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:corn'},rarity=3},
}
},
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,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
-- Last stage of Corn growth doesnnot have growing=1 so abm never has to check these
minetest.register_node("farming:corn_8", {
drawtype = "plantlike",
tiles = {"farming_corn_8.png"},
paramtype = "light",
waving = 1,
walkable = true,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:corn'},rarity=1},
{items = {'farming:corn 2'},rarity=2},
}
},
selection_box = {type = "fixed",fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})

View File

@ -61,6 +61,7 @@ minetest.register_node("farming:cucumber_4", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:cucumber'},rarity=1},

View File

@ -1,3 +1,3 @@
default
wool
wool
skylands

View File

@ -1,5 +1,5 @@
--[[
Minetest Farming Redo Mod 0.5 (26 July 2014)
Minetest Farming Redo Mod 1.0 (13th August 2014)
by TenPlus1
Some additions by HeroOfTheWinds for use with SkyTest
]]
@ -16,6 +16,12 @@ dofile(minetest.get_modpath("farming").."/carrot.lua")
dofile(minetest.get_modpath("farming").."/potato.lua")
dofile(minetest.get_modpath("farming").."/tomato.lua")
dofile(minetest.get_modpath("farming").."/cucumber.lua")
dofile(minetest.get_modpath("farming").."/corn.lua")
dofile(minetest.get_modpath("farming").."/coffee.lua")
dofile(minetest.get_modpath("farming").."/melon.lua")
dofile(minetest.get_modpath("farming").."/sugar.lua")
dofile(minetest.get_modpath("farming").."/pumpkin.lua")
dofile(minetest.get_modpath("farming").."/cocoa.lua")
dofile(minetest.get_modpath("farming").."/mapgen.lua")
-- Place Seeds on Soil
@ -68,23 +74,29 @@ end
minetest.register_abm({
nodenames = {"group:growing"},
neighbors = {"farming:soil_wet"},
interval = 70,
neighbors = {"farming:soil_wet", "default:jungletree"},
interval = 70, -- 70
chance = 2,
action = function(pos, node)
-- get node type (e.g. farming:wheat_1)
local len = string.len(node.name)
local plant = string.sub(node.name, 1, len - 1)
local numb = string.sub(node.name,len, len)
local data = nil
data = string.split(node.name, '_', 2)
local plant = data[1].."_"
local numb = data[2]
-- check if fully grown
if not minetest.registered_nodes[plant..(numb + 1)] then
return
end
-- Check for Cocoa Pod
if plant == "farming:cocoa_" and minetest.find_node_near(pos, 1, {"default:jungletree"})then
else
-- check if on wet soil
pos.y = pos.y-1
local n = minetest.get_node(pos)
@ -98,8 +110,16 @@ minetest.register_abm({
return
end
end
-- grow
minetest.set_node(pos, {name=plant..(numb + 1)})
-- check for corn
if plant == "farming:corn_" and tonumber(numb) > 4 then
pos.y = pos.y + 1
minetest.set_node(pos, {name=plant..(numb + 1)})
end
end
})
@ -107,26 +127,32 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"group:growing"},
neighbors = {"farming:rich_soil_wet"},
interval = 35,
interval = 35, -- originally 70
chance = 2,
action = function(pos, node)
-- get node type (e.g. farming:wheat_1)
local len = string.len(node.name)
local plant = string.sub(node.name, 1, len - 1)
local numb = string.sub(node.name,len, len)
local data = nil
data = string.split(node.name, '_', 2)
local plant = data[1].."_"
local numb = data[2]
-- check if fully grown
if not minetest.registered_nodes[plant..(numb + 1)] then
return
end
-- Check for Cocoa Pod
if plant == "farming:cocoa_" and minetest.find_node_near(pos, 1, {"default:jungletree"})then
else
-- check if on wet soil
pos.y = pos.y-1
local n = minetest.get_node(pos)
if n.name ~= "farming:rich_soil_wet" then
if n.name ~= "farming:soil_wet" then
return
end
pos.y = pos.y+1
@ -136,7 +162,15 @@ minetest.register_abm({
return
end
end
-- grow
minetest.set_node(pos, {name=plant..(numb + 1)})
-- check for corn
if plant == "farming:corn_" and tonumber(numb) > 4 then
pos.y = pos.y + 1
minetest.set_node(pos, {name=plant..(numb + 1)})
end
end
})

View File

@ -17,10 +17,10 @@ minetest.register_on_generated(function(minp, maxp, seed)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine grass amount from perlin noise
-- Determine plant amount from perlin noise
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
-- Find random positions for grass based on this random
-- Find random positions for plant based on this random
local pr = PseudoRandom(seed+1)
for i=0,grass_amount do
@ -52,15 +52,23 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- If dirt with grass, add plant in various stages of maturity
if nn == "default:dirt_with_grass" then
local type = math.random(1,4)
if type == 1 then
local type = math.random(1,8)
if type == 1 and ground_y > 15 then
minetest.set_node(p,{name="farming:potato_"..pr:next(3, 4)})
else if type == 2 then
elseif type == 2 then
minetest.set_node(p,{name="farming:tomato_"..pr:next(7, 8)})
else if type == 3 then
elseif type == 3 then
minetest.set_node(p,{name="farming:carrot_"..pr:next(7, 8)})
else
elseif type == 4 then
minetest.set_node(p,{name="farming:cucumber_4"})
elseif type == 5 then
minetest.set_node(p,{name="farming:corn_"..pr:next(7, 8)})
elseif type == 6 and ground_y > 20 then
minetest.set_node(p,{name="farming:coffee_5"})
elseif type == 7 and minetest.find_node_near(p, 3, {"group:water"}) then
minetest.set_node(p,{name="farming:melon_8"})
elseif type == 8 and ground_y > 15 then
minetest.set_node(p,{name="farming:pumpkin_8"})
end
end
end
@ -68,6 +76,4 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
end
end
end
end)

144
mods/farming/melon.lua Normal file
View File

@ -0,0 +1,144 @@
--= Melon
minetest.register_craftitem("farming:melon_slice", {
description = "Melon Slice",
inventory_image = "farming_melon_slice.png",
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
end,
on_use = minetest.item_eat(2),
})
minetest.register_craft({
output = "farming:melon_8",
recipe = {
{"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"},
{"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"},
{"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"},
}
})
minetest.register_craft({
output = "farming:melon_slice 9",
recipe = {
{"", "farming:melon_8", ""},
}
})
-- Define Melon growth stages
minetest.register_node("farming:melon_1", {
drawtype = "plantlike",
tiles = {"farming_melon_1.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:melon_2", {
drawtype = "plantlike",
tiles = {"farming_melon_2.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:melon_3", {
drawtype = "plantlike",
tiles = {"farming_melon_3.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:melon_4", {
drawtype = "plantlike",
tiles = {"farming_melon_4.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:melon_5", {
drawtype = "plantlike",
tiles = {"farming_melon_5.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:melon_6", {
drawtype = "plantlike",
tiles = {"farming_melon_6.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:melon_7", {
drawtype = "plantlike",
tiles = {"farming_melon_7.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
-- Last stage of Melon growth doesnnot have growing=1 so abm never has to check these
minetest.register_node("farming:melon_8", {
drawtype = "nodebox",
description = "Melon",
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"},
paramtype = "light",
waving = 1,
walkable = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:melon_slice 9'},rarity=1},
}
},
groups = {choppy=3,flammable=2,plant=1},
sounds = default.node_sound_wood_defaults(),
})

View File

@ -59,6 +59,7 @@ minetest.register_node("farming:potato_3", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:potato'},rarity=1},
@ -79,6 +80,7 @@ minetest.register_node("farming:potato_4", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:potato 2'},rarity=1},

196
mods/farming/pumpkin.lua Normal file
View File

@ -0,0 +1,196 @@
--= Pumpkin (Big thanks to the PainterlyPack.net for Minecraft for allowing me to use these textures)
minetest.register_node("farming:pumpkin", {
description = "Pumpkin",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"},
groups = {choppy=3,flammable=2,plant=1},
drop = {
items = {
{items = {'farming:pumpkin_slice 9'},rarity=1},
}
},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craftitem("farming:pumpkin_slice", {
description = "Pumpkin Slice",
inventory_image = "farming_pumpkin_slice.png",
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
end,
on_use = minetest.item_eat(2),
})
minetest.register_craft({
output = "farming:pumpkin",
recipe = {
{"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"},
{"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"},
{"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"},
}
})
minetest.register_craft({
output = "farming:pumpkin_slice 9",
recipe = {
{"", "farming:pumpkin", ""},
}
})
-- Jack 'O Lantern
minetest.register_node("farming:jackolantern", {
description = "Jack 'O Lantern",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"},
light_source = 14,
paramtype2 = "facedir",
groups = {choppy=3,flammable=2,plant=1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = "farming:jackolantern",
recipe = {
{"", "", ""},
{"", "default:torch", ""},
{"", "farming:pumpkin", ""},
}
})
-- Pumpkin Bread
minetest.register_craftitem("farming:pumpkin_bread", {
description = ("Pumpkin Bread"),
inventory_image = "farming_pumpkin_bread.png",
on_use = minetest.item_eat(8)
})
minetest.register_craftitem("farming:pumpkin_dough", {
description = "Pumpkin Dough",
inventory_image = "farming_pumpkin_dough.png",
})
minetest.register_craft({
output = "farming:pumpkin_dough",
type = "shapeless",
recipe = {"farming:flour", "farming:pumpkin_slice", "farming:pumpkin_slice"}
})
minetest.register_craft({
type = "cooking",
output = "farming:pumpkin_bread",
recipe = "farming:pumpkin_dough",
cooktime = 10
})
-- Define Pumpkin growth stages
minetest.register_node("farming:pumpkin_1", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_1.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:pumpkin_2", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_2.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:pumpkin_3", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_3.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:pumpkin_4", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_4.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:pumpkin_5", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_5.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:pumpkin_6", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_6.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:pumpkin_7", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_7.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1},
sounds = default.node_sound_leaves_defaults(),
})
-- Last stage of Pumpkin growth does not have growing=1 so abm never has to check these
minetest.register_node("farming:pumpkin_8", {
drawtype = "plantlike",
tiles = {"farming_pumpkin_8.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:pumpkin_slice 9'},rarity=1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1},
sounds = default.node_sound_defaults(),
})

View File

@ -80,7 +80,7 @@ minetest.register_abm({
-- if its wet turn it back into dry soil
elseif node.name == "farming:soil_wet" then
minetest.set_node(pos, {name="farming:soil"})
elseif node.name == "farming:rich_soil" then
-- only turn it back if there is no plant on top of it
if minetest.get_item_group(nn, "plant") == 0 then

15
mods/farming/sugar.lua Normal file
View File

@ -0,0 +1,15 @@
--= Sugar
minetest.register_craftitem("farming:sugar", {
description = "Sugar",
inventory_image = "farming_sugar.png",
})
minetest.register_craft({
type = "cooking",
cooktime = 3,
output = "farming:sugar 2",
recipe = "default:papyrus",
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

View File

@ -98,6 +98,7 @@ minetest.register_node("farming:tomato_7", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:tomato'},rarity=1},
@ -118,6 +119,7 @@ minetest.register_node("farming:tomato_8", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:tomato 3'},rarity=1},

View File

@ -3,14 +3,26 @@ function skylands:farmplant(data, vi)
local c_carrot = minetest.get_content_id("farming:carrot_7")
local c_tomato = minetest.get_content_id("farming:tomato_7")
local c_cucumber = minetest.get_content_id("farming:cucumber_4")
local rand = math.random(1,4)
local c_corn = minetest.get_content_id("farming:corn_7")
local c_coffee = minetest.get_content_id("farming:coffee_5")
local c_melon = minetest.get_content_id("farming:melon_8")
local c_pumpkin = minetest.get_content_id("farming:pumpkin_8")
local rand = math.random(1,8)
if rand == 1 then
data[vi] = c_potato
elseif rand == 2 then
data[vi] = c_carrot
elseif rand == 3 then
data[vi] = c_tomato
else
elseif rand == 4 then
data[vi] = c_cucumber
elseif rand == 5 then
data[vi] = c_corn
elseif rand == 6 then
data[vi] = c_coffee
elseif rand == 7 then
data[vi] = c_melon
else
data[vi] = c_pumpkin
end
end