Updated farming from @tenplus1 's redo
- Updated farming (added beans)
|
@ -13,6 +13,8 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
|
|||
|
||||
Changelog:
|
||||
|
||||
1.14 - Added Green Beans from Crops mod (thanks sofar), little bushels in the wild but need to be grown using beanpoles crafted with 4 sticks (2 either side)
|
||||
1.13 - Fixed seed double-placement glitch. Mapgen now uses 0.4.12+ for plant generation
|
||||
1.12 - Player cannot place seeds in protected area, also growing speeds changed to match defaults
|
||||
1.11 - Added Straw Bale, streamlined growing abm a little, fixed melon rotation bug with screwdriver
|
||||
1.10 - Added Blueberry Bush and Blueberry Muffins, also Pumpkin/Melon easier to pick up, added check for unloaded map
|
||||
|
|
187
mods/farming/beanpole.lua
Normal file
|
@ -0,0 +1,187 @@
|
|||
--[[
|
||||
All textures by
|
||||
(C) Auke Kok <sofar@foo-projects.org>
|
||||
CC-BY-SA-3.0
|
||||
--]]
|
||||
|
||||
minetest.register_craftitem("farming:beans", {
|
||||
description = "Green Beans",
|
||||
inventory_image = "farming_beans.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
||||
if nod and nod.name == "farming:beanpole" then
|
||||
minetest.set_node(pointed_thing.under, {name="farming:beanpole_1"})
|
||||
else
|
||||
return
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
-- Beanpole
|
||||
|
||||
minetest.register_node("farming:beanpole", {
|
||||
description = "Bean Pole (place on soil before planting beans)",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole.png"},
|
||||
inventory_image = "farming_beanpole.png",
|
||||
visual_scale = 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beanpole'},rarity=1},
|
||||
}
|
||||
},
|
||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
||||
groups = {snappy=3,flammable=2,not_in_creative_inventory=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
||||
if nod and minetest.get_item_group(nod.name, "soil") < 2 then return end
|
||||
local top = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z}
|
||||
nod = minetest.get_node_or_nil(top)
|
||||
if nod and nod.name ~= "air" then return end
|
||||
minetest.set_node(pointed_thing.above, {name="farming:beanpole"})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:beanpole",
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
-- Define Corn growth stages
|
||||
|
||||
minetest.register_node("farming:beanpole_1", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole_1.png"},
|
||||
visual_scale = 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beanpole'},rarity=1},
|
||||
}
|
||||
},
|
||||
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
|
||||
groups = {snappy=3,flammable=3,not_in_creative_inventory=1,attached_node=1,growing=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:beanpole_2", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole_2.png"},
|
||||
visual_scale = 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beanpole'},rarity=1},
|
||||
}
|
||||
},
|
||||
selection_box = {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:beanpole_3", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole_3.png"},
|
||||
visual_scale = 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beanpole'},rarity=1},
|
||||
}
|
||||
},
|
||||
selection_box = {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:beanpole_4", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole_4.png"},
|
||||
visual_scale = 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beanpole'},rarity=1},
|
||||
}
|
||||
},
|
||||
selection_box = {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 Corn growth doesnnot have growing=1 so abm never has to check these
|
||||
|
||||
minetest.register_node("farming:beanpole_5", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole_5.png"},
|
||||
visual_scale = 1.45,
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beanpole'},rarity=1},
|
||||
{items = {'farming:beans 3'},rarity=1},
|
||||
{items = {'farming:beans 2'},rarity=2},
|
||||
{items = {'farming:beans 2'},rarity=3},
|
||||
}
|
||||
},
|
||||
selection_box = {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(),
|
||||
})
|
||||
|
||||
-- Wild Green Bean Bush (this is what you find on the map)
|
||||
|
||||
minetest.register_node("farming:beanbush", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanbush.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beans 1'},rarity=1},
|
||||
{items = {'farming:beans 1'},rarity=2},
|
||||
{items = {'farming:beans 1'},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(),
|
||||
})
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
-- Override default jungletree, add tree=2 for cocoa placement
|
||||
|
||||
minetest.override_item("default:jungletree", {groups = {tree=2,choppy=2,oddly_breakable_by_hand=1,flammable=2}})
|
||||
|
||||
-- Place Cocoa
|
||||
|
||||
function place_cocoa(itemstack, placer, pointed_thing, plantname)
|
||||
|
@ -21,7 +17,7 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
|
|||
end
|
||||
|
||||
-- check if pointing at jungletree
|
||||
if minetest.get_item_group(under.name, "tree") ~= 2 then
|
||||
if under.name ~= "default:jungletree" then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--[[
|
||||
Minetest Farming Redo Mod 1.12 (1st March 2015)
|
||||
Minetest Farming Redo Mod 1.14 (19th April 2015)
|
||||
by TenPlus1
|
||||
]]
|
||||
|
||||
|
@ -25,7 +25,8 @@ dofile(minetest.get_modpath("farming").."/cocoa.lua")
|
|||
dofile(minetest.get_modpath("farming").."/raspberry.lua")
|
||||
dofile(minetest.get_modpath("farming").."/blueberry.lua")
|
||||
dofile(minetest.get_modpath("farming").."/rhubarb.lua")
|
||||
dofile(minetest.get_modpath("farming").."/donut.lua") -- sweet treat
|
||||
dofile(minetest.get_modpath("farming").."/beanpole.lua")
|
||||
dofile(minetest.get_modpath("farming").."/donut.lua")
|
||||
dofile(minetest.get_modpath("farming").."/mapgen.lua")
|
||||
dofile(minetest.get_modpath("farming").."/compatibility.lua") -- Farming Plus compatibility
|
||||
|
||||
|
@ -55,7 +56,8 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
|
|||
|
||||
-- can I replace above node, and am I pointing at soil
|
||||
if not minetest.registered_nodes[above.name].buildable_to
|
||||
or minetest.get_item_group(under.name, "soil") < 2 then
|
||||
or minetest.get_item_group(under.name, "soil") < 2
|
||||
or minetest.get_item_group(above.name, "plant") ~= 0 then -- ADDED this line for multiple seed placement bug
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -1,85 +1,46 @@
|
|||
|
||||
-- Generate new foods on map
|
||||
-- spawn new foods on map
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local function register_plant(name, min, max, spawnby, num)
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"default:dirt_with_grass"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 0.006,
|
||||
spread = {x=100, y=100, z=100},
|
||||
seed = 329,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
},
|
||||
y_min = min,
|
||||
y_max = max,
|
||||
decoration = "farming:"..name,
|
||||
spawn_by = spawnby,
|
||||
num_spawn_by = num,
|
||||
})
|
||||
end
|
||||
|
||||
local perlin1 = minetest.get_perlin(329, 3, 0.6, 100)
|
||||
function farming.register_mgv6_decorations()
|
||||
register_plant("potato_3", 15, 40, "", -1)
|
||||
register_plant("tomato_7", 5, 20, "", -1)
|
||||
register_plant("carrot_8", 1, 30, "group:water", 1)
|
||||
register_plant("cucumber_4", 1, 20, "group:water", 1)
|
||||
register_plant("corn_7", 12, 22, "", -1)
|
||||
register_plant("corn_8", 10, 20, "", -1)
|
||||
register_plant("coffee_5", 20, 45, "", -1)
|
||||
register_plant("melon_8", 1, 20, "group:water", 1)
|
||||
register_plant("pumpkin_8", 1, 20, "group:water", 1)
|
||||
register_plant("raspberry_4", 3, 10, "", -1)
|
||||
register_plant("rhubarb_3", 3, 15, "group:tree", 1)
|
||||
register_plant("blueberry_4", 3, 10, "", -1)
|
||||
register_plant("beanbush", 18, 35, "", -1)
|
||||
end
|
||||
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 16
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
-- enable in mapgen v6 only
|
||||
|
||||
for divx=0,divs-1 do
|
||||
for divz=0,divs-1 do
|
||||
|
||||
local x0 = minp.x + math.floor((divx+0)*divlen)
|
||||
local z0 = minp.z + math.floor((divz+0)*divlen)
|
||||
local x1 = minp.x + math.floor((divx+1)*divlen)
|
||||
local z1 = minp.z + math.floor((divz+1)*divlen)
|
||||
|
||||
-- Determine plant amount from perlin noise
|
||||
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
|
||||
|
||||
-- Find random positions for plant based on this random
|
||||
local pr = PseudoRandom(seed+1)
|
||||
|
||||
for i=0,grass_amount do
|
||||
|
||||
local x = pr:next(x0, x1)
|
||||
local z = pr:next(z0, z1)
|
||||
|
||||
-- Find ground level (0...15)
|
||||
local ground_y = nil
|
||||
|
||||
for y=30,0,-1 do
|
||||
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
|
||||
ground_y = y
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if ground_y then
|
||||
|
||||
local p = {x=x,y=ground_y+1,z=z}
|
||||
local nn = minetest.get_node(p).name
|
||||
|
||||
-- Check if the node can be replaced
|
||||
if minetest.registered_nodes[nn] and
|
||||
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
|
||||
|
||||
-- If dirt with grass, add plant in various stages of maturity
|
||||
if nn == "default:dirt_with_grass" then
|
||||
|
||||
local type = math.random(1,11)
|
||||
if type == 1 and ground_y > 15 then
|
||||
minetest.set_node(p,{name="farming:potato_"..pr:next(3, 4)})
|
||||
elseif type == 2 then
|
||||
minetest.set_node(p,{name="farming:tomato_"..pr:next(7, 8)})
|
||||
elseif type == 3 then
|
||||
minetest.set_node(p,{name="farming:carrot_"..pr:next(7, 8)})
|
||||
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"})
|
||||
elseif type == 9 and ground_y > 5 then
|
||||
minetest.set_node(p,{name="farming:raspberry_4"})
|
||||
elseif type == 10 and ground_y > 10 then
|
||||
minetest.set_node(p,{name="farming:rhubarb_3"})
|
||||
elseif type == 11 and ground_y > 5 then
|
||||
minetest.set_node(p,{name="farming:blueberry_4"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
local mg_params = minetest.get_mapgen_params()
|
||||
if mg_params.mgname == "v6" then
|
||||
farming.register_mgv6_decorations()
|
||||
end
|
||||
|
|
BIN
mods/farming/textures/farming_beanbush.png
Normal file
After Width: | Height: | Size: 227 B |
BIN
mods/farming/textures/farming_beanpole.png
Normal file
After Width: | Height: | Size: 323 B |
BIN
mods/farming/textures/farming_beanpole_1.png
Normal file
After Width: | Height: | Size: 242 B |
BIN
mods/farming/textures/farming_beanpole_2.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
mods/farming/textures/farming_beanpole_3.png
Normal file
After Width: | Height: | Size: 297 B |
BIN
mods/farming/textures/farming_beanpole_4.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
mods/farming/textures/farming_beanpole_5.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
mods/farming/textures/farming_beans.png
Normal file
After Width: | Height: | Size: 193 B |