Updated to work with 0.4.13

This commit is contained in:
TenPlus1 2015-08-26 15:05:17 +01:00
parent 5757896caa
commit e6babd6486
8 changed files with 39 additions and 49 deletions

View File

@ -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

View File

@ -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 = {

View File

@ -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"
})

View File

@ -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,

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 96 B