diff --git a/nature_classic/blossom.lua b/nature_classic/blossom.lua index 6cbb729..a5ab214 100644 --- a/nature_classic/blossom.lua +++ b/nature_classic/blossom.lua @@ -2,6 +2,8 @@ local S = minetest.get_translator("nature_classic") -- Blossoms and such +local random = math.random + local function spawn_apple_under(pos) local below = { x = pos.x, @@ -46,7 +48,7 @@ minetest.register_abm({ chance = nature.leaves_blossom_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if math.random(nature.leaves_blossom_chance) == 1 then + if random(nature.leaves_blossom_chance) == 1 then nature.enqueue_node(pos, node, nature.blossom_node) end end @@ -61,7 +63,7 @@ minetest.register_abm({ chance = nature.blossom_leaves_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if math.random(nature.blossom_leaves_chance) == 1 then + if random(nature.blossom_leaves_chance) == 1 then nature.enqueue_node(pos, node, nature.blossom_leaves) end end @@ -76,7 +78,7 @@ minetest.register_abm({ chance = nature.apple_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if math.random(4) == 1 and nature.dtime < 0.2 and not minetest.find_node_near(pos, nature.apple_spread, { "default:apple" }) then + if random(4) == 1 and nature.dtime < 0.2 and not minetest.find_node_near(pos, nature.apple_spread, { "default:apple" }) then spawn_apple_under(pos) end end