diff --git a/mods/farming/blueberry.lua b/mods/farming/blueberry.lua new file mode 100644 index 00000000..6b3422d9 --- /dev/null +++ b/mods/farming/blueberry.lua @@ -0,0 +1,93 @@ + +--= Blueberries + +minetest.register_craftitem("farming:blueberries", { + description = "Blueberries", + inventory_image = "farming_blueberries.png", + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1") + end, + on_use = minetest.item_eat(1), +}) + +-- Blueberry Muffin (Thanks to sosogirl123 for muffin image in deviantart.com) + +minetest.register_craftitem("farming:muffin_blueberry", { + description = "Blueberry Muffin", + inventory_image = "farming_blueberry_muffin.png", + on_use = minetest.item_eat(2), +}) + +minetest.register_craft({ + output = "farming:muffin_blueberry 2", + recipe = { + {"farming:blueberries", "farming:bread", "farming:blueberries"}, + } +}) + +-- Define Blueberry growth stages + +minetest.register_node("farming:blueberry_1", { + drawtype = "plantlike", + tiles = {"farming_blueberry_1.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, + groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:blueberry_2", { + drawtype = "plantlike", + tiles = {"farming_blueberry_2.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, + groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:blueberry_3", { + drawtype = "plantlike", + tiles = {"farming_blueberry_3.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, + groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +-- Last stage of Blueberry growth does not have growing=1 so abm never has to check these + +minetest.register_node("farming:blueberry_4", { + drawtype = "plantlike", + tiles = {"farming_blueberry_4.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + is_ground_content = true, + drop = { + items = { + {items = {'farming:blueberries 2'},rarity=1}, + {items = {'farming:blueberries'},rarity=2}, + {items = {'farming:blueberries'},rarity=3}, + } + }, + selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, + groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), +}) diff --git a/mods/farming/cocoa.lua b/mods/farming/cocoa.lua index 76ab058b..7ca61b3e 100644 --- a/mods/farming/cocoa.lua +++ b/mods/farming/cocoa.lua @@ -1,15 +1,7 @@ --- Re-register Jungletree (tree=2 for placement below) +-- Override default jungletree, add tree=2 for cocoa placement -minetest.register_node(":default:jungletree", { - description = "Jungle Tree", - tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, - paramtype2 = "facedir", - is_ground_content = false, - groups = {tree=2,choppy=2,oddly_breakable_by_hand=1,flammable=2}, - sounds = default.node_sound_wood_defaults(), - on_place = minetest.rotate_node -}) +minetest.override_item("default:jungletree", {groups = {tree=2,choppy=2,oddly_breakable_by_hand=1,flammable=2}}) -- Place Cocoa diff --git a/mods/farming/grass.lua b/mods/farming/grass.lua index aaf2e2a7..e3d1b6ca 100644 --- a/mods/farming/grass.lua +++ b/mods/farming/grass.lua @@ -1,87 +1,9 @@ ---= Grass -- Override default grass and have it drop Wheat Seeds -minetest.register_node(":default:grass_1", { - description = "Grass", - drawtype = "plantlike", - tiles = {"default_grass_1.png"}, - -- use a bigger inventory image - inventory_image = "default_grass_3.png", - wield_image = "default_grass_3.png", - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - is_ground_content = true, - drop = { - max_items = 1, - items = { - {items = {'farming:seed_wheat'},rarity = 5}, - {items = {'default:grass_1'}}, - } - }, - groups = {snappy=3,flammable=3,flora=1,attached_node=1}, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, - }, ---= Disabled the following random grass placement as it crashes servers when protection nearby... --- on_place = function(itemstack, placer, pointed_thing) --- -- place a random grass node --- local stack = ItemStack("default:grass_"..math.random(1,5)) --- local ret = minetest.item_place(stack, placer, pointed_thing) --- return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count())) --- end, -}) +for i=1,5 do --- Override default Jungle Grass and have it drop Cotton Seeds - -minetest.register_node(":default:junglegrass", { - description = "Jungle Grass", - drawtype = "plantlike", - visual_scale = 1.3, - tiles = {"default_junglegrass.png"}, - inventory_image = "default_junglegrass.png", - wield_image = "default_junglegrass.png", - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - is_ground_content = true, - drop = { - max_items = 1, - items = { - {items = {'farming:seed_cotton'},rarity = 8}, - {items = {'default:junglegrass'}}, - } - }, - groups = {snappy=3,flammable=2,flora=1,attached_node=1}, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, - }, -}) - --- Define rest of grass for growing - -for i=2,5 do - minetest.register_node(":default:grass_"..i, { - description = "Grass", - drawtype = "plantlike", - tiles = {"default_grass_"..i..".png"}, - inventory_image = "default_grass_"..i..".png", - wield_image = "default_grass_"..i..".png", - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - is_ground_content = true, + minetest.override_item("default:grass_"..i, { drop = { max_items = 1, items = { @@ -89,11 +11,18 @@ for i=2,5 do {items = {'default:grass_1'}}, } }, - groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1}, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, - }, }) -end \ No newline at end of file + +end + +-- Override default Jungle Grass and have it drop Cotton Seeds + +minetest.override_item("default:junglegrass", { + drop = { + max_items = 1, + items = { + {items = {'farming:seed_cotton'},rarity = 8}, + {items = {'default:junglegrass'}}, + } + }, +}) diff --git a/mods/farming/hoes.lua b/mods/farming/hoes.lua index a4783ec8..cd00f5e5 100644 --- a/mods/farming/hoes.lua +++ b/mods/farming/hoes.lua @@ -43,10 +43,7 @@ end function farming.hoe_on_use(itemstack, user, pointed_thing, uses) local pt = pointed_thing -- check if pointing at a node - if not pt then - return - end - if pt.type ~= "node" then + if not pt or pt.type ~= "node" then return end @@ -62,10 +59,8 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses) local above = minetest.get_node(p) -- return if any of the nodes is not registered - if not minetest.registered_nodes[under.name] then - return - end - if not minetest.registered_nodes[above.name] then + if not minetest.registered_nodes[under.name] + or not minetest.registered_nodes[above.name] then return end diff --git a/mods/farming/init.lua b/mods/farming/init.lua index 29776238..ba109532 100644 --- a/mods/farming/init.lua +++ b/mods/farming/init.lua @@ -1,5 +1,5 @@ --[[ - Minetest Farming Redo Mod 1.09 (19th September 2014) + Minetest Farming Redo Mod 1.10 (4th November 2014) by TenPlus1 ]] @@ -23,6 +23,7 @@ dofile(minetest.get_modpath("farming").."/sugar.lua") dofile(minetest.get_modpath("farming").."/pumpkin.lua") dofile(minetest.get_modpath("farming").."/cocoa.lua") dofile(minetest.get_modpath("farming").."/raspberry.lua") +dofile(minetest.get_modpath("farming").."/blueberry.lua") dofile(minetest.get_modpath("farming").."/rhubarb.lua") dofile(minetest.get_modpath("farming").."/donut.lua") -- sweet treat dofile(minetest.get_modpath("farming").."/mapgen.lua") diff --git a/mods/farming/license.txt b/mods/farming/license.txt new file mode 100644 index 00000000..5d30c149 --- /dev/null +++ b/mods/farming/license.txt @@ -0,0 +1,14 @@ + + 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. \ No newline at end of file diff --git a/mods/farming/mapgen.lua b/mods/farming/mapgen.lua index 8cb9ec78..c7f990b0 100644 --- a/mods/farming/mapgen.lua +++ b/mods/farming/mapgen.lua @@ -52,7 +52,7 @@ minetest.register_on_generated(function(minp, maxp, seed) -- If dirt with grass, add plant in various stages of maturity if nn == "default:dirt_with_grass" then - local type = math.random(1,10) + local type = math.random(1,11) if type == 1 and ground_y > 15 then minetest.set_node(p,{name="farming:potato_"..pr:next(3, 4)}) elseif type == 2 then @@ -73,6 +73,8 @@ minetest.register_on_generated(function(minp, maxp, seed) minetest.set_node(p,{name="farming:raspberry_4"}) elseif type == 10 and ground_y > 10 then minetest.set_node(p,{name="farming:rhubarb_3"}) + elseif type == 11 and ground_y > 5 then + minetest.set_node(p,{name="farming:blueberry_4"}) end end end diff --git a/mods/farming/melon.lua b/mods/farming/melon.lua index 11dd54b3..390b8bd3 100644 --- a/mods/farming/melon.lua +++ b/mods/farming/melon.lua @@ -136,6 +136,6 @@ minetest.register_node("farming:melon_8", { {items = {'farming:melon_slice 9'},rarity=1}, } }, - groups = {choppy=3,flammable=2,plant=1}, + groups = {snappy=3,flammable=2,plant=1}, sounds = default.node_sound_wood_defaults(), }) diff --git a/mods/farming/pumpkin.lua b/mods/farming/pumpkin.lua index 95a7e301..b7808b1a 100644 --- a/mods/farming/pumpkin.lua +++ b/mods/farming/pumpkin.lua @@ -4,7 +4,7 @@ minetest.register_node("farming:pumpkin", { description = "Pumpkin", tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"}, - groups = {choppy=3,flammable=2,plant=1}, + groups = {snappy=3,flammable=2,plant=1}, drop = { items = { {items = {'farming:pumpkin_slice 9'},rarity=1}, @@ -41,11 +41,28 @@ minetest.register_craft({ -- Jack 'O Lantern minetest.register_node("farming:jackolantern", { description = "Jack 'O Lantern", - 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"}, + tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_off.png"}, + paramtype2 = "facedir", + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + node.name = "farming:jackolantern_on" + minetest.set_node(pos, node) + end, +}) + +minetest.register_node("farming:jackolantern_on", { + description = "Jack 'O Lantern", + tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_on.png"}, light_source = 14, paramtype2 = "facedir", - groups = {choppy=3,flammable=2,plant=1}, + groups = {snappy=3,flammable=2}, sounds = default.node_sound_wood_defaults(), + drop = "farming:jackolantern", + on_punch = function(pos, node, puncher) + node.name = "farming:jackolantern" + minetest.set_node(pos, node) + end, }) minetest.register_craft({ diff --git a/mods/farming/raspberry.lua b/mods/farming/raspberry.lua index 105b17e9..48eea258 100644 --- a/mods/farming/raspberry.lua +++ b/mods/farming/raspberry.lua @@ -71,7 +71,7 @@ minetest.register_node("farming:raspberry_3", { sounds = default.node_sound_leaves_defaults(), }) --- Last stage of Carrot growth doesnnot have growing=1 so abm never has to check these +-- Last stage of Raspberry growth does not have growing=1 so abm never has to check these minetest.register_node("farming:raspberry_4", { drawtype = "plantlike", diff --git a/mods/farming/textures/farming_blueberries.png b/mods/farming/textures/farming_blueberries.png new file mode 100644 index 00000000..b0c49319 Binary files /dev/null and b/mods/farming/textures/farming_blueberries.png differ diff --git a/mods/farming/textures/farming_blueberry_1.png b/mods/farming/textures/farming_blueberry_1.png new file mode 100644 index 00000000..83832c86 Binary files /dev/null and b/mods/farming/textures/farming_blueberry_1.png differ diff --git a/mods/farming/textures/farming_blueberry_2.png b/mods/farming/textures/farming_blueberry_2.png new file mode 100644 index 00000000..308a0caf Binary files /dev/null and b/mods/farming/textures/farming_blueberry_2.png differ diff --git a/mods/farming/textures/farming_blueberry_3.png b/mods/farming/textures/farming_blueberry_3.png new file mode 100644 index 00000000..43d2ab13 Binary files /dev/null and b/mods/farming/textures/farming_blueberry_3.png differ diff --git a/mods/farming/textures/farming_blueberry_4.png b/mods/farming/textures/farming_blueberry_4.png new file mode 100644 index 00000000..75fb69a0 Binary files /dev/null and b/mods/farming/textures/farming_blueberry_4.png differ diff --git a/mods/farming/textures/farming_blueberry_muffin.png b/mods/farming/textures/farming_blueberry_muffin.png new file mode 100644 index 00000000..b1253d70 Binary files /dev/null and b/mods/farming/textures/farming_blueberry_muffin.png differ diff --git a/mods/farming/textures/farming_pumpkin_face_off.png b/mods/farming/textures/farming_pumpkin_face_off.png new file mode 100644 index 00000000..df701714 Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_face_off.png differ diff --git a/mods/farming/textures/farming_pumpkin_face.png b/mods/farming/textures/farming_pumpkin_face_on.png similarity index 100% rename from mods/farming/textures/farming_pumpkin_face.png rename to mods/farming/textures/farming_pumpkin_face_on.png