make vines growth and rotting ABMs configurable

This commit is contained in:
Vanessa Ezekowitz 2014-12-22 13:50:59 -05:00
parent 5e8d4084ea
commit d001b23396

View File

@ -3,10 +3,18 @@
and rope does not drop anything!!!! and rope does not drop anything!!!!
]] ]]
vines = {}
local mod_name = "vines" local mod_name = "vines"
local average_height = 12 local average_height = 12
local spawn_interval = 90 local spawn_interval = 90
local vines_group = {attached_node=1,vines=1,snappy=3,flammable=2,hanging_node=1} local vines_group = {attached_node=1,vines=1,snappy=3,flammable=2,hanging_node=1}
vines.growth_interval = 300
vines.growth_chance = 2
vines.rot_interval = 300
vines.rot_chance = 8
-- Nodes -- Nodes
minetest.register_node("vines:rope_block", { minetest.register_node("vines:rope_block", {
description = "Rope", description = "Rope",
@ -243,11 +251,12 @@ minetest.register_node("vines:vine_rotten", {
}, },
}) })
--ABM -- vine rotting
minetest.register_abm({ minetest.register_abm({
nodenames = {"vines:vine", "vines:side", "vines:willow"}, nodenames = {"vines:vine", "vines:side", "vines:willow"},
interval = 300, interval = vines.rot_interval,
chance = 8, chance = vines.rot_chance,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.find_node_near(pos, 5, "group:tree") == nil then if minetest.find_node_near(pos, 5, "group:tree") == nil then
local walldir = node.param2 local walldir = node.param2
@ -256,10 +265,12 @@ minetest.register_abm({
end end
}) })
-- vine growth
minetest.register_abm({ minetest.register_abm({
nodenames = {"vines:vine", "vines:side", "vines:willow"}, nodenames = {"vines:vine", "vines:side", "vines:willow"},
interval = 300, interval = vines.growth_interval,
chance = 2, chance = vines.growth_chance,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local p = {x=pos.x, y=pos.y-1, z=pos.z} local p = {x=pos.x, y=pos.y-1, z=pos.z}
local n = minetest.get_node(p) local n = minetest.get_node(p)
@ -270,6 +281,8 @@ minetest.register_abm({
end end
}) })
-- rope extension
minetest.register_abm({ minetest.register_abm({
nodenames = {"vines:rope_end"}, nodenames = {"vines:rope_end"},
interval = 1, interval = 1,