summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2015-08-26 15:05:17 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2015-08-26 15:05:17 +0100
commite6babd6486730a0341ea3bde31c80ed920c2328c (patch)
treeb64664bde2a6a2d1a1c8c022c008b42d1117b722
parent5757896caaeac6f47732344f9d870fe65d9df8ce (diff)
Updated to work with 0.4.13
-rw-r--r--README.txt1
-rw-r--r--grass.lua4
-rw-r--r--hoes.lua59
-rw-r--r--init.lua14
-rw-r--r--soil.lua10
-rw-r--r--textures/farming_soil.pngbin713 -> 706 bytes
-rw-r--r--textures/farming_soil_wet.pngbin659 -> 677 bytes
-rw-r--r--textures/farming_soil_wet_side.pngbin721 -> 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 0be94e3..5cd3e68 100644
--- a/textures/farming_soil.png
+++ b/textures/farming_soil.png
Binary files differ
diff --git a/textures/farming_soil_wet.png b/textures/farming_soil_wet.png
index d5e335e..0b4487d 100644
--- a/textures/farming_soil_wet.png
+++ b/textures/farming_soil_wet.png
Binary files differ
diff --git a/textures/farming_soil_wet_side.png b/textures/farming_soil_wet_side.png
index 6bd3a56..f0b1bd4 100644
--- a/textures/farming_soil_wet_side.png
+++ b/textures/farming_soil_wet_side.png
Binary files differ