From e6babd6486730a0341ea3bde31c80ed920c2328c Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Wed, 26 Aug 2015 15:05:17 +0100 Subject: [PATCH] Updated to work with 0.4.13 --- README.txt | 1 + grass.lua | 4 +- hoes.lua | 59 ++++++++++++----------------- init.lua | 14 +++---- soil.lua | 10 ++--- textures/farming_soil.png | Bin 713 -> 706 bytes textures/farming_soil_wet.png | Bin 659 -> 677 bytes textures/farming_soil_wet_side.png | Bin 721 -> 96 bytes 8 files changed, 39 insertions(+), 49 deletions(-) diff --git a/README.txt b/README.txt index d10ad53..e8425f1 100644 --- a/README.txt +++ b/README.txt @@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t Changelog: +1.20b- Tidied code, made api compatible with new 0.4.13 changes and changed to soil texture overlays 1.20 - NEW growing routine added that allows crops to grow while player is away doing other things (thanks prestidigitator) 1.14 - Added Green Beans from Crops mod (thanks sofar), little bushels in the wild but need to be grown using beanpoles crafted with 4 sticks (2 either side) 1.13 - Fixed seed double-placement glitch. Mapgen now uses 0.4.12+ for plant generation diff --git a/grass.lua b/grass.lua index 04a66a8..288299b 100644 --- a/grass.lua +++ b/grass.lua @@ -1,9 +1,9 @@ -- Override default grass and have it drop Wheat Seeds -for i=1,5 do +for i = 1, 5 do - minetest.override_item("default:grass_"..i, { + minetest.override_item("default:grass_" .. i, { drop = { max_items = 1, items = { diff --git a/hoes.lua b/hoes.lua index 3a2d107..626f8da 100644 --- a/hoes.lua +++ b/hoes.lua @@ -32,10 +32,21 @@ farming.register_hoe = function(name, def) end }) -- Register its recipe - minetest.register_craft({ - output = name:gsub(":", "", 1), - recipe = def.recipe - }) + if def.material == nil then + minetest.register_craft({ + output = name:sub(2), + recipe = def.recipe + }) + else + minetest.register_craft({ + output = name:sub(2), + recipe = { + {def.material, def.material, ""}, + {"", "group:stick", ""}, + {"", "group:stick", ""} + } + }) + end end -- Turns dirt with group soil=1 into soil @@ -77,7 +88,9 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses) -- turn the node into soil, wear out item and play sound minetest.set_node(pt.under, {name = "farming:soil"}) minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5}) - itemstack:add_wear(65535/(uses - 1)) + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535/(uses-1)) + end return itemstack end @@ -87,64 +100,40 @@ farming.register_hoe(":farming:hoe_wood", { description = "Wooden Hoe", inventory_image = "farming_tool_woodhoe.png", max_uses = 30, - recipe = { - {"group:wood", "group:wood"}, - {"", "group:stick"}, - {"", "group:stick"}, - } + material = "group:wood" }) farming.register_hoe(":farming:hoe_stone", { description = "Stone Hoe", inventory_image = "farming_tool_stonehoe.png", max_uses = 90, - recipe = { - {"group:stone", "group:stone"}, - {"", "group:stick"}, - {"", "group:stick"}, - } + material = "group:stone" }) farming.register_hoe(":farming:hoe_steel", { description = "Steel Hoe", inventory_image = "farming_tool_steelhoe.png", max_uses = 200, - recipe = { - {"default:steel_ingot", "default:steel_ingot"}, - {"", "group:stick"}, - {"", "group:stick"}, - } + material = "default:steel_ingot" }) farming.register_hoe(":farming:hoe_bronze", { description = "Bronze Hoe", inventory_image = "farming_tool_bronzehoe.png", max_uses = 220, - recipe = { - {"default:bronze_ingot", "default:bronze_ingot"}, - {"", "group:stick"}, - {"", "group:stick"}, - } + material = "default:bronze_ingot" }) farming.register_hoe(":farming:hoe_mese", { description = "Mese Hoe", inventory_image = "farming_tool_mesehoe.png", max_uses = 350, - recipe = { - {"default:mese_crystal", "default:mese_crystal"}, - {"", "group:stick"}, - {"", "group:stick"}, - } + material = "default:mese_crystal" }) farming.register_hoe(":farming:hoe_diamond", { description = "Diamond Hoe", inventory_image = "farming_tool_diamondhoe.png", max_uses = 500, - recipe = { - {"default:diamond", "default:diamond"}, - {"", "group:stick"}, - {"", "group:stick"}, - } + material = "default:diamond" }) \ No newline at end of file diff --git a/init.lua b/init.lua index 03fc451..7d96f1d 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ --[[ - Minetest Farming Redo Mod 1.20 (5th July 2015) + Minetest Farming Redo Mod 1.20b (26th August 2015) by TenPlus1 NEW growing routine by prestidigitator ]] @@ -397,7 +397,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) local pt = pointed_thing -- check if pointing at a node - if not pt and pt.type ~= "node" then + if not pt or pt.type ~= "node" then return end @@ -418,13 +418,14 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) -- can I replace above node, and am I pointing at soil if not minetest.registered_nodes[above.name].buildable_to or minetest.get_item_group(under.name, "soil") < 2 - or minetest.get_item_group(above.name, "plant") ~= 0 then -- ADDED this line for multiple seed placement bug + -- avoid multiple seed placement bug + or minetest.get_item_group(above.name, "plant") ~= 0 then return end - -- add the node and remove 1 item from the itemstack + -- if not protected then add node and remove 1 item from the itemstack if not minetest.is_protected(pt.above, placer:get_player_name()) then - minetest.add_node(pt.above, {name=plantname}) + minetest.add_node(pt.above, {name = plantname, param2 = 1}) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end @@ -474,7 +475,7 @@ farming.register_plant = function(name, def) }) -- Register growing steps - for i=1,def.steps do + for i = 1, def.steps do local drop = { items = { {items = {mname .. ":" .. pname}, rarity = 9 - i}, @@ -498,7 +499,6 @@ farming.register_plant = function(name, def) paramtype = "light", walkable = false, buildable_to = true, - is_ground_content = true, drop = drop, selection_box = farming.select, groups = g, diff --git a/soil.lua b/soil.lua index b8f3001..ba96a57 100644 --- a/soil.lua +++ b/soil.lua @@ -1,23 +1,23 @@ -- normal soil minetest.register_node("farming:soil", { description = "Soil", - tiles = {"farming_soil.png", "default_dirt.png"}, + tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"}, drop = "default:dirt", groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2}, sounds = default.node_sound_dirt_defaults(), }) --- sand is not soil, change existing sand-soil to use normal soil -minetest.register_alias("farming:desert_sand_soil", "farming:soil") - -- wet soil minetest.register_node("farming:soil_wet", { description = "Wet Soil", - tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"}, + tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"}, drop = "default:dirt", groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3}, sounds = default.node_sound_dirt_defaults(), }) + +-- sand is not soil, change existing sand-soil to use normal soil +minetest.register_alias("farming:desert_sand_soil", "farming:soil") minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet") -- if water near soil then change to wet soil diff --git a/textures/farming_soil.png b/textures/farming_soil.png index 0be94e3c9ef086f529907a178160f139f619fdba..5cd3e681c4c3f74943026d67941e1f03a75d8cbe 100644 GIT binary patch literal 706 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GXl47&QZYLR^7dkPrg{3z!5FY%qoj zACm|hg9HZyCj$c$SkOyP!ck4oMO)lOT~vaZK}(25f|bEaRhXZV0f>MaIl#*FCAl<2 z*jzM4Ty?~h`4}A)c{PPt?KMP{c^Kt*n1q=bRCrk=xEU0986`OxWVslmco^k*nT44c z#Mwdm`4||0?gk==lYqvmax=(sFz88e+o=nSF))N!Dw)c0i7+sj$_sdC3VG;?gI%2B*-tAL5ssp zg-ugQ=JU=uj`9Nk{{8*_^zOAo%NAzE^8Wkr>FulM&mKK`aOcLA%jZt--?L|7TSI-Y zt)cF}e?Ncx`2PLeVafjvYCCXwRlio7S(M+S^r<9N}ZCe)ikpO+brY zd%8G=NL=n)e-CV|fjjVi!YBt~8j4oBq$NwtYo?c(at-|KQ;Z)*ex=iq0{<>owioXsq z1ik!ouD*J@sM%aW-=!Po+i&^w^w-O$1utxSnvFerlGdfq=U>%&>050@iqkdj*>7K8 zJlePNw(E6UM$dR}myBgQQ(tAd;k@w1$+=w<)GdgYQ#>vo>l>7bDJ MboFyt=akR{09AqB)&Kwi delta 700 zcmV;t0z>`61<3`F8Gi-<001BJ|6u?C0+2~WK~#9!ZBtuM6JZeD-yk3{y+8{o?Y2wr zrCocW?e;6(mP;vG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