commit 35c5593a9f729538b9842a4fc77c783e456cd778 Author: PilzAdam Date: Mon Sep 17 17:48:37 2012 +0200 First commit diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..7f3ffa6 --- /dev/null +++ b/README.txt @@ -0,0 +1,46 @@ +===FARMING MOD for MINETEST-C55=== +by PilzAdam + +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 + + 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. diff --git a/bananas.lua b/bananas.lua new file mode 100644 index 0000000..723be55 --- /dev/null +++ b/bananas.lua @@ -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), +}) diff --git a/cactus.lua b/cactus.lua new file mode 100644 index 0000000..3723e70 --- /dev/null +++ b/cactus.lua @@ -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 +}) diff --git a/carrots.lua b/carrots.lua new file mode 100644 index 0000000..0195525 --- /dev/null +++ b/carrots.lua @@ -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) diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..80138c5 --- /dev/null +++ b/changelog.txt @@ -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 diff --git a/cocoa.lua b/cocoa.lua new file mode 100644 index 0000000..4ce0fdd --- /dev/null +++ b/cocoa.lua @@ -0,0 +1,73 @@ +minetest.register_node("farming:cocoa_sapling", { + description = "Cocoa Tree Sapling", + drawtype = "plantlike", + tiles = {"farming_cocoa_sapling.png"}, + inventory_image = "farming_cocoa_sapling.png", + wield_image = "farming_cocoa_sapling.png", + paramtype = "light", + walkable = false, + groups = {dig_immediate=3,flammable=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("farming:cocoa_leaves", { + drawtype = "allfaces_optional", + tiles = {"farming_banana_leaves.png"}, + paramtype = "light", + groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1}, + drop = { + max_items = 1, + items = { + { + items = {'farming:cocoa_sapling'}, + rarity = 20, + }, + } + }, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + nodenames = {"farming:cocoa_sapling"}, + interval = 60, + chance = 20, + action = function(pos, node) + farming:generate_tree(pos, "default:tree", "farming:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming:cocoa"]=20}) + end +}) + +minetest.register_on_generated(function(minp, maxp, blockseed) + if math.random(1, 100) > 5 then + return + end + local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z} + local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:desert_sand"}) + if pos ~= nil then + farming:generate_tree(pos, "default:tree", "farming:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming:cocoa"]=20}) + end +end) + +minetest.register_node("farming:cocoa", { + description = "Cocoa", + tiles = {"farming_cocoa.png"}, + visual_scale = 0.5, + inventory_image = "farming_cocoa.png", + wield_image = "farming_cocoa.png", + drawtype = "torchlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + groups = {fleshy=3,dig_immediate=3,flammable=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_craftitem("farming:cocoa_bean", { + description = "Cocoa Bean", + inventory_image = "farming_cocoa_bean.png", +}) + +minetest.register_craft({ + output = "farming:cocoa_bean 10", + type = "shapeless", + recipe = {"farming:cocoa"}, +}) diff --git a/cotton.lua b/cotton.lua new file mode 100644 index 0000000..3ea3390 --- /dev/null +++ b/cotton.lua @@ -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 +}) diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..0b8ebe0 --- /dev/null +++ b/depends.txt @@ -0,0 +1,3 @@ +default +bucket +wool diff --git a/hoes.lua b/hoes.lua new file mode 100644 index 0000000..33cf462 --- /dev/null +++ b/hoes.lua @@ -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"} + } +}) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..ae98822 --- /dev/null +++ b/init.lua @@ -0,0 +1,248 @@ +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 + +-- potatoe -> potatoe +minetest.register_alias("farming:potatoe_node", "farming:potatoe") +--minetest.register_alias("farming:potatoe", "farming:potatoe_item") cant do this +minetest.register_alias("farming:potatoe_straw", "farming:potatoe") +minetest.register_alias("farming:seed_potatoe", "farming:potatoe_seed") +for lvl = 1, 6, 1 do + minetest.register_entity(":farming:potatoe_lvl"..lvl, { + on_activate = function(self, staticdata) + minetest.env:set_node(self.object:getpos(), {name="farming:potatoe_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") + +-- ========= 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") + +-- ========= COCOA ========= +dofile(minetest.get_modpath("farming").."/cocoa.lua") diff --git a/oranges.lua b/oranges.lua new file mode 100644 index 0000000..cebbcfd --- /dev/null +++ b/oranges.lua @@ -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) diff --git a/papyrus.lua b/papyrus.lua new file mode 100644 index 0000000..d33e072 --- /dev/null +++ b/papyrus.lua @@ -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 +}) diff --git a/potatoes.lua b/potatoes.lua new file mode 100644 index 0000000..6b886a4 --- /dev/null +++ b/potatoes.lua @@ -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) diff --git a/pumpkin.lua b/pumpkin.lua new file mode 100644 index 0000000..73991ca --- /dev/null +++ b/pumpkin.lua @@ -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 +}) diff --git a/rhubarb.lua b/rhubarb.lua new file mode 100644 index 0000000..e9dd59b --- /dev/null +++ b/rhubarb.lua @@ -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) diff --git a/rubber.lua b/rubber.lua new file mode 100644 index 0000000..768466d --- /dev/null +++ b/rubber.lua @@ -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 +}) diff --git a/soil.lua b/soil.lua new file mode 100644 index 0000000..f800335 --- /dev/null +++ b/soil.lua @@ -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, +})]] diff --git a/strawberries.lua b/strawberries.lua new file mode 100644 index 0000000..e2b2132 --- /dev/null +++ b/strawberries.lua @@ -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) diff --git a/textures/farming_banana.png b/textures/farming_banana.png new file mode 100644 index 0000000..f775e14 Binary files /dev/null and b/textures/farming_banana.png differ diff --git a/textures/farming_banana_leaves.png b/textures/farming_banana_leaves.png new file mode 100644 index 0000000..cf8eecb Binary files /dev/null and b/textures/farming_banana_leaves.png differ diff --git a/textures/farming_banana_sapling.png b/textures/farming_banana_sapling.png new file mode 100644 index 0000000..821c64f Binary files /dev/null and b/textures/farming_banana_sapling.png differ diff --git a/textures/farming_bread.png b/textures/farming_bread.png new file mode 100644 index 0000000..6dca983 Binary files /dev/null and b/textures/farming_bread.png differ diff --git a/textures/farming_bread_pumpkin.png b/textures/farming_bread_pumpkin.png new file mode 100644 index 0000000..44db02e Binary files /dev/null and b/textures/farming_bread_pumpkin.png differ diff --git a/textures/farming_bucket_rubber.png b/textures/farming_bucket_rubber.png new file mode 100644 index 0000000..effdcac Binary files /dev/null and b/textures/farming_bucket_rubber.png differ diff --git a/textures/farming_cake_mix.png b/textures/farming_cake_mix.png new file mode 100644 index 0000000..5c4b197 Binary files /dev/null and b/textures/farming_cake_mix.png differ diff --git a/textures/farming_cake_mix_pumpkin.png b/textures/farming_cake_mix_pumpkin.png new file mode 100644 index 0000000..171e486 Binary files /dev/null and b/textures/farming_cake_mix_pumpkin.png differ diff --git a/textures/farming_carrot.png b/textures/farming_carrot.png new file mode 100644 index 0000000..5ed61ac Binary files /dev/null and b/textures/farming_carrot.png differ diff --git a/textures/farming_carrot_1.png b/textures/farming_carrot_1.png new file mode 100644 index 0000000..09cfe73 Binary files /dev/null and b/textures/farming_carrot_1.png differ diff --git a/textures/farming_carrot_2.png b/textures/farming_carrot_2.png new file mode 100644 index 0000000..cbb76ea Binary files /dev/null and b/textures/farming_carrot_2.png differ diff --git a/textures/farming_carrot_3.png b/textures/farming_carrot_3.png new file mode 100644 index 0000000..74e3dc8 Binary files /dev/null and b/textures/farming_carrot_3.png differ diff --git a/textures/farming_carrot_4.png b/textures/farming_carrot_4.png new file mode 100644 index 0000000..1c6445f Binary files /dev/null and b/textures/farming_carrot_4.png differ diff --git a/textures/farming_carrot_seed.png b/textures/farming_carrot_seed.png new file mode 100644 index 0000000..69bc450 Binary files /dev/null and b/textures/farming_carrot_seed.png differ diff --git a/textures/farming_cocoa.png b/textures/farming_cocoa.png new file mode 100644 index 0000000..bce3db6 Binary files /dev/null and b/textures/farming_cocoa.png differ diff --git a/textures/farming_cocoa_bean.png b/textures/farming_cocoa_bean.png new file mode 100644 index 0000000..4ad6b35 Binary files /dev/null and b/textures/farming_cocoa_bean.png differ diff --git a/textures/farming_cocoa_sapling.png b/textures/farming_cocoa_sapling.png new file mode 100644 index 0000000..73c588f Binary files /dev/null and b/textures/farming_cocoa_sapling.png differ diff --git a/textures/farming_cotton.png b/textures/farming_cotton.png new file mode 100644 index 0000000..8b8d367 Binary files /dev/null and b/textures/farming_cotton.png differ diff --git a/textures/farming_cotton_1.png b/textures/farming_cotton_1.png new file mode 100644 index 0000000..bc72c7e Binary files /dev/null and b/textures/farming_cotton_1.png differ diff --git a/textures/farming_cotton_2.png b/textures/farming_cotton_2.png new file mode 100644 index 0000000..70b6eef Binary files /dev/null and b/textures/farming_cotton_2.png differ diff --git a/textures/farming_cotton_seed.png b/textures/farming_cotton_seed.png new file mode 100644 index 0000000..4154062 Binary files /dev/null and b/textures/farming_cotton_seed.png differ diff --git a/textures/farming_flour.png b/textures/farming_flour.png new file mode 100644 index 0000000..7c302bf Binary files /dev/null and b/textures/farming_flour.png differ diff --git a/textures/farming_hoe_steel.png b/textures/farming_hoe_steel.png new file mode 100644 index 0000000..0d892b4 Binary files /dev/null and b/textures/farming_hoe_steel.png differ diff --git a/textures/farming_hoe_stone.png b/textures/farming_hoe_stone.png new file mode 100644 index 0000000..6b2da0b Binary files /dev/null and b/textures/farming_hoe_stone.png differ diff --git a/textures/farming_hoe_wood.png b/textures/farming_hoe_wood.png new file mode 100644 index 0000000..6b33f6e Binary files /dev/null and b/textures/farming_hoe_wood.png differ diff --git a/textures/farming_orange.png b/textures/farming_orange.png new file mode 100644 index 0000000..d9ae9e9 Binary files /dev/null and b/textures/farming_orange.png differ diff --git a/textures/farming_orange_1.png b/textures/farming_orange_1.png new file mode 100644 index 0000000..ab553c8 Binary files /dev/null and b/textures/farming_orange_1.png differ diff --git a/textures/farming_orange_2.png b/textures/farming_orange_2.png new file mode 100644 index 0000000..fb991fd Binary files /dev/null and b/textures/farming_orange_2.png differ diff --git a/textures/farming_orange_3.png b/textures/farming_orange_3.png new file mode 100644 index 0000000..af60f38 Binary files /dev/null and b/textures/farming_orange_3.png differ diff --git a/textures/farming_orange_4.png b/textures/farming_orange_4.png new file mode 100644 index 0000000..73e8715 Binary files /dev/null and b/textures/farming_orange_4.png differ diff --git a/textures/farming_orange_seed.png b/textures/farming_orange_seed.png new file mode 100644 index 0000000..3873bad Binary files /dev/null and b/textures/farming_orange_seed.png differ diff --git a/textures/farming_potatoe.png b/textures/farming_potatoe.png new file mode 100644 index 0000000..50411f8 Binary files /dev/null and b/textures/farming_potatoe.png differ diff --git a/textures/farming_potatoe_1.png b/textures/farming_potatoe_1.png new file mode 100644 index 0000000..75a36d9 Binary files /dev/null and b/textures/farming_potatoe_1.png differ diff --git a/textures/farming_potatoe_2.png b/textures/farming_potatoe_2.png new file mode 100644 index 0000000..6491d34 Binary files /dev/null and b/textures/farming_potatoe_2.png differ diff --git a/textures/farming_potatoe_3.png b/textures/farming_potatoe_3.png new file mode 100644 index 0000000..37a2c97 Binary files /dev/null and b/textures/farming_potatoe_3.png differ diff --git a/textures/farming_potatoe_seed.png b/textures/farming_potatoe_seed.png new file mode 100644 index 0000000..74e440d Binary files /dev/null and b/textures/farming_potatoe_seed.png differ diff --git a/textures/farming_pumpkin_big_side.png b/textures/farming_pumpkin_big_side.png new file mode 100644 index 0000000..2651380 Binary files /dev/null and b/textures/farming_pumpkin_big_side.png differ diff --git a/textures/farming_pumpkin_big_top.png b/textures/farming_pumpkin_big_top.png new file mode 100644 index 0000000..581accc Binary files /dev/null and b/textures/farming_pumpkin_big_top.png differ diff --git a/textures/farming_pumpkin_big_top_corner.png b/textures/farming_pumpkin_big_top_corner.png new file mode 100644 index 0000000..ab1de28 Binary files /dev/null and b/textures/farming_pumpkin_big_top_corner.png differ diff --git a/textures/farming_pumpkin_big_top_side.png b/textures/farming_pumpkin_big_top_side.png new file mode 100644 index 0000000..e2eb1a7 Binary files /dev/null and b/textures/farming_pumpkin_big_top_side.png differ diff --git a/textures/farming_pumpkin_face.png b/textures/farming_pumpkin_face.png new file mode 100644 index 0000000..90c0f8a Binary files /dev/null and b/textures/farming_pumpkin_face.png differ diff --git a/textures/farming_pumpkin_face_light.png b/textures/farming_pumpkin_face_light.png new file mode 100644 index 0000000..cef4866 Binary files /dev/null and b/textures/farming_pumpkin_face_light.png differ diff --git a/textures/farming_pumpkin_seed.png b/textures/farming_pumpkin_seed.png new file mode 100644 index 0000000..6933bc3 Binary files /dev/null and b/textures/farming_pumpkin_seed.png differ diff --git a/textures/farming_pumpkin_side.png b/textures/farming_pumpkin_side.png new file mode 100644 index 0000000..3a3f9da Binary files /dev/null and b/textures/farming_pumpkin_side.png differ diff --git a/textures/farming_pumpkin_top.png b/textures/farming_pumpkin_top.png new file mode 100644 index 0000000..edef2d9 Binary files /dev/null and b/textures/farming_pumpkin_top.png differ diff --git a/textures/farming_rhubarb.png b/textures/farming_rhubarb.png new file mode 100644 index 0000000..849f61b Binary files /dev/null and b/textures/farming_rhubarb.png differ diff --git a/textures/farming_rhubarb_1.png b/textures/farming_rhubarb_1.png new file mode 100644 index 0000000..706d8cf Binary files /dev/null and b/textures/farming_rhubarb_1.png differ diff --git a/textures/farming_rhubarb_2.png b/textures/farming_rhubarb_2.png new file mode 100644 index 0000000..2aadf5f Binary files /dev/null and b/textures/farming_rhubarb_2.png differ diff --git a/textures/farming_rhubarb_3.png b/textures/farming_rhubarb_3.png new file mode 100644 index 0000000..833f65b Binary files /dev/null and b/textures/farming_rhubarb_3.png differ diff --git a/textures/farming_rhubarb_seed.png b/textures/farming_rhubarb_seed.png new file mode 100644 index 0000000..c16527d Binary files /dev/null and b/textures/farming_rhubarb_seed.png differ diff --git a/textures/farming_rubber_sapling.png b/textures/farming_rubber_sapling.png new file mode 100644 index 0000000..e5c9f5d Binary files /dev/null and b/textures/farming_rubber_sapling.png differ diff --git a/textures/farming_rubber_tree_empty.png b/textures/farming_rubber_tree_empty.png new file mode 100755 index 0000000..1792951 Binary files /dev/null and b/textures/farming_rubber_tree_empty.png differ diff --git a/textures/farming_rubber_tree_full.png b/textures/farming_rubber_tree_full.png new file mode 100755 index 0000000..08067ef Binary files /dev/null and b/textures/farming_rubber_tree_full.png differ diff --git a/textures/farming_scarecrow_front.png b/textures/farming_scarecrow_front.png new file mode 100644 index 0000000..364738f Binary files /dev/null and b/textures/farming_scarecrow_front.png differ diff --git a/textures/farming_scarecrow_front_light.png b/textures/farming_scarecrow_front_light.png new file mode 100644 index 0000000..b4b3cf2 Binary files /dev/null and b/textures/farming_scarecrow_front_light.png differ diff --git a/textures/farming_scarecrow_side.png b/textures/farming_scarecrow_side.png new file mode 100644 index 0000000..e22e84b Binary files /dev/null and b/textures/farming_scarecrow_side.png differ diff --git a/textures/farming_scarecrow_top.png b/textures/farming_scarecrow_top.png new file mode 100644 index 0000000..3a4addc Binary files /dev/null and b/textures/farming_scarecrow_top.png differ diff --git a/textures/farming_soil.png b/textures/farming_soil.png new file mode 100644 index 0000000..eac9843 Binary files /dev/null and b/textures/farming_soil.png differ diff --git a/textures/farming_soil_wet.png b/textures/farming_soil_wet.png new file mode 100644 index 0000000..398f727 Binary files /dev/null and b/textures/farming_soil_wet.png differ diff --git a/textures/farming_soil_wet_side.png b/textures/farming_soil_wet_side.png new file mode 100755 index 0000000..dd7f9b6 Binary files /dev/null and b/textures/farming_soil_wet_side.png differ diff --git a/textures/farming_strawberry.png b/textures/farming_strawberry.png new file mode 100644 index 0000000..0a80f45 Binary files /dev/null and b/textures/farming_strawberry.png differ diff --git a/textures/farming_strawberry_1.png b/textures/farming_strawberry_1.png new file mode 100644 index 0000000..ff238f6 Binary files /dev/null and b/textures/farming_strawberry_1.png differ diff --git a/textures/farming_strawberry_2.png b/textures/farming_strawberry_2.png new file mode 100644 index 0000000..2912eb5 Binary files /dev/null and b/textures/farming_strawberry_2.png differ diff --git a/textures/farming_strawberry_3.png b/textures/farming_strawberry_3.png new file mode 100644 index 0000000..ca77389 Binary files /dev/null and b/textures/farming_strawberry_3.png differ diff --git a/textures/farming_strawberry_4.png b/textures/farming_strawberry_4.png new file mode 100644 index 0000000..12c6a49 Binary files /dev/null and b/textures/farming_strawberry_4.png differ diff --git a/textures/farming_strawberry_seed.png b/textures/farming_strawberry_seed.png new file mode 100644 index 0000000..08c958d Binary files /dev/null and b/textures/farming_strawberry_seed.png differ diff --git a/textures/farming_string.png b/textures/farming_string.png new file mode 100644 index 0000000..f417ec4 Binary files /dev/null and b/textures/farming_string.png differ diff --git a/textures/farming_tomato.png b/textures/farming_tomato.png new file mode 100644 index 0000000..b112d48 Binary files /dev/null and b/textures/farming_tomato.png differ diff --git a/textures/farming_tomato_1.png b/textures/farming_tomato_1.png new file mode 100644 index 0000000..2e7c425 Binary files /dev/null and b/textures/farming_tomato_1.png differ diff --git a/textures/farming_tomato_2.png b/textures/farming_tomato_2.png new file mode 100644 index 0000000..6f6a451 Binary files /dev/null and b/textures/farming_tomato_2.png differ diff --git a/textures/farming_tomato_3.png b/textures/farming_tomato_3.png new file mode 100644 index 0000000..e01b60b Binary files /dev/null and b/textures/farming_tomato_3.png differ diff --git a/textures/farming_tomato_4.png b/textures/farming_tomato_4.png new file mode 100644 index 0000000..e2f5db4 Binary files /dev/null and b/textures/farming_tomato_4.png differ diff --git a/textures/farming_tomato_seed.png b/textures/farming_tomato_seed.png new file mode 100644 index 0000000..dbef76e Binary files /dev/null and b/textures/farming_tomato_seed.png differ diff --git a/textures/farming_weed.png b/textures/farming_weed.png new file mode 100644 index 0000000..4667287 Binary files /dev/null and b/textures/farming_weed.png differ diff --git a/textures/farming_wheat.png b/textures/farming_wheat.png new file mode 100644 index 0000000..a508318 Binary files /dev/null and b/textures/farming_wheat.png differ diff --git a/textures/farming_wheat_1.png b/textures/farming_wheat_1.png new file mode 100644 index 0000000..007ecf3 Binary files /dev/null and b/textures/farming_wheat_1.png differ diff --git a/textures/farming_wheat_2.png b/textures/farming_wheat_2.png new file mode 100644 index 0000000..40956a7 Binary files /dev/null and b/textures/farming_wheat_2.png differ diff --git a/textures/farming_wheat_3.png b/textures/farming_wheat_3.png new file mode 100644 index 0000000..7dc89a7 Binary files /dev/null and b/textures/farming_wheat_3.png differ diff --git a/textures/farming_wheat_harvested.png b/textures/farming_wheat_harvested.png new file mode 100644 index 0000000..5abde6d Binary files /dev/null and b/textures/farming_wheat_harvested.png differ diff --git a/textures/farming_wheat_seed.png b/textures/farming_wheat_seed.png new file mode 100644 index 0000000..bf2ac77 Binary files /dev/null and b/textures/farming_wheat_seed.png differ diff --git a/tomatoes.lua b/tomatoes.lua new file mode 100644 index 0000000..2ec040a --- /dev/null +++ b/tomatoes.lua @@ -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) diff --git a/weed.lua b/weed.lua new file mode 100644 index 0000000..55ed3ae --- /dev/null +++ b/weed.lua @@ -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 +}) \ No newline at end of file diff --git a/wheat.lua b/wheat.lua new file mode 100644 index 0000000..e34675d --- /dev/null +++ b/wheat.lua @@ -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 +})