From c2a3d29e9eef84c38188b903b8aeeb30aa92386c Mon Sep 17 00:00:00 2001 From: Ombridride Date: Thu, 13 Nov 2014 23:31:49 +0100 Subject: [PATCH] update Farming, keep our tweaks --- mods/farming/blueberry.lua | 93 ++++++++++++++++ mods/farming/cocoa.lua | 12 +- mods/farming/grass.lua | 103 +++--------------- mods/farming/hoes.lua | 11 +- mods/farming/init.lua | 3 +- mods/farming/license.txt | 14 +++ mods/farming/mapgen.lua | 4 +- mods/farming/melon.lua | 2 +- mods/farming/pumpkin.lua | 23 +++- mods/farming/raspberry.lua | 2 +- mods/farming/textures/farming_blueberries.png | Bin 0 -> 164 bytes mods/farming/textures/farming_blueberry_1.png | Bin 0 -> 114 bytes mods/farming/textures/farming_blueberry_2.png | Bin 0 -> 223 bytes mods/farming/textures/farming_blueberry_3.png | Bin 0 -> 231 bytes mods/farming/textures/farming_blueberry_4.png | Bin 0 -> 317 bytes .../textures/farming_blueberry_muffin.png | Bin 0 -> 236 bytes .../textures/farming_pumpkin_face_off.png | Bin 0 -> 259 bytes ...n_face.png => farming_pumpkin_face_on.png} | Bin 18 files changed, 155 insertions(+), 112 deletions(-) create mode 100644 mods/farming/blueberry.lua create mode 100644 mods/farming/license.txt create mode 100644 mods/farming/textures/farming_blueberries.png create mode 100644 mods/farming/textures/farming_blueberry_1.png create mode 100644 mods/farming/textures/farming_blueberry_2.png create mode 100644 mods/farming/textures/farming_blueberry_3.png create mode 100644 mods/farming/textures/farming_blueberry_4.png create mode 100644 mods/farming/textures/farming_blueberry_muffin.png create mode 100644 mods/farming/textures/farming_pumpkin_face_off.png rename mods/farming/textures/{farming_pumpkin_face.png => farming_pumpkin_face_on.png} (100%) 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 0000000000000000000000000000000000000000..b0c493195c4b46e5196221e5f0c49b7cf16adbe7 GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa4)6(aRRD?FGDuXi$VD)y%x2Nu z%@EKjnzcu)@s{-NqaT5?j3q&S!3+-1ZlnP@=AJH&Asp9}6ArM=;90=a@1mh>BdEnV zmC3VVrUK^%Edl=7S_bwuf;x{FmmEk^Xnkl9TX4I9fuU*%*L>$Uk3)b)FnGH9xvX$ZR|6JHC@W!tw1D8g70 zk;uyklJvl*vMMOe^MMi?9N`j})P-6!J10MrZdH|!oHc%CVr>mdK II;Vst03L!ESpWb4 literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_blueberry_2.png b/mods/farming/textures/farming_blueberry_2.png new file mode 100644 index 0000000000000000000000000000000000000000..308a0caf006a7d617319c7cc98453d7a36d8e55b GIT binary patch literal 223 zcmV<503iQ~P)h@_o(N*kEDlq_MDpfx^<_@_uNhOZC!QT2eMpOHmS^?`&TPXZ(4@sY%cA zl0Ne_9U^u^NIGpFGEo8&0@ojGm;88dLFHYfOeTPFrK;OW-U$p&5#YGGh@MlB^Cmfb zWPd}r$K`-w?vG&d7cJ`L!QKv;LafsNG$q1uSqDGCEqex*5DA=q}lDyOs9=l?9XkQhdkU? zdA_gnC*U(5xxYq^mnc9Hh={sk^>o1k?oN@typvRADj-)A^*RU@C?k)O65!6x8m>ZQ z%K4CDF4_M8w$t0Gaoj2sR}(q@zBeSTvO3K#t7hf60d-Vp|FQ~fYG49Q0!V>s?P^~) hprJiz53o6Y;uowDqLJPOy4wH%002ovPDHLkV1k`AU_Af; literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_blueberry_4.png b/mods/farming/textures/farming_blueberry_4.png new file mode 100644 index 0000000000000000000000000000000000000000..75fb69a0ee637f2bcfd309bd8b3c1e8ddd049559 GIT binary patch literal 317 zcmV-D0mA-?P)EJl!N5h5>1s;&t8sh>gb_^9sCPZ`kin0Dz*7 zDZR4II2tjpz||JtBIgz8MDBuRn-O_s!MaJP45*ugVG3mevAdCQoPeBAJp>9-8H;l! zQmZXES#*^9BVnoSk)Cc6H%=5f_dRfav)|-i)G^;*J|h5FYH&IQW;5V;=SDgURafPeRJjAo%Jt|_3c=7)EcOTu_VYZn8D%MjWi&q*we)^gyVX0 zLPCOwh)4nhlUrwBpPPVpMD^FSUbh7flh3Vj)-LBT@OWcc{Orlh%e_2@W~KLBn`61= zgu<3*J(p$$PZp6>c{V4qluhNRhVACX$=z9ifz~s4y85}Sb4q9e08e;RLI3~& literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..df7017147ed7088768b756be54fef4da23b1b5e8 GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv5AX?b)n#CA31^?2#JwhgV{rz@ zwp@pt zSecodDm-G9dCc&sLW*P8$K|^|vZx;B)p5&rIM643&|^cT=HE-lU3U7d+N8Qo$gA|H zSY+K|r~8&C8lHFdC)`~uTT$6DEzw7rGke+e$Nzk67JE&qcKy=Pbo7tZqv^5tx92-X zyg1_Ay8ag1O#d+oNvf3iChV#LI+4NC)z4*} HQ$iB}bbn|M literal 0 HcmV?d00001 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