Add farming mod
48
mods/farming/README.txt
Normal file
|
@ -0,0 +1,48 @@
|
|||
===FARMING MOD for MINETEST-C55===
|
||||
by PilzAdam
|
||||
|
||||
Version 4.dev
|
||||
|
||||
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.
|
63
mods/farming/bananas.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
minetest.register_node("farming: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: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:banana_sapling'},
|
||||
rarity = 20,
|
||||
},
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:banana_sapling"},
|
||||
interval = 60,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
farming:generate_tree(pos, "default:tree", "farming:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming: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:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming:banana"]=10})
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_node("farming: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),
|
||||
})
|
22
mods/farming/cactus.lua
Normal 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
|
||||
})
|
89
mods/farming/carrots.lua
Normal file
|
@ -0,0 +1,89 @@
|
|||
minetest.register_craftitem("farming: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:carrot_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:carrot", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_4.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming:carrot_seed'} },
|
||||
{ items = {'farming:carrot_seed'}, rarity = 2},
|
||||
{ items = {'farming:carrot_seed'}, rarity = 5},
|
||||
{ items = {'farming:carrot_item'} },
|
||||
{ items = {'farming:carrot_item'}, rarity = 2 },
|
||||
{ items = {'farming:carrot_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:carrot_item", {
|
||||
description = "Carrot",
|
||||
inventory_image = "farming_carrot.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
||||
farming:add_plant("farming:carrot", {"farming:carrot_1", "farming:carrot_2", "farming:carrot_3"}, 50, 20)
|
17
mods/farming/changelog.txt
Normal 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
mods/farming/cotton.lua
Normal 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
mods/farming/depends.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
default
|
||||
bucket
|
||||
wool
|
83
mods/farming/hoes.lua
Normal 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"}
|
||||
}
|
||||
})
|
185
mods/farming/init.lua
Normal file
|
@ -0,0 +1,185 @@
|
|||
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,
|
||||
}
|
||||
|
||||
-- ========= 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")
|
||||
|
||||
-- ========= PUMPKINS =========
|
||||
dofile(minetest.get_modpath("farming").."/pumpkin.lua")
|
||||
|
||||
-- ========= RUBBER =========
|
||||
dofile(minetest.get_modpath("farming").."/rubber.lua")
|
||||
|
||||
-- ========= WEED =========
|
||||
dofile(minetest.get_modpath("farming").."/weed.lua")
|
||||
|
||||
-- ========= STRAWBERRIES =========
|
||||
dofile(minetest.get_modpath("farming").."/strawberries.lua")
|
||||
|
||||
-- ========= RHUBARB =========
|
||||
dofile(minetest.get_modpath("farming").."/rhubarb.lua")
|
||||
|
||||
-- ========= POTATOES =========
|
||||
dofile(minetest.get_modpath("farming").."/potatoes.lua")
|
||||
|
||||
-- ========= TOMATOES =========
|
||||
dofile(minetest.get_modpath("farming").."/tomatoes.lua")
|
||||
|
||||
-- ========= ORANGES =========
|
||||
dofile(minetest.get_modpath("farming").."/oranges.lua")
|
||||
|
||||
-- ========= BANANAS =========
|
||||
dofile(minetest.get_modpath("farming").."/bananas.lua")
|
||||
|
||||
-- ========= PAPYRUS =========
|
||||
dofile(minetest.get_modpath("farming").."/papyrus.lua")
|
||||
|
||||
-- ========= CACTUS =========
|
||||
dofile(minetest.get_modpath("farming").."/cactus.lua")
|
||||
|
||||
-- ========= CARROTS =========
|
||||
dofile(minetest.get_modpath("farming").."/carrots.lua")
|
89
mods/farming/oranges.lua
Normal file
|
@ -0,0 +1,89 @@
|
|||
minetest.register_craftitem("farming: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:orange_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:orange", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_orange_4.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming:orange_seed'} },
|
||||
{ items = {'farming:orange_seed'}, rarity = 2},
|
||||
{ items = {'farming:orange_seed'}, rarity = 5},
|
||||
{ items = {'farming:orange_item'} },
|
||||
{ items = {'farming:orange_item'}, rarity = 2 },
|
||||
{ items = {'farming:orange_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:orange_item", {
|
||||
description = "Orange",
|
||||
inventory_image = "farming_orange.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
farming:add_plant("farming:orange", {"farming:orange_1", "farming:orange_2", "farming:orange_3"}, 50, 20)
|
25
mods/farming/papyrus.lua
Normal 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
|
||||
})
|
72
mods/farming/potatoes.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
minetest.register_craftitem("farming:potatoe_seed", {
|
||||
description = "Potatoe Seeds",
|
||||
inventory_image = "farming_potatoe_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:potatoe_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming:potatoe_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_potatoe_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:potatoe_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_potatoe_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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:potatoe", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potatoe_3.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming:potatoe_seed'} },
|
||||
{ items = {'farming:potatoe_seed'}, rarity = 2},
|
||||
{ items = {'farming:potatoe_seed'}, rarity = 5},
|
||||
{ items = {'farming:potatoe_item'} },
|
||||
{ items = {'farming:potatoe_item'}, rarity = 2 },
|
||||
{ items = {'farming:potatoe_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:potatoe_item", {
|
||||
description = "Potatoe",
|
||||
inventory_image = "farming_potatoe.png",
|
||||
})
|
||||
|
||||
farming:add_plant("farming:potatoe", {"farming:potatoe_1", "farming:potatoe_2"}, 50, 20)
|
446
mods/farming/pumpkin.lua
Normal 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
|
||||
})
|
72
mods/farming/rhubarb.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
minetest.register_craftitem("farming: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:rhubarb_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:rhubarb", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_rhubarb_3.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming:rhubarb_seed'} },
|
||||
{ items = {'farming:rhubarb_seed'}, rarity = 2},
|
||||
{ items = {'farming:rhubarb_seed'}, rarity = 5},
|
||||
{ items = {'farming:rhubarb_item'} },
|
||||
{ items = {'farming:rhubarb_item'}, rarity = 2 },
|
||||
{ items = {'farming:rhubarb_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:rhubarb_item", {
|
||||
description = "Rhubarb",
|
||||
inventory_image = "farming_rhubarb.png",
|
||||
})
|
||||
|
||||
farming:add_plant("farming:rhubarb", {"farming:rhubarb_1", "farming:rhubarb_2"}, 50, 20)
|
104
mods/farming/rubber.lua
Normal file
|
@ -0,0 +1,104 @@
|
|||
minetest.register_node("farming:rubber_sapling", {
|
||||
description = "Rubber Tree Sapling",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_rubber_sapling.png"},
|
||||
inventory_image = "farming_rubber_sapling.png",
|
||||
wield_image = "farming_rubber_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {dig_immediate=3,flammable=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:rubber_tree_full", {
|
||||
description = "Rubber Tree",
|
||||
tiles = {"default_tree_top.png", "default_tree_top.png", "farming_rubber_tree_full.png"},
|
||||
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
drop = "default:tree",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
on_dig = function(pos, node, digger)
|
||||
minetest.node_dig(pos, node, digger)
|
||||
minetest.env:remove_node(pos)
|
||||
end,
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
oldnode.name = "farming:rubber_tree_empty"
|
||||
minetest.env:set_node(pos, oldnode)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("farming:rubber_tree_empty", {
|
||||
tiles = {"default_tree_top.png", "default_tree_top.png", "farming_rubber_tree_empty.png"},
|
||||
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2, not_in_creative_inventory=1},
|
||||
drop = "default:tree",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:rubber_tree_empty"},
|
||||
interval = 60,
|
||||
chance = 15,
|
||||
action = function(pos, node)
|
||||
node.name = "farming:rubber_tree_full"
|
||||
minetest.env:set_node(pos, node)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming:rubber_leaves", {
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_leaves.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {'farming:rubber_sapling'},
|
||||
rarity = 20,
|
||||
},
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:rubber_sapling"},
|
||||
interval = 60,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
farming:generate_tree(pos, "farming:rubber_tree_full", "farming:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})
|
||||
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}, "farming:rubber_tree_full", "farming:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_craftitem("farming:bucket_rubber", {
|
||||
description = "Bucket with Caoutchouc",
|
||||
inventory_image = "farming_bucket_rubber.png",
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
local bucket_tmp = {
|
||||
source = "farming:rubber_tree_full",
|
||||
itemname = "farming:bucket_rubber"
|
||||
}
|
||||
bucket.liquids["farming:rubber_tree_full"] = bucket_tmp
|
||||
|
||||
-- ========= FUEL =========
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:rubber_sapling",
|
||||
burntime = 10
|
||||
})
|
45
mods/farming/soil.lua
Normal 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,
|
||||
})]]
|
89
mods/farming/strawberries.lua
Normal file
|
@ -0,0 +1,89 @@
|
|||
minetest.register_craftitem("farming: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:strawberry_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming: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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:strawberry", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_strawberry_4.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming:strawberry_seed'} },
|
||||
{ items = {'farming:strawberry_seed'}, rarity = 2},
|
||||
{ items = {'farming:strawberry_seed'}, rarity = 5},
|
||||
{ items = {'farming:strawberry_item'} },
|
||||
{ items = {'farming:strawberry_item'}, rarity = 2 },
|
||||
{ items = {'farming:strawberry_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:strawberry_item", {
|
||||
description = "Strawberry",
|
||||
inventory_image = "farming_strawberry.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
farming:add_plant("farming:strawberry", {"farming:strawberry_1", "farming:strawberry_2", "farming:strawberry_3"}, 50, 20)
|
BIN
mods/farming/textures/farming_banana.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
mods/farming/textures/farming_banana_leaves.png
Normal file
After Width: | Height: | Size: 621 B |
BIN
mods/farming/textures/farming_banana_sapling.png
Normal file
After Width: | Height: | Size: 647 B |
BIN
mods/farming/textures/farming_bread.png
Normal file
After Width: | Height: | Size: 918 B |
BIN
mods/farming/textures/farming_bread_pumpkin.png
Normal file
After Width: | Height: | Size: 511 B |
BIN
mods/farming/textures/farming_bucket_rubber.png
Normal file
After Width: | Height: | Size: 317 B |
BIN
mods/farming/textures/farming_cake_mix.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
mods/farming/textures/farming_cake_mix_pumpkin.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
mods/farming/textures/farming_carrot.png
Normal file
After Width: | Height: | Size: 575 B |
BIN
mods/farming/textures/farming_carrot_1.png
Normal file
After Width: | Height: | Size: 438 B |
BIN
mods/farming/textures/farming_carrot_2.png
Normal file
After Width: | Height: | Size: 453 B |
BIN
mods/farming/textures/farming_carrot_3.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
mods/farming/textures/farming_carrot_4.png
Normal file
After Width: | Height: | Size: 550 B |
BIN
mods/farming/textures/farming_carrot_seed.png
Normal file
After Width: | Height: | Size: 476 B |
BIN
mods/farming/textures/farming_cotton.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
mods/farming/textures/farming_cotton_1.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
mods/farming/textures/farming_cotton_2.png
Normal file
After Width: | Height: | Size: 351 B |
BIN
mods/farming/textures/farming_cotton_seed.png
Normal file
After Width: | Height: | Size: 280 B |
BIN
mods/farming/textures/farming_flour.png
Normal file
After Width: | Height: | Size: 344 B |
BIN
mods/farming/textures/farming_hoe_steel.png
Normal file
After Width: | Height: | Size: 338 B |
BIN
mods/farming/textures/farming_hoe_stone.png
Normal file
After Width: | Height: | Size: 333 B |
BIN
mods/farming/textures/farming_hoe_wood.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
mods/farming/textures/farming_orange.png
Normal file
After Width: | Height: | Size: 504 B |
BIN
mods/farming/textures/farming_orange_1.png
Normal file
After Width: | Height: | Size: 430 B |
BIN
mods/farming/textures/farming_orange_2.png
Normal file
After Width: | Height: | Size: 468 B |
BIN
mods/farming/textures/farming_orange_3.png
Normal file
After Width: | Height: | Size: 544 B |
BIN
mods/farming/textures/farming_orange_4.png
Normal file
After Width: | Height: | Size: 540 B |
BIN
mods/farming/textures/farming_orange_seed.png
Normal file
After Width: | Height: | Size: 281 B |
BIN
mods/farming/textures/farming_potatoe.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
mods/farming/textures/farming_potatoe_1.png
Normal file
After Width: | Height: | Size: 473 B |
BIN
mods/farming/textures/farming_potatoe_2.png
Normal file
After Width: | Height: | Size: 502 B |
BIN
mods/farming/textures/farming_potatoe_3.png
Normal file
After Width: | Height: | Size: 292 B |
BIN
mods/farming/textures/farming_potatoe_seed.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
mods/farming/textures/farming_pumpkin_big_side.png
Normal file
After Width: | Height: | Size: 600 B |
BIN
mods/farming/textures/farming_pumpkin_big_top.png
Normal file
After Width: | Height: | Size: 600 B |
BIN
mods/farming/textures/farming_pumpkin_big_top_corner.png
Normal file
After Width: | Height: | Size: 289 B |
BIN
mods/farming/textures/farming_pumpkin_big_top_side.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
mods/farming/textures/farming_pumpkin_face.png
Normal file
After Width: | Height: | Size: 622 B |
BIN
mods/farming/textures/farming_pumpkin_face_light.png
Normal file
After Width: | Height: | Size: 632 B |
BIN
mods/farming/textures/farming_pumpkin_seed.png
Normal file
After Width: | Height: | Size: 312 B |
BIN
mods/farming/textures/farming_pumpkin_side.png
Normal file
After Width: | Height: | Size: 627 B |
BIN
mods/farming/textures/farming_pumpkin_top.png
Normal file
After Width: | Height: | Size: 623 B |
BIN
mods/farming/textures/farming_rhubarb.png
Normal file
After Width: | Height: | Size: 502 B |
BIN
mods/farming/textures/farming_rhubarb_1.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
mods/farming/textures/farming_rhubarb_2.png
Normal file
After Width: | Height: | Size: 365 B |
BIN
mods/farming/textures/farming_rhubarb_3.png
Normal file
After Width: | Height: | Size: 301 B |
BIN
mods/farming/textures/farming_rhubarb_seed.png
Normal file
After Width: | Height: | Size: 219 B |
BIN
mods/farming/textures/farming_rubber_sapling.png
Normal file
After Width: | Height: | Size: 333 B |
BIN
mods/farming/textures/farming_rubber_tree_empty.png
Executable file
After Width: | Height: | Size: 835 B |
BIN
mods/farming/textures/farming_rubber_tree_full.png
Executable file
After Width: | Height: | Size: 808 B |
BIN
mods/farming/textures/farming_scarecrow_front.png
Normal file
After Width: | Height: | Size: 634 B |
BIN
mods/farming/textures/farming_scarecrow_front_light.png
Normal file
After Width: | Height: | Size: 641 B |
BIN
mods/farming/textures/farming_scarecrow_side.png
Normal file
After Width: | Height: | Size: 613 B |
BIN
mods/farming/textures/farming_scarecrow_top.png
Normal file
After Width: | Height: | Size: 639 B |
BIN
mods/farming/textures/farming_soil.png
Normal file
After Width: | Height: | Size: 947 B |
BIN
mods/farming/textures/farming_soil_wet.png
Normal file
After Width: | Height: | Size: 880 B |
BIN
mods/farming/textures/farming_soil_wet_side.png
Executable file
After Width: | Height: | Size: 867 B |
BIN
mods/farming/textures/farming_strawberry.png
Normal file
After Width: | Height: | Size: 250 B |
BIN
mods/farming/textures/farming_strawberry_1.png
Normal file
After Width: | Height: | Size: 356 B |
BIN
mods/farming/textures/farming_strawberry_2.png
Normal file
After Width: | Height: | Size: 342 B |
BIN
mods/farming/textures/farming_strawberry_3.png
Normal file
After Width: | Height: | Size: 357 B |
BIN
mods/farming/textures/farming_strawberry_4.png
Normal file
After Width: | Height: | Size: 400 B |
BIN
mods/farming/textures/farming_strawberry_seed.png
Normal file
After Width: | Height: | Size: 212 B |
BIN
mods/farming/textures/farming_string.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
mods/farming/textures/farming_tomato.png
Normal file
After Width: | Height: | Size: 581 B |
BIN
mods/farming/textures/farming_tomato_1.png
Normal file
After Width: | Height: | Size: 482 B |
BIN
mods/farming/textures/farming_tomato_2.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
mods/farming/textures/farming_tomato_3.png
Normal file
After Width: | Height: | Size: 578 B |
BIN
mods/farming/textures/farming_tomato_4.png
Normal file
After Width: | Height: | Size: 591 B |
BIN
mods/farming/textures/farming_tomato_seed.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
mods/farming/textures/farming_weed.png
Normal file
After Width: | Height: | Size: 591 B |
BIN
mods/farming/textures/farming_wheat.png
Normal file
After Width: | Height: | Size: 536 B |
BIN
mods/farming/textures/farming_wheat_1.png
Normal file
After Width: | Height: | Size: 540 B |
BIN
mods/farming/textures/farming_wheat_2.png
Normal file
After Width: | Height: | Size: 534 B |
BIN
mods/farming/textures/farming_wheat_3.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
mods/farming/textures/farming_wheat_harvested.png
Normal file
After Width: | Height: | Size: 597 B |
BIN
mods/farming/textures/farming_wheat_seed.png
Normal file
After Width: | Height: | Size: 286 B |
89
mods/farming/tomatoes.lua
Normal file
|
@ -0,0 +1,89 @@
|
|||
minetest.register_craftitem("farming:tomato_seed", {
|
||||
description = "Tomato Seeds",
|
||||
inventory_image = "farming_tomato_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:tomato_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming:tomato_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_tomato_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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:tomato_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_tomato_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},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farming:tomato_3", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "",
|
||||
tiles = {"farming_tomato_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:tomato", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_4.png"},
|
||||
drop = {
|
||||
max_items = 6,
|
||||
items = {
|
||||
{ items = {'farming:tomato_seed'} },
|
||||
{ items = {'farming:tomato_seed'}, rarity = 2},
|
||||
{ items = {'farming:tomato_seed'}, rarity = 5},
|
||||
{ items = {'farming:tomato_item'} },
|
||||
{ items = {'farming:tomato_item'}, rarity = 2 },
|
||||
{ items = {'farming:tomato_item'}, rarity = 5 }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:tomato_item", {
|
||||
description = "Tomato",
|
||||
inventory_image = "farming_tomato.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
farming:add_plant("farming:tomato", {"farming:tomato_1", "farming:tomato_2", "farming:tomato_3"}, 50, 20)
|
39
mods/farming/weed.lua
Normal 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
mods/farming/wheat.lua
Normal 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
|
||||
})
|