forked from mtcontrib/plantlife_modpack
[ferns] Optimize math.random call function
This commit is contained in:
parent
d7b543f5d7
commit
4dcf14ce1f
@ -11,6 +11,8 @@ local S = minetest.get_translator("ferns")
|
||||
|
||||
assert(abstract_ferns.config.enable_treefern == true)
|
||||
|
||||
local random = math.random
|
||||
|
||||
abstract_ferns.grow_tree_fern = function(pos)
|
||||
|
||||
local pos_aux = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
@ -20,12 +22,12 @@ abstract_ferns.grow_tree_fern = function(pos)
|
||||
return
|
||||
end
|
||||
|
||||
local size = math.random(1, 4) + math.random(1, 4)
|
||||
local size = random(1, 4) + random(1, 4)
|
||||
if (size > 5) then
|
||||
size = 10 - size
|
||||
end
|
||||
size = size + 1
|
||||
local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[math.random(1, 2)]
|
||||
local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[random(1, 2)]
|
||||
|
||||
local i = 1
|
||||
local brk = false
|
||||
|
Loading…
Reference in New Issue
Block a user