summaryrefslogtreecommitdiff
path: root/farming
diff options
context:
space:
mode:
Diffstat (limited to 'farming')
-rw-r--r--farming/README.txt1
-rw-r--r--farming/beanpole.lua2
-rw-r--r--farming/grapes.lua2
-rw-r--r--farming/hoes.lua12
-rw-r--r--farming/init.lua3
-rw-r--r--farming/mapgen.lua2
6 files changed, 12 insertions, 10 deletions
diff --git a/farming/README.txt b/farming/README.txt
index 2b3fa26..8d81ca6 100644
--- a/farming/README.txt
+++ b/farming/README.txt
@@ -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
diff --git a/farming/beanpole.lua b/farming/beanpole.lua
index 8afead6..e8b7455 100644
--- a/farming/beanpole.lua
+++ b/farming/beanpole.lua
@@ -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
diff --git a/farming/grapes.lua b/farming/grapes.lua
index d443c33..d8d6409 100644
--- a/farming/grapes.lua
+++ b/farming/grapes.lua
@@ -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
diff --git a/farming/hoes.lua b/farming/hoes.lua
index c883e22..aee967c 100644
--- a/farming/hoes.lua
+++ b/farming/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
diff --git a/farming/init.lua b/farming/init.lua
index 3f026fb..8c615f7 100644
--- a/farming/init.lua
+++ b/farming/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
diff --git a/farming/mapgen.lua b/farming/mapgen.lua
index 929f181..0ca4059 100644
--- a/farming/mapgen.lua
+++ b/farming/mapgen.lua
@@ -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)