Browse Source

[youngtrees] Optimize math.random call function

master
sys4 2 weeks ago
parent
commit
031260a62d
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      youngtrees/init.lua

+ 3
- 2
youngtrees/init.lua View File

@@ -1,6 +1,8 @@
-- support for i18n
local S = minetest.get_translator("youngtrees")

local random = math.random

abstract_youngtrees = {}

minetest.register_node("youngtrees:bamboo", {
@@ -104,8 +106,7 @@ minetest.register_node("youngtrees:youngtree_bottom", {


abstract_youngtrees.grow_youngtree = function(pos)
local height = math.random(1,3)
abstract_youngtrees.grow_youngtree_node(pos,height)
abstract_youngtrees.grow_youngtree_node(pos, random(1,3))
end

abstract_youngtrees.grow_youngtree_node = function(pos, height)


Loading…
Cancel
Save