1
0
mirror of https://github.com/mt-mods/plantlife_modpack.git synced 2024-11-11 21:00:22 +01:00
plantlife_modpack/nature_classic/init.lua
Rogier 6c715f65f6 Fix timer bug causing persistent blossoms
Because minetest.after() is not bound to a position, and because it is not
saved, it may trigger after the node to which it applies was unloaded, or
not at all (if the session ends). If that happens, The 'young' flag
will not be cleared, and will have become persistent (i.e. without a timer
which will eventually clear it).

This patch removes the 'young' flag, and replaces it with a timestamp, removing
the need for a timer. Any lingering 'young' flags that have become persistent
are automatically removed over time (i.e.: they are simply ignored...)
2015-06-18 11:24:17 +02:00

41 lines
1.2 KiB
Lua

-- Nature Classic mod
-- Originally by neko259
-- Nature is slowly capturing the world!
local current_mod_name = minetest.get_current_modname()
nature = {}
nature.blossomqueue = {}
nature.blossomqueue_max = 1000
nature.blossom_node = "nature:blossom"
nature.blossom_leaves = "default:leaves"
nature.blossom_textures = { "default_leaves.png^nature_blossom.png" }
if minetest.get_modpath("moretrees") then
nature.blossom_node = "moretrees:apple_blossoms"
nature.blossom_leaves = "moretrees:apple_tree_leaves"
nature.blossom_textures = { "moretrees_apple_tree_leaves.png^nature_blossom.png" }
minetest.register_alias("nature:blossom", "default:leaves")
end
nature.leaves_blossom_chance = 15
nature.blossom_leaves_chance = 5
nature.blossom_delay = 3600
nature.apple_chance = 10
nature.apple_spread = 2
nature.meta_blossom_time = "blossom_time"
nature.blossom_duration = 5
function dumppos(pos)
return "("..pos.x..","..pos.y..","..pos.z..")"
end
dofile(minetest.get_modpath(current_mod_name) .. "/config.lua")
dofile(minetest.get_modpath(current_mod_name) .. "/global_function.lua")
dofile(minetest.get_modpath(current_mod_name) .. "/blossom.lua")
minetest.log("info", "[Nature Classic] loaded!")