Updated mods, moretrees added, new farming
Updated mesecons and moreblocks, added moretrees and plantlib, changed farming mod to TenPlus1's redo, temporarily removed farming_plus. Snuck in my unreleased incinerator mod.
@ -1,3 +1,7 @@
|
||||
Minetest Farming Redo Mod 0.4 by TenPlus1
|
||||
|
||||
based on
|
||||
|
||||
Minetest 0.4 mod: farming
|
||||
=========================
|
||||
|
||||
@ -33,6 +37,8 @@ Created by Calinou (License: CC BY-SA):
|
||||
farming_tool_steelhoe.png
|
||||
farming_tool_stonehoe.png
|
||||
farming_tool_woodhoe.png
|
||||
farming_tool_mesehoe.png
|
||||
farming_tool_diamondhoe.png
|
||||
|
||||
Created by VanessaE (License: WTFPL):
|
||||
farming_cotton_seed.png
|
||||
@ -55,3 +61,38 @@ Created by VanessaE (License: WTFPL):
|
||||
farming_cotton_6.png
|
||||
farming_cotton_7.png
|
||||
farming_cotton_8.png
|
||||
|
||||
Created by Doc (License: WTFPL):
|
||||
farming_cucumber.png
|
||||
farming_cucumber_1.png
|
||||
farming_cucumber_2.png
|
||||
farming_cucumber_3.png
|
||||
farming_cucumber_4.png
|
||||
farming_potato.png
|
||||
farming_potato_1.png
|
||||
farming_potato_2.png
|
||||
farming_potato_3.png
|
||||
farming_potato_4.png
|
||||
|
||||
Created by Gambit:
|
||||
default_junglegrass.png
|
||||
farming_carrot.png
|
||||
farming_carrot_1.png
|
||||
farming_carrot_2.png
|
||||
farming_carrot_3.png
|
||||
farming_carrot_4.png
|
||||
farming_carrot_5.png
|
||||
farming_carrot_6.png
|
||||
farming_carrot_7.png
|
||||
farming_carrot_8.png
|
||||
|
||||
Created by JoseTheCrafter and edited by TenPlus1:
|
||||
farming_tomato.png
|
||||
farming_tomato_1.png
|
||||
farming_tomato_2.png
|
||||
farming_tomato_3.png
|
||||
farming_tomato_4.png
|
||||
farming_tomato_5.png
|
||||
farming_tomato_6.png
|
||||
farming_tomato_7.png
|
||||
farming_tomato_8.png
|
130
mods/farming/carrot.lua
Normal file
@ -0,0 +1,130 @@
|
||||
|
||||
--= Carrot (Original textures from PixelBox texture pack)
|
||||
-- https://forum.minetest.net/viewtopic.php?id=4990
|
||||
|
||||
minetest.register_craftitem("farming:carrot", {
|
||||
description = "Carrot",
|
||||
inventory_image = "farming_carrot.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
-- Define Carrot growth stages
|
||||
|
||||
minetest.register_node("farming:carrot_1", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_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:carrot_2", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_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:carrot_3", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_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:carrot_4", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_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:carrot_5", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_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:carrot_6", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_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:carrot_7", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_7.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:carrot'},rarity=1},
|
||||
{items = {'farming:carrot 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,growing=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
-- Last stage of Carrot growth doesnnot have growing=1 so abm never has to check these
|
||||
|
||||
minetest.register_node("farming:carrot_8", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_8.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:carrot 2'},rarity=1},
|
||||
{items = {'farming:carrot 3'},rarity=2},
|
||||
}
|
||||
},
|
||||
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(),
|
||||
})
|
162
mods/farming/cotton.lua
Normal file
@ -0,0 +1,162 @@
|
||||
|
||||
--= Cotton
|
||||
|
||||
-- Cotton Seed
|
||||
|
||||
minetest.register_craftitem("farming:seed_cotton", {
|
||||
description = "Cotton Seed",
|
||||
inventory_image = "farming_cotton_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- String
|
||||
|
||||
minetest.register_craftitem("farming:string", {
|
||||
description = "String",
|
||||
inventory_image = "farming_string.png",
|
||||
})
|
||||
|
||||
-- String to Wool
|
||||
|
||||
minetest.register_craft({
|
||||
output = "wool:white",
|
||||
recipe = {
|
||||
{"farming:string", "farming:string"},
|
||||
{"farming:string", "farming:string"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Define Cotton growth stages
|
||||
|
||||
minetest.register_node("farming:cotton_1", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_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:cotton_2", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_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:cotton_3", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_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:cotton_4", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_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:cotton_5", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_5.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:seed_cotton'},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:cotton_6", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_6.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:string'},rarity=1},
|
||||
{items = {'farming:string'},rarity=2},
|
||||
}
|
||||
},
|
||||
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:cotton_7", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_7.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:string'},rarity=1},
|
||||
{items = {'farming:string'},rarity=2},
|
||||
{items = {'farming:seed_cotton'},rarity=1},
|
||||
{items = {'farming:seed_cotton'},rarity=2},
|
||||
}
|
||||
},
|
||||
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(),
|
||||
})
|
||||
|
||||
-- Define last stage of Cotton growth separate and without growing=1 so abm never has to check these
|
||||
|
||||
minetest.register_node("farming:cotton_8", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_8.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:string'},rarity=1},
|
||||
{items = {'farming:string'},rarity=2},
|
||||
{items = {'farming:string'},rarity=3},
|
||||
{items = {'farming:seed_cotton'},rarity=1},
|
||||
{items = {'farming:seed_cotton'},rarity=2},
|
||||
{items = {'farming:seed_cotton'},rarity=3},
|
||||
}
|
||||
},
|
||||
selection_box = {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(),
|
||||
})
|
73
mods/farming/cucumber.lua
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
--= Cucumber (Original textures from DocFarming mod)
|
||||
-- https://forum.minetest.net/viewtopic.php?id=3948
|
||||
|
||||
minetest.register_craftitem("farming:cucumber", {
|
||||
description = "Cucumber",
|
||||
inventory_image = "farming_cucumber.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
-- Define Cucumber growth stages
|
||||
|
||||
minetest.register_node("farming:cucumber_1", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cucumber_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:cucumber_2", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cucumber_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:cucumber_3", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cucumber_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(),
|
||||
})
|
||||
|
||||
-- Last stage of Cucumber growth doesnnot have growing=1 so abm never has to check these
|
||||
|
||||
minetest.register_node("farming:cucumber_4", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cucumber_4.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:cucumber'},rarity=1},
|
||||
{items = {'farming:cucumber 2'},rarity=2},
|
||||
}
|
||||
},
|
||||
selection_box = {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,2 +1,4 @@
|
||||
default
|
||||
|
||||
wool
|
||||
skylands
|
99
mods/farming/grass.lua
Normal file
@ -0,0 +1,99 @@
|
||||
--= Grass
|
||||
|
||||
-- Override default grass and have it drop Wheat Seeds
|
||||
|
||||
minetest.register_node(":default:grass_1", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_1.png"},
|
||||
-- use a bigger inventory image
|
||||
inventory_image = "default_grass_3.png",
|
||||
wield_image = "default_grass_3.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_wheat'},rarity = 5},
|
||||
{items = {'default:grass_1'}},
|
||||
}
|
||||
},
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
--= Disabled the following random grass placement as it crashes servers when protection nearby...
|
||||
-- on_place = function(itemstack, placer, pointed_thing)
|
||||
-- -- place a random grass node
|
||||
-- local stack = ItemStack("default:grass_"..math.random(1,5))
|
||||
-- local ret = minetest.item_place(stack, placer, pointed_thing)
|
||||
-- return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
|
||||
-- end,
|
||||
})
|
||||
|
||||
-- Override default Jungle Grass and have it drop Cotton Seeds
|
||||
|
||||
minetest.register_node(":default:junglegrass", {
|
||||
description = "Jungle Grass",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_junglegrass.png"},
|
||||
inventory_image = "default_junglegrass.png",
|
||||
wield_image = "default_junglegrass.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_cotton'},rarity = 8},
|
||||
{items = {'default:junglegrass'}},
|
||||
}
|
||||
},
|
||||
groups = {snappy=3,flammable=2,flora=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
-- Define rest of grass for growing
|
||||
|
||||
for i=2,5 do
|
||||
minetest.register_node(":default:grass_"..i, {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_"..i..".png"},
|
||||
inventory_image = "default_grass_"..i..".png",
|
||||
wield_image = "default_grass_"..i..".png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_wheat'},rarity = 5},
|
||||
{items = {'default:grass_1'}},
|
||||
}
|
||||
},
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
end
|
174
mods/farming/hoes.lua
Normal file
@ -0,0 +1,174 @@
|
||||
|
||||
--= Hoes
|
||||
|
||||
-- Turns nodes with group soil=1 into soil
|
||||
|
||||
function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
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)
|
||||
local upos = pointed_thing.under
|
||||
|
||||
if minetest.is_protected(upos, user:get_player_name()) then
|
||||
minetest.record_protection_violation(upos, user:get_player_name())
|
||||
return
|
||||
end
|
||||
|
||||
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||
local above = minetest.get_node(p)
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if the node above the pointed thing is air
|
||||
if above.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at dirt
|
||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- turn the node into soil, wear out item and play sound
|
||||
if under.name == "skylands:rich_dirt" then
|
||||
minetest.set_node(pt.under, {name="farming:rich_soil"})
|
||||
else
|
||||
minetest.set_node(pt.under, {name="farming:soil"})
|
||||
end
|
||||
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,})
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Wooden Hoe
|
||||
|
||||
minetest.register_tool("farming:hoe_wood", {
|
||||
description = "Wooden Hoe",
|
||||
inventory_image = "farming_tool_woodhoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 30)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_wood",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Stone Hoe
|
||||
|
||||
minetest.register_tool("farming:hoe_stone", {
|
||||
description = "Stone Hoe",
|
||||
inventory_image = "farming_tool_stonehoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 90)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_stone",
|
||||
recipe = {
|
||||
{"group:stone", "group:stone"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Steel Hoe
|
||||
|
||||
minetest.register_tool("farming:hoe_steel", {
|
||||
description = "Steel Hoe",
|
||||
inventory_image = "farming_tool_steelhoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 200)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_steel",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Bronze Hoe
|
||||
|
||||
minetest.register_tool("farming:hoe_bronze", {
|
||||
description = "Bronze Hoe",
|
||||
inventory_image = "farming_tool_bronzehoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 220)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_bronze",
|
||||
recipe = {
|
||||
{"default:bronze_ingot", "default:bronze_ingot"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Mese
|
||||
|
||||
minetest.register_tool("farming:hoe_mese", {
|
||||
description = "Mese Hoe",
|
||||
inventory_image = "farming_tool_mesehoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 350)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_mese",
|
||||
recipe = {
|
||||
{"default:mese_crystal", "default:mese_crystal"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Diamond
|
||||
|
||||
minetest.register_tool("farming:hoe_diamond", {
|
||||
description = "Diamond Hoe",
|
||||
inventory_image = "farming_tool_diamondhoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 500)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_diamond",
|
||||
recipe = {
|
||||
{"default:diamond", "default:diamond"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
@ -1,277 +1,26 @@
|
||||
-- Minetest 0.4 mod: farming
|
||||
-- See README.txt for licensing and other information.
|
||||
--[[
|
||||
Minetest Farming Redo Mod 0.5 (26 July 2014)
|
||||
by TenPlus1
|
||||
Some additions by HeroOfTheWinds for use with SkyTest
|
||||
]]
|
||||
|
||||
farming = {}
|
||||
farming.hoe_on_use = default.hoe_on_use
|
||||
|
||||
--
|
||||
-- Soil
|
||||
--
|
||||
minetest.register_node("farming:soil", {
|
||||
description = "Soil",
|
||||
tiles = {"farming_soil.png", "default_dirt.png"},
|
||||
drop = "default:dirt",
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=2},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
dofile(minetest.get_modpath("farming").."/soil.lua")
|
||||
dofile(minetest.get_modpath("farming").."/hoes.lua")
|
||||
dofile(minetest.get_modpath("farming").."/grass.lua")
|
||||
dofile(minetest.get_modpath("farming").."/wheat.lua")
|
||||
dofile(minetest.get_modpath("farming").."/cotton.lua")
|
||||
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").."/mapgen.lua")
|
||||
|
||||
minetest.register_node("farming:soil_wet", {
|
||||
description = "Wet Soil",
|
||||
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
|
||||
drop = "default:dirt",
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=3},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
-- Place Seeds on Soil
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:soil", "farming:soil_wet"},
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].walkable and
|
||||
minetest.get_item_group(nn, "plant") == 0
|
||||
then
|
||||
minetest.set_node(pos, {name="default:dirt"})
|
||||
end
|
||||
-- check if there is water nearby
|
||||
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||
-- if it is dry soil turn it into wet soil
|
||||
if node.name == "farming:soil" then
|
||||
minetest.set_node(pos, {name="farming:soil_wet"})
|
||||
end
|
||||
else
|
||||
-- turn it back into dirt if it is already dry
|
||||
if node.name == "farming:soil" then
|
||||
-- only turn it back if there is no plant on top of it
|
||||
if minetest.get_item_group(nn, "plant") == 0 then
|
||||
minetest.set_node(pos, {name="default:dirt"})
|
||||
end
|
||||
|
||||
-- if its wet turn it back into dry soil
|
||||
elseif node.name == "farming:soil_wet" then
|
||||
minetest.set_node(pos, {name="farming:soil"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- Hoes
|
||||
--
|
||||
-- turns nodes with group soil=1 into soil
|
||||
function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
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)
|
||||
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||
local above = minetest.get_node(p)
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if the node above the pointed thing is air
|
||||
if above.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at dirt
|
||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- turn the node into soil, wear out item and play sound
|
||||
minetest.set_node(pt.under, {name="farming:soil"})
|
||||
minetest.sound_play("default_dig_crumbly", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_tool("farming:hoe_wood", {
|
||||
description = "Wooden Hoe",
|
||||
inventory_image = "farming_tool_woodhoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 30)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("farming:hoe_stone", {
|
||||
description = "Stone Hoe",
|
||||
inventory_image = "farming_tool_stonehoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 90)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("farming:hoe_steel", {
|
||||
description = "Steel Hoe",
|
||||
inventory_image = "farming_tool_steelhoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 200)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("farming:hoe_bronze", {
|
||||
description = "Bronze Hoe",
|
||||
inventory_image = "farming_tool_bronzehoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 220)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_wood",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_stone",
|
||||
recipe = {
|
||||
{"group:stone", "group:stone"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_steel",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_bronze",
|
||||
recipe = {
|
||||
{"default:bronze_ingot", "default:bronze_ingot"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
--
|
||||
-- Override grass for drops
|
||||
--
|
||||
minetest.register_node(":default:grass_1", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_1.png"},
|
||||
-- use a bigger inventory image
|
||||
inventory_image = "default_grass_3.png",
|
||||
wield_image = "default_grass_3.png",
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_wheat'},rarity = 5},
|
||||
{items = {'default:grass_1'}},
|
||||
}
|
||||
},
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
-- place a random grass node
|
||||
local stack = ItemStack("default:grass_"..math.random(1,5))
|
||||
local ret = minetest.item_place(stack, placer, pointed_thing)
|
||||
return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
|
||||
end,
|
||||
})
|
||||
|
||||
for i=2,5 do
|
||||
minetest.register_node(":default:grass_"..i, {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_"..i..".png"},
|
||||
inventory_image = "default_grass_"..i..".png",
|
||||
wield_image = "default_grass_"..i..".png",
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_wheat'},rarity = 5},
|
||||
{items = {'default:grass_1'}},
|
||||
}
|
||||
},
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node(":default:junglegrass", {
|
||||
description = "Jungle Grass",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_junglegrass.png"},
|
||||
inventory_image = "default_junglegrass.png",
|
||||
wield_image = "default_junglegrass.png",
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_cotton'},rarity = 8},
|
||||
{items = {'default:junglegrass'}},
|
||||
}
|
||||
},
|
||||
groups = {snappy=3,flammable=2,flora=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
--
|
||||
-- Place seeds
|
||||
--
|
||||
local function place_seed(itemstack, placer, pointed_thing, plantname)
|
||||
function place_seed(itemstack, placer, pointed_thing, plantname)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
if not pt then
|
||||
@ -315,188 +64,79 @@ local function place_seed(itemstack, placer, pointed_thing, plantname)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
--
|
||||
-- Wheat
|
||||
--
|
||||
minetest.register_craftitem("farming:seed_wheat", {
|
||||
description = "Wheat Seed",
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:wheat", {
|
||||
description = "Wheat",
|
||||
inventory_image = "farming_wheat.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:flour", {
|
||||
description = "Flour",
|
||||
inventory_image = "farming_flour.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:flour",
|
||||
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 15,
|
||||
output = "farming:bread",
|
||||
recipe = "farming:flour"
|
||||
})
|
||||
|
||||
for i=1,8 do
|
||||
local drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'},rarity=9-i},
|
||||
{items = {'farming:wheat'},rarity=18-i*2},
|
||||
{items = {'farming:seed_wheat'},rarity=9-i},
|
||||
{items = {'farming:seed_wheat'},rarity=18-i*2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:wheat_"..i, {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_"..i..".png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = 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,wheat=i,not_in_creative_inventory=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
-- Single ABM Handles Growing of All Plants
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:wheat"},
|
||||
neighbors = {"group:soil"},
|
||||
interval = 90,
|
||||
nodenames = {"group:growing"},
|
||||
neighbors = {"farming:soil_wet"},
|
||||
interval = 70,
|
||||
chance = 2,
|
||||
|
||||
action = function(pos, node)
|
||||
-- return if already full grown
|
||||
if minetest.get_item_group(node.name, "wheat") == 8 then
|
||||
|
||||
-- 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)
|
||||
|
||||
-- check if fully grown
|
||||
if not minetest.registered_nodes[plant..(numb + 1)] then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if on wet soil
|
||||
pos.y = pos.y-1
|
||||
local n = minetest.get_node(pos)
|
||||
if minetest.get_item_group(n.name, "soil") < 3 then
|
||||
if n.name ~= "farming:soil_wet" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
|
||||
-- check light
|
||||
if not minetest.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- grow
|
||||
local height = minetest.get_item_group(node.name, "wheat") + 1
|
||||
minetest.set_node(pos, {name="farming:wheat_"..height})
|
||||
minetest.set_node(pos, {name=plant..(numb + 1)})
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
-- Cotton
|
||||
--
|
||||
minetest.register_craftitem("farming:seed_cotton", {
|
||||
description = "Cotton Seed",
|
||||
inventory_image = "farming_cotton_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:string", {
|
||||
description = "String",
|
||||
inventory_image = "farming_string.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "wool:white",
|
||||
recipe = {
|
||||
{"farming:string", "farming:string"},
|
||||
{"farming:string", "farming:string"},
|
||||
}
|
||||
})
|
||||
|
||||
for i=1,8 do
|
||||
local drop = {
|
||||
items = {
|
||||
{items = {'farming:string'},rarity=9-i},
|
||||
{items = {'farming:string'},rarity=18-i*2},
|
||||
{items = {'farming:string'},rarity=27-i*3},
|
||||
{items = {'farming:seed_cotton'},rarity=9-i},
|
||||
{items = {'farming:seed_cotton'},rarity=18-i*2},
|
||||
{items = {'farming:seed_cotton'},rarity=27-i*3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cotton_"..i, {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_"..i..".png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = 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,cotton=i,not_in_creative_inventory=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
--double speed for rich soil
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:cotton"},
|
||||
neighbors = {"group:soil"},
|
||||
interval = 80,
|
||||
nodenames = {"group:growing"},
|
||||
neighbors = {"farming:rich_soil_wet"},
|
||||
interval = 35,
|
||||
chance = 2,
|
||||
|
||||
action = function(pos, node)
|
||||
-- return if already full grown
|
||||
if minetest.get_item_group(node.name, "cotton") == 8 then
|
||||
|
||||
-- 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)
|
||||
|
||||
-- check if fully grown
|
||||
if not minetest.registered_nodes[plant..(numb + 1)] then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if on wet soil
|
||||
pos.y = pos.y-1
|
||||
local n = minetest.get_node(pos)
|
||||
if minetest.get_item_group(n.name, "soil") < 3 then
|
||||
if n.name ~= "farming:rich_soil_wet" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
|
||||
-- check light
|
||||
if not minetest.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- grow
|
||||
local height = minetest.get_item_group(node.name, "cotton") + 1
|
||||
minetest.set_node(pos, {name="farming:cotton_"..height})
|
||||
minetest.set_node(pos, {name=plant..(numb + 1)})
|
||||
end
|
||||
})
|
||||
|
73
mods/farming/mapgen.lua
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
-- Generate new foods on map
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
|
||||
local perlin1 = minetest.get_perlin(329, 3, 0.6, 100)
|
||||
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 16
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
|
||||
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 grass 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
|
||||
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,4)
|
||||
if type == 1 then
|
||||
minetest.set_node(p,{name="farming:potato_"..pr:next(3, 4)})
|
||||
else if type == 2 then
|
||||
minetest.set_node(p,{name="farming:tomato_"..pr:next(7, 8)})
|
||||
else if type == 3 then
|
||||
minetest.set_node(p,{name="farming:carrot_"..pr:next(7, 8)})
|
||||
else
|
||||
minetest.set_node(p,{name="farming:cucumber_4"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
91
mods/farming/potato.lua
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
--= Potato (Original textures from DocFarming mod)
|
||||
-- https://forum.minetest.net/viewtopic.php?id=3948
|
||||
|
||||
minetest.register_craftitem("farming:potato", {
|
||||
description = "Potato",
|
||||
inventory_image = "farming_potato.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:baked_potato", {
|
||||
description = "Baked Potato",
|
||||
inventory_image = "farming_baked_potato.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 10,
|
||||
output = "farming:baked_potato",
|
||||
recipe = "farming:potato"
|
||||
})
|
||||
|
||||
-- Define Potato growth stages
|
||||
|
||||
minetest.register_node("farming:potato_1", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potato_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:potato_2", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potato_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:potato_3", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potato_3.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:potato'},rarity=1},
|
||||
{items = {'farming:potato'},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,growing=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
-- Last stage of Potato growth doesnnot have growing=1 so abm never has to check these
|
||||
|
||||
minetest.register_node("farming:potato_4", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potato_4.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:potato 2'},rarity=1},
|
||||
{items = {'farming:potato 3'},rarity=2},
|
||||
}
|
||||
},
|
||||
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(),
|
||||
})
|
96
mods/farming/soil.lua
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
--= Soil Functions
|
||||
|
||||
-- Normal Soil
|
||||
|
||||
minetest.register_node("farming:soil", {
|
||||
description = "Soil",
|
||||
tiles = {"farming_soil.png", "default_dirt.png"},
|
||||
drop = "default:dirt",
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=2},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
-- Wet Soil
|
||||
|
||||
minetest.register_node("farming:soil_wet", {
|
||||
description = "Wet Soil",
|
||||
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
|
||||
drop = "default:dirt",
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=3},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
-- Rich Soil
|
||||
|
||||
minetest.register_node("farming:rich_soil", {
|
||||
description = "Rich Soil",
|
||||
tiles = {"farming_rich_soil.png", "skylands_rich_dirt.png"},
|
||||
drop = "skylands:rich_dirt",
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=2},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
-- Wet Soil
|
||||
|
||||
minetest.register_node("farming:rich_soil_wet", {
|
||||
description = "Wet, Rich Soil",
|
||||
tiles = {"farming_soil_wet.png", "skylands_rich_soil.png"},
|
||||
drop = "skylands:rich_dirt",
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=3},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
-- If Water near Soil then turn into Wet Soil
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:soil", "farming:soil_wet", "farming:rich_soil", "farming:rich_soil_wet"},
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].walkable and
|
||||
minetest.get_item_group(nn, "plant") == 0
|
||||
then
|
||||
minetest.set_node(pos, {name="default:dirt"})
|
||||
end
|
||||
-- check if there is water nearby
|
||||
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||
-- if it is dry soil turn it into wet soil
|
||||
if node.name == "farming:soil" then
|
||||
minetest.set_node(pos, {name="farming:soil_wet"})
|
||||
elseif node.name == "farming:rich_soil" then
|
||||
minetest.set_node(pos, {name="farming:rich_soil_wet"})
|
||||
end
|
||||
else
|
||||
-- turn it back into dirt if it is already dry
|
||||
if node.name == "farming:soil" then
|
||||
-- only turn it back if there is no plant on top of it
|
||||
if minetest.get_item_group(nn, "plant") == 0 then
|
||||
minetest.set_node(pos, {name="default:dirt"})
|
||||
end
|
||||
|
||||
-- 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
|
||||
minetest.set_node(pos, {name="skylands:rich_dirt"})
|
||||
end
|
||||
|
||||
-- if its wet turn it back into dry soil
|
||||
elseif node.name == "farming:rich_soil_wet" then
|
||||
minetest.set_node(pos, {name="farming:rich_soil"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
BIN
mods/farming/textures/farming_baked_potato.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
mods/farming/textures/farming_carrot.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
mods/farming/textures/farming_carrot_1.png
Normal file
After Width: | Height: | Size: 108 B |
BIN
mods/farming/textures/farming_carrot_2.png
Normal file
After Width: | Height: | Size: 111 B |
BIN
mods/farming/textures/farming_carrot_3.png
Normal file
After Width: | Height: | Size: 113 B |
BIN
mods/farming/textures/farming_carrot_4.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
mods/farming/textures/farming_carrot_5.png
Normal file
After Width: | Height: | Size: 123 B |
BIN
mods/farming/textures/farming_carrot_6.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
mods/farming/textures/farming_carrot_7.png
Normal file
After Width: | Height: | Size: 144 B |
BIN
mods/farming/textures/farming_carrot_8.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
mods/farming/textures/farming_cucumber.png
Normal file
After Width: | Height: | Size: 185 B |
BIN
mods/farming/textures/farming_cucumber_1.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
mods/farming/textures/farming_cucumber_2.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
mods/farming/textures/farming_cucumber_3.png
Normal file
After Width: | Height: | Size: 217 B |
BIN
mods/farming/textures/farming_cucumber_4.png
Normal file
After Width: | Height: | Size: 275 B |
BIN
mods/farming/textures/farming_potato.png
Normal file
After Width: | Height: | Size: 252 B |
BIN
mods/farming/textures/farming_potato_1.png
Normal file
After Width: | Height: | Size: 132 B |
BIN
mods/farming/textures/farming_potato_2.png
Normal file
After Width: | Height: | Size: 187 B |
BIN
mods/farming/textures/farming_potato_3.png
Normal file
After Width: | Height: | Size: 237 B |
BIN
mods/farming/textures/farming_potato_4.png
Normal file
After Width: | Height: | Size: 283 B |
BIN
mods/farming/textures/farming_rich_soil.png
Normal file
After Width: | Height: | Size: 802 B |
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 713 B |
Before Width: | Height: | Size: 759 B After Width: | Height: | Size: 659 B |
Before Width: | Height: | Size: 818 B After Width: | Height: | Size: 721 B |
BIN
mods/farming/textures/farming_tomato.png
Normal file
After Width: | Height: | Size: 488 B |
BIN
mods/farming/textures/farming_tomato_1.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
mods/farming/textures/farming_tomato_2.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
mods/farming/textures/farming_tomato_3.png
Normal file
After Width: | Height: | Size: 250 B |
BIN
mods/farming/textures/farming_tomato_4.png
Normal file
After Width: | Height: | Size: 269 B |
BIN
mods/farming/textures/farming_tomato_5.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
mods/farming/textures/farming_tomato_6.png
Normal file
After Width: | Height: | Size: 490 B |
BIN
mods/farming/textures/farming_tomato_7.png
Normal file
After Width: | Height: | Size: 570 B |
BIN
mods/farming/textures/farming_tomato_8.png
Normal file
After Width: | Height: | Size: 510 B |
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 258 B |
BIN
mods/farming/textures/farming_tool_diamondhoe.png
Normal file
After Width: | Height: | Size: 244 B |
BIN
mods/farming/textures/farming_tool_mesehoe.png
Normal file
After Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 222 B |
130
mods/farming/tomato.lua
Normal file
@ -0,0 +1,130 @@
|
||||
|
||||
--= 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)
|
||||
|
||||
minetest.register_craftitem("farming:tomato", {
|
||||
description = "Tomato",
|
||||
inventory_image = "farming_tomato.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
-- Define Tomato growth stages
|
||||
|
||||
minetest.register_node("farming:tomato_1", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_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:tomato_2", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_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:tomato_3", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_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:tomato_4", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_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:tomato_5", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_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:tomato_6", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_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:tomato_7", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_7.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:tomato'},rarity=1},
|
||||
{items = {'farming:tomato'},rarity=3},
|
||||
}
|
||||
},
|
||||
selection_box = {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 Carrot growth doesnnot have growing=1 so abm never has to check these
|
||||
|
||||
minetest.register_node("farming:tomato_8", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_8.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:tomato 3'},rarity=1},
|
||||
{items = {'farming:tomato 3'},rarity=2},
|
||||
}
|
||||
},
|
||||
selection_box = {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(),
|
||||
})
|
179
mods/farming/wheat.lua
Normal file
@ -0,0 +1,179 @@
|
||||
|
||||
--= Wheat
|
||||
|
||||
-- Wheat Seed
|
||||
|
||||
minetest.register_craftitem("farming:seed_wheat", {
|
||||
description = "Wheat Seed",
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Harvested Wheat
|
||||
|
||||
minetest.register_craftitem("farming:wheat", {
|
||||
description = "Wheat",
|
||||
inventory_image = "farming_wheat.png",
|
||||
})
|
||||
|
||||
-- flour
|
||||
|
||||
minetest.register_craftitem("farming:flour", {
|
||||
description = "Flour",
|
||||
inventory_image = "farming_flour.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:flour",
|
||||
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
|
||||
})
|
||||
|
||||
-- Bread
|
||||
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 15,
|
||||
output = "farming:bread",
|
||||
recipe = "farming:flour"
|
||||
})
|
||||
|
||||
-- Define Wheat growth stages
|
||||
|
||||
minetest.register_node("farming:wheat_1", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_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:wheat_2", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_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:wheat_3", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_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:wheat_4", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_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:wheat_5", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_5.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'},rarity=2},
|
||||
{items = {'farming:seed_wheat'},rarity=2},
|
||||
}
|
||||
},
|
||||
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:wheat_6", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_6.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'},rarity=2},
|
||||
{items = {'farming:seed_wheat'},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:wheat_7", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_7.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'},rarity=1},
|
||||
{items = {'farming:wheat'},rarity=3},
|
||||
{items = {'farming:seed_wheat'},rarity=1},
|
||||
{items = {'farming:seed_wheat'},rarity=3},
|
||||
}
|
||||
},
|
||||
selection_box = {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 Wheat growth doesnnot have growing=1 so abm never has to check these
|
||||
|
||||
minetest.register_node("farming:wheat_8", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_8.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'},rarity=1},
|
||||
{items = {'farming:wheat'},rarity=2},
|
||||
{items = {'farming:seed_wheat'},rarity=1},
|
||||
{items = {'farming:seed_wheat'},rarity=2},
|
||||
}
|
||||
},
|
||||
selection_box = {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,23 +0,0 @@
|
||||
===FARMING_PLUS MOD for MINETEST===
|
||||
by PilzAdam
|
||||
|
||||
License:
|
||||
Sourcecode: WTFPL (see below)
|
||||
Graphics: WTFPL (see below)
|
||||
|
||||
See also:
|
||||
http://minetest.net/
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
@ -1,63 +0,0 @@
|
||||
minetest.register_node("farming_plus:banana_sapling", {
|
||||
description = "Banana Tree Sapling",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_banana_sapling.png"},
|
||||
inventory_image = "farming_banana_sapling.png",
|
||||
wield_image = "farming_banana_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:banana_leaves", {
|
||||
drawtype = "allfaces_optional",
|
||||
tiles = {"farming_banana_leaves.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {'farming_plus:banana_sapling'},
|
||||
rarity = 20,
|
||||
},
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming_plus:banana_sapling"},
|
||||
interval = 60,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
farming:generate_tree(pos, "default:tree", "farming_plus:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming_plus:banana"]=20})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
if math.random(1, 100) > 5 then
|
||||
return
|
||||
end
|
||||
local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
|
||||
local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"})
|
||||
if pos ~= nil then
|
||||
farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming_plus:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming_plus:banana"]=10})
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_node("farming_plus:banana", {
|
||||
description = "Banana",
|
||||
tiles = {"farming_banana.png"},
|
||||
inventory_image = "farming_banana.png",
|
||||
wield_image = "farming_banana.png",
|
||||
drawtype = "torchlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {fleshy=3,dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
@ -1,89 +0,0 @@
|
||||
minetest.register_craftitem("farming_plus:carrot_seed", {
|
||||
description = "Carrot Seeds",
|
||||
inventory_image = "farming_carrot_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming_plus:carrot_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:carrot_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_carrot_1.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:carrot_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_carrot_2.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:carrot_3", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_carrot_3.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:carrot", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_4.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming_plus:carrot_seed'} },
|
||||
{ items = {'farming_plus:carrot_seed'}, rarity = 2},
|
||||
{ items = {'farming_plus:carrot_seed'}, rarity = 5},
|
||||
{ items = {'farming_plus:carrot_item'} },
|
||||
{ items = {'farming_plus:carrot_item'}, rarity = 2 },
|
||||
{ items = {'farming_plus:carrot_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:carrot_item", {
|
||||
description = "Carrot",
|
||||
inventory_image = "farming_carrot.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
||||
farming:add_plant("farming_plus:carrot", {"farming_plus:carrot_1", "farming_plus:carrot_2", "farming_plus:carrot_3"}, 50, 20)
|
@ -1,73 +0,0 @@
|
||||
minetest.register_node("farming_plus:cocoa_sapling", {
|
||||
description = "Cocoa Tree Sapling",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cocoa_sapling.png"},
|
||||
inventory_image = "farming_cocoa_sapling.png",
|
||||
wield_image = "farming_cocoa_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:cocoa_leaves", {
|
||||
drawtype = "allfaces_optional",
|
||||
tiles = {"farming_banana_leaves.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {'farming_plus:cocoa_sapling'},
|
||||
rarity = 20,
|
||||
},
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming_plus:cocoa_sapling"},
|
||||
interval = 60,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
farming:generate_tree(pos, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=20})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
if math.random(1, 100) > 5 then
|
||||
return
|
||||
end
|
||||
local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
|
||||
local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:desert_sand"})
|
||||
if pos ~= nil then
|
||||
farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=20})
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_node("farming_plus:cocoa", {
|
||||
description = "Cocoa",
|
||||
tiles = {"farming_cocoa.png"},
|
||||
visual_scale = 0.5,
|
||||
inventory_image = "farming_cocoa.png",
|
||||
wield_image = "farming_cocoa.png",
|
||||
drawtype = "torchlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {fleshy=3,dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:cocoa_bean", {
|
||||
description = "Cocoa Bean",
|
||||
inventory_image = "farming_cocoa_bean.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming_plus:cocoa_bean 10",
|
||||
type = "shapeless",
|
||||
recipe = {"farming_plus:cocoa"},
|
||||
})
|
@ -1,260 +0,0 @@
|
||||
|
||||
farming.registered_plants = {}
|
||||
|
||||
function farming:add_plant(full_grown, names, interval, chance)
|
||||
minetest.register_abm({
|
||||
nodenames = names,
|
||||
interval = interval,
|
||||
chance = chance,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
if minetest.env:get_node(pos).name ~= "farming:soil_wet" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if not minetest.env:get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.env:get_node_light(pos) < 8 then
|
||||
return
|
||||
end
|
||||
local step = nil
|
||||
for i,name in ipairs(names) do
|
||||
if name == node.name then
|
||||
step = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if step == nil then
|
||||
return
|
||||
end
|
||||
local new_node = {name=names[step+1]}
|
||||
if new_node.name == nil then
|
||||
new_node.name = full_grown
|
||||
end
|
||||
minetest.env:set_node(pos, new_node)
|
||||
end
|
||||
})
|
||||
|
||||
table.insert(farming.registered_plants, {
|
||||
full_grown = full_grown,
|
||||
names = names,
|
||||
interval = interval,
|
||||
chance = chance,
|
||||
})
|
||||
end
|
||||
|
||||
function farming:generate_tree(pos, trunk, leaves, underground, replacements)
|
||||
pos.y = pos.y-1
|
||||
local nodename = minetest.env:get_node(pos).name
|
||||
local ret = true
|
||||
for _,name in ipairs(underground) do
|
||||
if nodename == name then
|
||||
ret = false
|
||||
break
|
||||
end
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if not minetest.env:get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if ret or minetest.env:get_node_light(pos) < 8 then
|
||||
return
|
||||
end
|
||||
|
||||
node = {name = ""}
|
||||
for dy=1,4 do
|
||||
pos.y = pos.y+dy
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
node.name = trunk
|
||||
for dy=0,4 do
|
||||
pos.y = pos.y+dy
|
||||
minetest.env:set_node(pos, node)
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
if not replacements then
|
||||
replacements = {}
|
||||
end
|
||||
|
||||
node.name = leaves
|
||||
pos.y = pos.y+3
|
||||
for dx=-2,2 do
|
||||
for dz=-2,2 do
|
||||
for dy=0,3 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
|
||||
if dx == 0 and dz == 0 and dy==3 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif dx == 0 and dz == 0 and dy==4 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:set_node(pos, node)
|
||||
for name,rarity in pairs(replacements) do
|
||||
if math.random(1, rarity) == 1 then
|
||||
minetest.env:set_node(pos, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
farming.seeds = {
|
||||
["farming:pumpkin_seed"]=60,
|
||||
["farming_plus:strawberry_seed"]=30,
|
||||
["farming_plus:rhubarb_seed"]=30,
|
||||
["farming_plus:potatoe_seed"]=30,
|
||||
["farming_plus:tomato_seed"]=30,
|
||||
["farming_plus:orange_seed"]=30,
|
||||
["farming_plus:carrot_seed"]=30,
|
||||
}
|
||||
|
||||
-- ========= GENERATE PLANTS IN THE MAP =========
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Generate plants (code from flowers)
|
||||
local perlin1 = minetest.get_perlin(974, 3, 0.6, 100)
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 16
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
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 flowers amount from perlin noise
|
||||
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
|
||||
-- Find random positions for flowers based on this random
|
||||
local pr = PseudoRandom(seed+456)
|
||||
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 nn == "default:dirt_with_grass" then
|
||||
--local plant_choice = pr:next(1, #farming.registered_plants)
|
||||
local plant_choice = math.floor(perlin1:get2d({x=x,y=z})*(#farming.registered_plants))
|
||||
local plant = farming.registered_plants[plant_choice]
|
||||
if plant then
|
||||
minetest.set_node(p, {name=plant.full_grown})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- ========= ALIASES FOR FARMING MOD BY SAPIER =========
|
||||
-- potatoe -> potatoe
|
||||
minetest.register_alias("farming:potatoe_node", "farming_plus:potatoe")
|
||||
--minetest.register_alias("farming:potatoe", "farming:potatoe_item") cant do this
|
||||
minetest.register_alias("farming:potatoe_straw", "farming_plus:potatoe")
|
||||
minetest.register_alias("farming:seed_potatoe", "farming_plus:potatoe_seed")
|
||||
for lvl = 1, 6, 1 do
|
||||
minetest.register_entity(":farming:potatoe_lvl"..lvl, {
|
||||
on_activate = function(self, staticdata)
|
||||
minetest.env:set_node(self.object:getpos(), {name="farming_plus:potatoe_1"})
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
minetest.register_alias("farming:cotton", "farming:cotton_3")
|
||||
minetest.register_alias("farming:wheat_harvested", "farming:wheat")
|
||||
minetest.register_alias("farming:dough", "farming:flour")
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:wheat"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
minetest.env:set_node(pos, {name="farming:wheat_8"})
|
||||
end,
|
||||
})
|
||||
|
||||
-- ========= STRAWBERRIES =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/strawberries.lua")
|
||||
|
||||
-- ========= RHUBARB =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/rhubarb.lua")
|
||||
|
||||
-- ========= POTATOES =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/potatoes.lua")
|
||||
|
||||
-- ========= TOMATOES =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/tomatoes.lua")
|
||||
|
||||
-- ========= ORANGES =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/oranges.lua")
|
||||
|
||||
-- ========= BANANAS =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/bananas.lua")
|
||||
|
||||
-- ========= CARROTS =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/carrots.lua")
|
||||
|
||||
-- ========= COCOA =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/cocoa.lua")
|
||||
|
||||
-- ========= PUMPKIN =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/pumpkin.lua")
|
||||
|
||||
-- ========= WEED =========
|
||||
dofile(minetest.get_modpath("farming_plus").."/weed.lua")
|
@ -1,89 +0,0 @@
|
||||
minetest.register_craftitem("farming_plus:orange_seed", {
|
||||
description = "Orange Seeds",
|
||||
inventory_image = "farming_orange_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming_plus:orange_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:orange_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_orange_1.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:orange_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_orange_2.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:orange_3", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_orange_3.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:orange", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_orange_4.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming_plus:orange_seed'} },
|
||||
{ items = {'farming_plus:orange_seed'}, rarity = 2},
|
||||
{ items = {'farming_plus:orange_seed'}, rarity = 5},
|
||||
{ items = {'farming_plus:orange_item'} },
|
||||
{ items = {'farming_plus:orange_item'}, rarity = 2 },
|
||||
{ items = {'farming_plus:orange_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:orange_item", {
|
||||
description = "Orange",
|
||||
inventory_image = "farming_orange.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
farming:add_plant("farming_plus:orange", {"farming_plus:orange_1", "farming_plus:orange_2", "farming_plus:orange_3"}, 50, 20)
|
@ -1,79 +0,0 @@
|
||||
minetest.register_craftitem("farming_plus:potato_seed", {
|
||||
description = "Potato Seeds",
|
||||
inventory_image = "farming_potato_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming_plus:potato_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:potato_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_potato_1.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:potato_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_potato_2.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:potato", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potato_3.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming_plus:potato_seed'} },
|
||||
{ items = {'farming_plus:potato_seed'}, rarity = 2},
|
||||
{ items = {'farming_plus:potato_seed'}, rarity = 5},
|
||||
{ items = {'farming_plus:potato_item'} },
|
||||
{ items = {'farming_plus:potato_item'}, rarity = 2 },
|
||||
{ items = {'farming_plus:potato_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:potato_item", {
|
||||
description = "Potato",
|
||||
inventory_image = "farming_potato.png",
|
||||
})
|
||||
|
||||
farming:add_plant("farming_plus:potato", {"farming_plus:potato_1", "farming_plus:potato_2"}, 50, 20)
|
||||
|
||||
minetest.register_alias("farming_plus:potatoe_item", "farming_plus:potato_item")
|
||||
minetest.register_alias("farming_plus:potatoe_seed", "farming_plus:potato_seed")
|
||||
minetest.register_alias("farming_plus:potatoe", "farming_plus:potato")
|
||||
minetest.register_alias("farming_plus:potatoe_1", "farming_plus:potato_1")
|
||||
minetest.register_alias("farming_plus:potatoe_2", "farming_plus:potato_2")
|
||||
|
@ -1,482 +0,0 @@
|
||||
minetest.register_craftitem(":farming:pumpkin_seed", {
|
||||
description = "Pumpkin Seed",
|
||||
inventory_image = "farming_pumpkin_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming:pumpkin_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:pumpkin_1", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
drop = "",
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
||||
},
|
||||
},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:pumpkin_2", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
drop = "",
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
|
||||
},
|
||||
},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:pumpkin", {
|
||||
description = "Pumpkin",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
on_punch = function(pos, node, puncher)
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "default:sword_wood" or tool == "default:sword_stone" or tool == "default:sword_steel" then
|
||||
node.name = "farming:pumpkin_face"
|
||||
minetest.env:set_node(pos, node)
|
||||
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
|
||||
if math.random(1, 5) == 1 then
|
||||
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
farming:add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20)
|
||||
|
||||
minetest.register_node(":farming:pumpkin_face", {
|
||||
description = "Pumpkin",
|
||||
paramtype2 = "facedir",
|
||||
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"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:pumpkin_face_light", {
|
||||
description = "Pumpkin",
|
||||
paramtype2 = "facedir",
|
||||
light_source = LIGHT_MAX-2,
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_light.png"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:pumpkin_face_light",
|
||||
recipe = {"farming:pumpkin_face", "default:torch"}
|
||||
})
|
||||
|
||||
-- ========= BIG PUMPKIN =========
|
||||
minetest.register_node(":farming:big_pumpkin", {
|
||||
description = "Big Pumpkin",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_pumpkin_big_side.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1, -0.5, -1, 1, 1.5, 1}
|
||||
}
|
||||
},
|
||||
groups = {choppy=1, oddly_breakable_by_hand=1, flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
for dx=-1,1 do
|
||||
for dy=0,1 do
|
||||
for dz=-1,1 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
if dx ~= 0 or dy ~= 0 or dz ~= 0 then
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.after(0.1, function(placer)
|
||||
local inv = placer:get_inventory()
|
||||
local index = placer:get_wield_index()
|
||||
inv:set_stack("main", index, ItemStack("farming:big_pumpkin"))
|
||||
end, placer)
|
||||
return
|
||||
end
|
||||
end
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
for dy=0,1 do
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=2})
|
||||
pos.x = pos.x-1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=2})
|
||||
pos.x = pos.x+1
|
||||
pos.z = pos.z-2
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=4})
|
||||
pos.x = pos.x+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=4})
|
||||
pos.z = pos.z+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=3})
|
||||
pos.z = pos.z+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=3})
|
||||
pos.z = pos.z-1
|
||||
pos.x = pos.x-2
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=1})
|
||||
pos.z = pos.z-1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=1})
|
||||
pos.z = pos.z+1
|
||||
pos.x = pos.x+1
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
minetest.env:set_node(pos, {name="farming:big_pumpkin_top"})
|
||||
end,
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
for dx=-1,1 do
|
||||
for dy=0,1 do
|
||||
for dz=-1,1 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
local name = minetest.env:get_node(pos).name
|
||||
if string.find(name, "farming:big_pumpkin") then
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:big_pumpkin_side", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_pumpkin_big_top_side.png", "farming_pumpkin_big_side.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0, 0.5, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
}
|
||||
},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
minetest.register_node(":farming:big_pumpkin_corner", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_pumpkin_big_top_corner.png", "farming_pumpkin_big_side.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0, 0, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
}
|
||||
},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:big_pumpkin_top", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
tiles = {"farming_pumpkin_big_top.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
}
|
||||
},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:big_pumpkin",
|
||||
recipe = {"bucket:bucket_water", "farming:pumpkin"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"}
|
||||
}
|
||||
})
|
||||
|
||||
-- ========= SCARECROW =========
|
||||
local box1 = {
|
||||
{-1, -8, -1, 1, 8, 1},
|
||||
}
|
||||
|
||||
local box2 = {
|
||||
{-1, -8, -1, 1, 8, 1},
|
||||
{-12, -8, -1, 12, -7, 1},
|
||||
{-5, -2, -5, 5, 8, 5}
|
||||
}
|
||||
|
||||
for j,list in ipairs(box1) do
|
||||
for i,int in ipairs(list) do
|
||||
list[i] = int/16
|
||||
end
|
||||
box1[j] = list
|
||||
end
|
||||
|
||||
for j,list in ipairs(box2) do
|
||||
for i,int in ipairs(list) do
|
||||
list[i] = int/16
|
||||
end
|
||||
box2[j] = list
|
||||
end
|
||||
|
||||
minetest.register_node(":farming:scarecrow", {
|
||||
description = "Scarecrow",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = box2
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-12/16, -1.5, -0.5, 12/16, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local node = minetest.env:get_node(pos)
|
||||
local param2 = node.param2
|
||||
pos.y = pos.y+1
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
pos.y = pos.y-1
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.after(0.1, function(placer)
|
||||
local inv = placer:get_inventory()
|
||||
local index = placer:get_wield_index()
|
||||
inv:set_stack("main", index, ItemStack("farming:scarecrow"))
|
||||
end, placer)
|
||||
return
|
||||
end
|
||||
minetest.env:set_node(pos, node)
|
||||
pos.y = pos.y-1
|
||||
node.name = "farming:scarecrow_bottom"
|
||||
minetest.env:set_node(pos, node)
|
||||
end,
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
pos.y = pos.y-1
|
||||
if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:scarecrow_bottom", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = box1
|
||||
},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:scarecrow",
|
||||
recipe = {
|
||||
{"", "farming:pumpkin_face", "",},
|
||||
{"default:stick", "default:stick", "default:stick",},
|
||||
{"", "default:stick", "",}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node(":farming:scarecrow_light", {
|
||||
description = "Scarecrow",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
light_source = LIGHT_MAX-2,
|
||||
tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front_light.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = box2
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-12/16, -1.5, -0.5, 12/16, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local node = minetest.env:get_node(pos)
|
||||
local param2 = node.param2
|
||||
pos.y = pos.y+1
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
pos.y = pos.y-1
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.after(0.1, function(placer)
|
||||
local inv = placer:get_inventory()
|
||||
local index = placer:get_wield_index()
|
||||
inv:set_stack("main", index, ItemStack("farming:scarecrow_light"))
|
||||
end, placer)
|
||||
return
|
||||
end
|
||||
minetest.env:set_node(pos, node)
|
||||
pos.y = pos.y-1
|
||||
node.name = "farming:scarecrow_bottom"
|
||||
minetest.env:set_node(pos, node)
|
||||
end,
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
pos.y = pos.y-1
|
||||
if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:scarecrow_light",
|
||||
recipe = {
|
||||
{"", "farming:pumpkin_face_light", "",},
|
||||
{"default:stick", "default:stick", "default:stick",},
|
||||
{"", "default:stick", "",}
|
||||
}
|
||||
})
|
||||
|
||||
--===============
|
||||
minetest.register_craftitem(":farming:pumpkin_bread", {
|
||||
description = "Pumpkin Bread",
|
||||
inventory_image = "farming_bread_pumpkin.png",
|
||||
stack_max = 1,
|
||||
on_use = minetest.item_eat(8)
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":farming:pumpkin_flour", {
|
||||
description = "Pumpkin Flour",
|
||||
inventory_image = "farming_cake_mix_pumpkin.png",
|
||||
})
|
||||
minetest.register_alias("farming:pumpkin_cake_mix", "farming:pumpkin_flour")
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:pumpkin_flour",
|
||||
type = "shapeless",
|
||||
recipe = {"farming:flour", "farming:pumpkin"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "farming:pumpkin_bread",
|
||||
recipe = "farming:pumpkin_flour",
|
||||
cooktime = 10
|
||||
})
|
||||
|
||||
|
||||
-- ========= FUEL =========
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin_seed",
|
||||
burntime = 1
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin",
|
||||
burntime = 5
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin_face",
|
||||
burntime = 5
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin_face_light",
|
||||
burntime = 7
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:big_pumpkin",
|
||||
burntime = 10
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:scarecrow",
|
||||
burntime = 5
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:scarecrow_light",
|
||||
burntime = 5
|
||||
})
|
@ -1,72 +0,0 @@
|
||||
minetest.register_craftitem("farming_plus:rhubarb_seed", {
|
||||
description = "Rhubarb Seeds",
|
||||
inventory_image = "farming_rhubarb_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming_plus:rhubarb_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:rhubarb_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_rhubarb_1.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:rhubarb_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_rhubarb_2.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+11/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:rhubarb", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_rhubarb_3.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming_plus:rhubarb_seed'} },
|
||||
{ items = {'farming_plus:rhubarb_seed'}, rarity = 2},
|
||||
{ items = {'farming_plus:rhubarb_seed'}, rarity = 5},
|
||||
{ items = {'farming_plus:rhubarb_item'} },
|
||||
{ items = {'farming_plus:rhubarb_item'}, rarity = 2 },
|
||||
{ items = {'farming_plus:rhubarb_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:rhubarb_item", {
|
||||
description = "Rhubarb",
|
||||
inventory_image = "farming_rhubarb.png",
|
||||
})
|
||||
|
||||
farming:add_plant("farming_plus:rhubarb", {"farming_plus:rhubarb_1", "farming_plus:rhubarb_2"}, 50, 20)
|
@ -1,89 +0,0 @@
|
||||
minetest.register_craftitem("farming_plus:strawberry_seed", {
|
||||
description = "Strawberry Seeds",
|
||||
inventory_image = "farming_strawberry_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming_plus:strawberry_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:strawberry_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_strawberry_1.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:strawberry_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_strawberry_2.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:strawberry_3", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_strawberry_3.png"},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming_plus:strawberry", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_strawberry_4.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming_plus:strawberry_seed'} },
|
||||
{ items = {'farming_plus:strawberry_seed'}, rarity = 2},
|
||||
{ items = {'farming_plus:strawberry_seed'}, rarity = 5},
|
||||
{ items = {'farming_plus:strawberry_item'} },
|
||||
{ items = {'farming_plus:strawberry_item'}, rarity = 2 },
|
||||
{ items = {'farming_plus:strawberry_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming_plus:strawberry_item", {
|
||||
description = "Strawberry",
|
||||
inventory_image = "farming_strawberry.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
farming:add_plant("farming_plus:strawberry", {"farming_plus:strawberry_1", "farming_plus:strawberry_2", "farming_plus:strawberry_3"}, 50, 20)
|
Before Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 621 B |
Before Width: | Height: | Size: 647 B |
Before Width: | Height: | Size: 511 B |
Before Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 575 B |
Before Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 453 B |
Before Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 535 B |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 504 B |
Before Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 468 B |
Before Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 540 B |
Before Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 473 B |
Before Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 632 B |
Before Width: | Height: | Size: 312 B |
Before Width: | Height: | Size: 627 B |
Before Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 530 B |
Before Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 301 B |