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: 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.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.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 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 -- 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 = { drop = {
max_items = 1, max_items = 1,
items = { items = {

View File

@ -32,10 +32,21 @@ farming.register_hoe = function(name, def)
end end
}) })
-- Register its recipe -- Register its recipe
minetest.register_craft({ if def.material == nil then
output = name:gsub(":", "", 1), minetest.register_craft({
recipe = def.recipe 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 end
-- Turns dirt with group soil=1 into soil -- 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 -- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name = "farming:soil"}) minetest.set_node(pt.under, {name = "farming:soil"})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5}) 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 return itemstack
end end
@ -87,64 +100,40 @@ farming.register_hoe(":farming:hoe_wood", {
description = "Wooden Hoe", description = "Wooden Hoe",
inventory_image = "farming_tool_woodhoe.png", inventory_image = "farming_tool_woodhoe.png",
max_uses = 30, max_uses = 30,
recipe = { material = "group:wood"
{"group:wood", "group:wood"},
{"", "group:stick"},
{"", "group:stick"},
}
}) })
farming.register_hoe(":farming:hoe_stone", { farming.register_hoe(":farming:hoe_stone", {
description = "Stone Hoe", description = "Stone Hoe",
inventory_image = "farming_tool_stonehoe.png", inventory_image = "farming_tool_stonehoe.png",
max_uses = 90, max_uses = 90,
recipe = { material = "group:stone"
{"group:stone", "group:stone"},
{"", "group:stick"},
{"", "group:stick"},
}
}) })
farming.register_hoe(":farming:hoe_steel", { farming.register_hoe(":farming:hoe_steel", {
description = "Steel Hoe", description = "Steel Hoe",
inventory_image = "farming_tool_steelhoe.png", inventory_image = "farming_tool_steelhoe.png",
max_uses = 200, max_uses = 200,
recipe = { material = "default:steel_ingot"
{"default:steel_ingot", "default:steel_ingot"},
{"", "group:stick"},
{"", "group:stick"},
}
}) })
farming.register_hoe(":farming:hoe_bronze", { farming.register_hoe(":farming:hoe_bronze", {
description = "Bronze Hoe", description = "Bronze Hoe",
inventory_image = "farming_tool_bronzehoe.png", inventory_image = "farming_tool_bronzehoe.png",
max_uses = 220, max_uses = 220,
recipe = { material = "default:bronze_ingot"
{"default:bronze_ingot", "default:bronze_ingot"},
{"", "group:stick"},
{"", "group:stick"},
}
}) })
farming.register_hoe(":farming:hoe_mese", { farming.register_hoe(":farming:hoe_mese", {
description = "Mese Hoe", description = "Mese Hoe",
inventory_image = "farming_tool_mesehoe.png", inventory_image = "farming_tool_mesehoe.png",
max_uses = 350, max_uses = 350,
recipe = { material = "default:mese_crystal"
{"default:mese_crystal", "default:mese_crystal"},
{"", "group:stick"},
{"", "group:stick"},
}
}) })
farming.register_hoe(":farming:hoe_diamond", { farming.register_hoe(":farming:hoe_diamond", {
description = "Diamond Hoe", description = "Diamond Hoe",
inventory_image = "farming_tool_diamondhoe.png", inventory_image = "farming_tool_diamondhoe.png",
max_uses = 500, max_uses = 500,
recipe = { material = "default:diamond"
{"default:diamond", "default:diamond"},
{"", "group:stick"},
{"", "group:stick"},
}
}) })

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 by TenPlus1
NEW growing routine by prestidigitator NEW growing routine by prestidigitator
]] ]]
@ -397,7 +397,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing local pt = pointed_thing
-- check if pointing at a node -- check if pointing at a node
if not pt and pt.type ~= "node" then if not pt or pt.type ~= "node" then
return return
end 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 -- can I replace above node, and am I pointing at soil
if not minetest.registered_nodes[above.name].buildable_to if not minetest.registered_nodes[above.name].buildable_to
or minetest.get_item_group(under.name, "soil") < 2 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 return
end 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 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 if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
@ -474,7 +475,7 @@ farming.register_plant = function(name, def)
}) })
-- Register growing steps -- Register growing steps
for i=1,def.steps do for i = 1, def.steps do
local drop = { local drop = {
items = { items = {
{items = {mname .. ":" .. pname}, rarity = 9 - i}, {items = {mname .. ":" .. pname}, rarity = 9 - i},
@ -498,7 +499,6 @@ farming.register_plant = function(name, def)
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = drop, drop = drop,
selection_box = farming.select, selection_box = farming.select,
groups = g, groups = g,

View File

@ -1,23 +1,23 @@
-- normal soil -- normal soil
minetest.register_node("farming:soil", { minetest.register_node("farming:soil", {
description = "Soil", description = "Soil",
tiles = {"farming_soil.png", "default_dirt.png"}, tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "default:dirt", drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2}, groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2},
sounds = default.node_sound_dirt_defaults(), 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 -- wet soil
minetest.register_node("farming:soil_wet", { minetest.register_node("farming:soil_wet", {
description = "Wet Soil", 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", drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3}, groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3},
sounds = default.node_sound_dirt_defaults(), 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") minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet")
-- if water near soil then change to wet soil -- 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