The old light version is now the main version

master
PilzAdam 2012-09-17 17:45:45 +02:00
commit a84a2cdc58
49 changed files with 1192 additions and 0 deletions

48
README.txt Normal file
View File

@ -0,0 +1,48 @@
===FARMING MOD for MINETEST-C55===
by PilzAdam
Light version
Introduction:
This mod adds farming to Minetest.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
Craft a wood/stone/steel hoe:
material material
stick
stick
Dig dirt with it and turn it to soil. Water the soil and plant the seeds
you get by digging dirt with the hoe. Wait until the seeds are seasoned
and harvest them. When harvesting you will get the product and new seeds.
For further information or help see:
http://minetest.net/forum/viewtopic.php?id=2787
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.

22
cactus.lua Normal file
View File

@ -0,0 +1,22 @@
minetest.register_abm({
nodenames = {"default:cactus"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.env:get_node(pos).name
if name == "default:desert_sand" or name == "default:sand" then
pos.y = pos.y+1
local height = 0
while minetest.env:get_node(pos).name == "default:cactus" do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.env:get_node(pos).name == "air" then
minetest.env:set_node(pos, node)
end
end
end
end
})

17
changelog.txt Normal file
View File

@ -0,0 +1,17 @@
Version 3:
- make pumpkins with face not craftable but created by punching with a sword
- change groups of pumpkins to more wood like
- add big pumpkin
- add scarecrow
- make bread non stackable
- make saplings plantable everywhere (they still grow only with light and wet soil)
- add weed
- add fuel attributes to nearly everything
- add pumpkin bread
Version 2:
- soil dont turn to dirt when walking over it
- fix hoe bug
- rename corn to wheat
- new textures for harvested wheat
- make cotton drop strings when harvested
- add rubber

90
cotton.lua Normal file
View File

@ -0,0 +1,90 @@
minetest.register_craftitem("farming:cotton_seed", {
description = "Cotton Seeds",
inventory_image = "farming_cotton_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:cotton_1"
minetest.env:set_node(pointed_thing.above, above)
itemstack:take_item(1)
return itemstack
end
end
})
minetest.register_node("farming:cotton_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_cotton_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},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:cotton_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_cotton_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},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:cotton", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_cotton.png"},
drop = {
max_items = 6,
items = {
{ items = {'farming:cotton_seed'} },
{ items = {'farming:cotton_seed'}, rarity = 2},
{ items = {'farming:cotton_seed'}, rarity = 5},
{ items = {'farming:string'} },
{ items = {'farming:string'}, rarity = 2 },
{ items = {'farming:string'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
})
farming:add_plant("farming:cotton", {"farming:cotton_1", "farming:cotton_2"}, 50, 20)
minetest.register_craftitem("farming:string", {
description = "String",
inventory_image = "farming_string.png",
})
minetest.register_craft({
output = "wool:white",
recipe = {{"farming:string"}}
})
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "farming:cotton_seed",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:string",
burntime = 1
})

3
depends.txt Normal file
View File

@ -0,0 +1,3 @@
default
bucket
wool

83
hoes.lua Normal file
View File

@ -0,0 +1,83 @@
local function create_soil(pos, inv, p)
if pos == nil then
return false
end
local node = minetest.env:get_node(pos)
local name = node.name
local above = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z})
if name == "default:dirt" or name == "default:dirt_with_grass" then
if above.name == "air" then
node.name = "farming:soil"
minetest.env:set_node(pos, node)
if inv and p and name == "default:dirt_with_grass" then
for name,rarity in pairs(farming.seeds) do
if math.random(1, rarity-p) == 1 then
inv:add_item("main", ItemStack(name))
end
end
end
return true
end
end
return false
end
minetest.register_tool("farming:hoe_wood", {
description = "Wood Hoe",
inventory_image = "farming_hoe_wood.png",
on_use = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory(), 0) then
itemstack:add_wear(65535/30)
return itemstack
end
end
})
minetest.register_craft({
output = "farming:hoe_wood",
recipe = {
{"default:wood", "default:wood"},
{"", "default:stick"},
{"", "default:stick"}
}
})
minetest.register_tool("farming:hoe_stone", {
description = "Stone Hoe",
inventory_image = "farming_hoe_stone.png",
on_use = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory(), 5) then
itemstack:add_wear(65535/50)
return itemstack
end
end
})
minetest.register_craft({
output = "farming:hoe_stone",
recipe = {
{"default:cobble", "default:cobble"},
{"", "default:stick"},
{"", "default:stick"}
}
})
minetest.register_tool("farming:hoe_steel", {
description = "Steel Hoe",
inventory_image = "farming_hoe_steel.png",
on_use = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory(), 10) then
itemstack:add_wear(65535/80)
return itemstack
end
end
})
minetest.register_craft({
output = "farming:hoe_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"", "default:stick"},
{"", "default:stick"}
}
})

205
init.lua Normal file
View File

@ -0,0 +1,205 @@
farming = {}
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 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
} )
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 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:wheat_seed"]=20,
["farming:cotton_seed"]=30,
["farming:pumpkin_seed"]=60,
["farming:strawberry_seed"]=30,
["farming:rhubarb_seed"]=30,
["farming:potatoe_seed"]=30,
["farming:tomato_seed"]=30,
["farming:orange_seed"]=30,
["farming:carrot_seed"]=30,
}
-- ========= ALIASES FOR FARMING MOD BY SAPIER =========
-- hoes
minetest.register_alias("farming:wood_hoe", "farming:hoe_wood")
minetest.register_alias("farming:cobble_hoe", "farming:hoe_stone")
minetest.register_alias("farming:steel_hoe", "farming:hoe_steel")
minetest.register_alias("farming:mese_hoe", "farming:hoe_steel")
-- wheat -> wheat
minetest.register_alias("farming:wheat_node", "farming:wheat")
--minetest.register_alias("farming:wheat", "farming_wheat_harvested") cant do this
minetest.register_alias("farming:wheat_straw", "farming:wheat")
minetest.register_alias("farming:seed_wheat", "farming:wheat_seed")
for lvl = 1, 6, 1 do
minetest.register_entity(":farming:wheat_lvl"..lvl, {
on_activate = function(self, staticdata)
minetest.env:set_node(self.object:getpos(), {name="farming:wheat_1"})
end
})
end
-- rye -> wheat
minetest.register_alias("farming:rhy_node", "farming:wheat")
minetest.register_alias("farming:rhy", "farming:wheat_harvested")
minetest.register_alias("farming:rhy_straw", "farming:wheat")
minetest.register_alias("farming:seed_rhy", "farming:wheat_seed")
for lvl = 1, 6, 1 do
minetest.register_entity(":farming:rhy_lvl"..lvl, {
on_activate = function(self, staticdata)
minetest.env:set_node(self.object:getpos(), {name="farming:wheat_1"})
end
})
end
-- corn -> wheat
minetest.register_alias("farming:corn_node", "farming:wheat")
minetest.register_alias("farming:corn", "farming:wheat_harvested")
minetest.register_alias("farming:corn_straw", "farming:wheat")
minetest.register_alias("farming:seed_corn", "farming:wheat_seed")
for lvl = 1, 6, 1 do
minetest.register_entity(":farming:corn_lvl"..lvl, {
on_activate = function(self, staticdata)
minetest.env:set_node(self.object:getpos(), {name="farming:wheat_1"})
end
})
end
-- ========= SOIL =========
dofile(minetest.get_modpath("farming").."/soil.lua")
-- ========= HOES =========
dofile(minetest.get_modpath("farming").."/hoes.lua")
-- ========= CORN =========
dofile(minetest.get_modpath("farming").."/wheat.lua")
-- ========= COTTON =========
dofile(minetest.get_modpath("farming").."/cotton.lua")
-- ========= WEED =========
dofile(minetest.get_modpath("farming").."/weed.lua")
-- ========= PAPYRUS =========
dofile(minetest.get_modpath("farming").."/papyrus.lua")
-- ========= CACTUS =========
dofile(minetest.get_modpath("farming").."/cactus.lua")

25
papyrus.lua Normal file
View File

@ -0,0 +1,25 @@
minetest.register_abm({
nodenames = {"default:papyrus"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.env:get_node(pos).name
if name == "default:dirt" or name == "default:dirt_with_grass" then
if minetest.env:find_node_near(pos, 3, {"default:water_source", "default:water_flowing"}) == nil then
return
end
pos.y = pos.y+1
local height = 0
while minetest.env:get_node(pos).name == "default:papyrus" do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.env:get_node(pos).name == "air" then
minetest.env:set_node(pos, node)
end
end
end
end
})

446
pumpkin.lua Normal file
View File

@ -0,0 +1,446 @@
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",
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},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("farming:pumpkin_2", {
paramtype = "light",
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},
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},
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},
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",
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",
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",
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",
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",
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",
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", "",}
}
})
-- ========= 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
})

45
soil.lua Normal file
View File

@ -0,0 +1,45 @@
minetest.register_node("farming:soil", {
tiles = {"farming_soil.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
drop = "default:dirt",
groups = {crumbly=3, not_in_creative_inventory=1},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
})
minetest.register_node("farming:soil_wet", {
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png"},
drop = "default:dirt",
groups = {crumbly=3, not_in_creative_inventory=1},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
})
minetest.register_abm({
nodenames = {"farming:soil"},
interval = 15,
chance = 3,
action = function(pos, node)
if minetest.env:find_node_near(pos, 4, {"default:water_source", "default:water_flowing"}) then
node.name = "farming:soil_wet"
minetest.env:set_node(pos, node)
end
end,
})
-- ========= EXPERIMENTAL =========
-- This will turn soil to dirt when walking over it
--[[minetest.register_abm({
nodenames = {"farming:soil", "farming:soil_wet"},
interval = 2,
chance = 2,
action = function(pos, node)
pos.y = pos.y+1
if #(minetest.env:get_objects_inside_radius(pos, 0.8)) > 0 then
pos.y = pos.y-1
node.name = "default:dirt"
minetest.env:set_node(pos, node)
end
end,
})]]

BIN
textures/farming_bread.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

BIN
textures/farming_cotton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

BIN
textures/farming_flour.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

BIN
textures/farming_soil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

BIN
textures/farming_string.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

BIN
textures/farming_weed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

BIN
textures/farming_wheat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

39
weed.lua Normal file
View File

@ -0,0 +1,39 @@
minetest.register_node("farming:weed", {
description = "Weed",
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_weed.png"},
inventory_image = "farming_weed.png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5}
},
},
groups = {snappy=3, flammable=2},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_abm({
nodenames = {"farming:soil_wet", "farming:soil"},
interval = 50,
chance = 10,
action = function(pos, node)
if minetest.env:find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then
return
end
pos.y = pos.y+1
if minetest.env:get_node(pos).name == "air" then
node.name = "farming:weed"
minetest.env:set_node(pos, node)
end
end
})
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "farming:weed",
burntime = 1
})

169
wheat.lua Normal file
View File

@ -0,0 +1,169 @@
minetest.register_craftitem("farming:wheat_seed", {
description = "Wheat Seeds",
inventory_image = "farming_wheat_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:wheat_1"
minetest.env:set_node(pointed_thing.above, above)
itemstack:take_item(1)
return itemstack
end
end
})
minetest.register_node("farming:wheat_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_wheat_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:wheat_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_wheat_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+7/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:wheat_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_wheat_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+13/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:wheat", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_wheat.png"},
drop = {
max_items = 4,
items = {
{ items = {'farming:wheat_seed'} },
{ items = {'farming:wheat_seed'}, rarity = 2},
{ items = {'farming:wheat_seed'}, rarity = 5},
{ items = {'farming:wheat_harvested'} }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
})
farming:add_plant("farming:wheat", {"farming:wheat_1", "farming:wheat_2", "farming:wheat_3"}, 50, 20)
minetest.register_craftitem("farming:wheat_harvested", {
description = "Harvested Wheat",
inventory_image = "farming_wheat_harvested.png",
})
minetest.register_craft({
output = "farming:flour",
recipe = {
{"farming:wheat_harvested", }
}
})
minetest.register_craftitem("farming:flour", {
description = "Flour",
inventory_image = "farming_flour.png",
})
minetest.register_craft({
output = "farming:cake_mix",
type = "shapeless",
recipe = {"farming:flour", "farming:flour", "farming:flour", "farming:flour", "bucket:bucket_water"},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
})
minetest.register_craftitem("farming:cake_mix", {
description = "Cake Mix",
inventory_image = "farming_cake_mix.png",
})
minetest.register_craft({
type = "cooking",
output = "farming:bread",
recipe = "farming:cake_mix",
cooktime = 10
})
minetest.register_craftitem("farming:bread", {
description = "Bread",
inventory_image = "farming_bread.png",
stack_max = 1,
on_use = minetest.item_eat(10)
})
minetest.register_craftitem("farming:pumpkin_bread", {
description = "Pumpkin Bread",
inventory_image = "farming_bread_pumpkin.png",
stack_max = 1,
on_use = minetest.item_eat(20)
})
minetest.register_craftitem("farming:pumpkin_cake_mix", {
description = "Pumpkin Cake Mix",
inventory_image = "farming_cake_mix_pumpkin.png",
})
minetest.register_craft({
output = "farming:pumpkin_cake_mix",
type = "shapeless",
recipe = {"farming:cake_mix", "farming:pumpkin"}
})
minetest.register_craft({
type = "cooking",
output = "farming:pumpkin_bread",
recipe = "farming:pumpkin_cake_mix",
cooktime = 10
})
minetest.register_alias("farming:corn_seed", "farming:wheat_seed")
minetest.register_alias("farming:corn_1", "farming:wheat_1")
minetest.register_alias("farming:corn_2", "farming:wheat_2")
minetest.register_alias("farming:corn_3", "farming:wheat_3")
minetest.register_alias("farming:corn", "farming:wheat")
minetest.register_alias("farming:corn_harvested", "farming:wheat_harvested")
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "farming:wheat_seed",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:wheat_harvested",
burntime = 2
})