forked from mtcontrib/farming
updating to newer 0.4.16 functions
This commit is contained in:
parent
4c2965a524
commit
ce0c3e8eb8
@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
|
||||
|
||||
Changelog:
|
||||
|
||||
1.29 - Updating functions so requires Minetest 0.4.16 and above to run
|
||||
1.28 - Added chili peppers and bowl of chili, optimized code and fixed a few bugs, added porridge
|
||||
1.27 - Added meshoptions to api and wheat plants, added farming.rarity setting to spawn more/less crops on map, have separate cotton/string items (4x cotton = 1x wool, 2x cotton = 2x string)
|
||||
1.26 - Added support for [toolranks] mod when using hoe's
|
||||
|
@ -121,7 +121,7 @@ minetest.register_node("farming:beanpole", {
|
||||
|
||||
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not farming.is_creative(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
|
@ -116,7 +116,7 @@ minetest.register_node("farming:trellis", {
|
||||
|
||||
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not farming.is_creative(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
|
12
hoes.lua
12
hoes.lua
@ -69,7 +69,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
if not pt or pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
local upos = pointed_thing.under
|
||||
|
||||
@ -80,23 +80,23 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
|
||||
local p = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z}
|
||||
local above = minetest.get_node(p)
|
||||
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name]
|
||||
or not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- check if the node above the pointed thing is air
|
||||
if above.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- check if pointing at dirt
|
||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- turn the node into soil, wear out item and play sound
|
||||
minetest.set_node(pt.under, {name = "farming:soil"})
|
||||
|
||||
@ -104,7 +104,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
|
||||
local wear = 65535 / (uses -1)
|
||||
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
if farming.is_creative(user:get_player_name()) then
|
||||
if tr then
|
||||
wear = 1
|
||||
else
|
||||
|
3
init.lua
3
init.lua
@ -7,6 +7,7 @@
|
||||
|
||||
farming = {}
|
||||
farming.mod = "redo"
|
||||
farming.version = "1.29"
|
||||
farming.path = minetest.get_modpath("farming")
|
||||
farming.select = {
|
||||
type = "fixed",
|
||||
@ -29,7 +30,7 @@ farming.intllib = S
|
||||
|
||||
|
||||
-- Utility Function
|
||||
local time_speed = tonumber(minetest.setting_get("time_speed")) or 72
|
||||
local time_speed = tonumber(minetest.settings:get("time_speed")) or 72
|
||||
local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or 0
|
||||
local function clamp(x, min, max)
|
||||
return (x < min and min) or (x > max and max) or x
|
||||
|
@ -39,7 +39,7 @@ register_plant("beanbush", 18, 35, "", -1, farming.beans)
|
||||
register_plant("grapebush", 25, 45, "", -1, farming.grapes)
|
||||
|
||||
|
||||
if minetest.get_mapgen_params().mgname == "v6" then
|
||||
if minetest.get_mapgen_setting("mg_name") == "v6" then
|
||||
|
||||
register_plant("carrot_8", 1, 30, "group:water", 1, farming.carrot)
|
||||
register_plant("cucumber_4", 1, 20, "group:water", 1, farming.cucumber)
|
||||
|
Loading…
Reference in New Issue
Block a user