diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2017-10-09 11:32:00 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2017-10-09 11:32:00 +0100 |
commit | ce0c3e8eb87452a92c46754ef49380b6f0131fb0 (patch) | |
tree | 2d473a9503813a64a24869d8c8ae2c7bcf08a5c1 | |
parent | 4c2965a5248f60c07a73685813517ea4f8692233 (diff) |
updating to newer 0.4.16 functions
-rw-r--r-- | README.txt | 1 | ||||
-rw-r--r-- | beanpole.lua | 2 | ||||
-rw-r--r-- | grapes.lua | 2 | ||||
-rw-r--r-- | hoes.lua | 12 | ||||
-rw-r--r-- | init.lua | 3 | ||||
-rw-r--r-- | mapgen.lua | 2 |
6 files changed, 12 insertions, 10 deletions
@@ -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/beanpole.lua b/beanpole.lua index 8afead6..e8b7455 100644 --- a/beanpole.lua +++ b/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 @@ -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 @@ -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 @@ -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) |