1
0
Fork 0

Localize some variables in mcl_core

This commit is contained in:
Wuzzy 2020-06-03 20:16:39 +02:00
parent 5dab09c874
commit a08152d8fb
1 changed files with 7 additions and 7 deletions

View File

@ -230,17 +230,17 @@ end
-- Check if a node stops a tree from growing. Torches, plants, wood, tree, -- Check if a node stops a tree from growing. Torches, plants, wood, tree,
-- leaves and dirt does not affect tree growth. -- leaves and dirt does not affect tree growth.
function node_stops_growth(node) local function node_stops_growth(node)
if node.name == 'air' then if node.name == 'air' then
return false return false
end end
def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if not def then if not def then
return true return true
end end
groups = def.groups local groups = def.groups
if not groups then if not groups then
return true return true
end end
@ -256,11 +256,11 @@ end
-- around the tree. A width of 3 and height of 5 will check a 3x3 area, 5 -- around the tree. A width of 3 and height of 5 will check a 3x3 area, 5
-- nodes above the sapling. If any walkable node other than dirt, wood or -- nodes above the sapling. If any walkable node other than dirt, wood or
-- leaves occurs in those blocks the tree cannot grow. -- leaves occurs in those blocks the tree cannot grow.
function check_growth_width(pos, width, height) local function check_growth_width(pos, width, height)
-- Huge tree (with even width to check) will check one more node in -- Huge tree (with even width to check) will check one more node in
-- positive x and y directions. -- positive x and y directions.
neg_space = math.min((width - 1) / 2) local neg_space = math.min((width - 1) / 2)
pos_space = math.max((width - 1) / 2) local pos_space = math.max((width - 1) / 2)
for x = -neg_space, pos_space do for x = -neg_space, pos_space do
for z = -neg_space, pos_space do for z = -neg_space, pos_space do
for y = 1, height do for y = 1, height do
@ -281,7 +281,7 @@ end
-- for varieties of trees. The 'two_by_two' option is used to check if there is -- for varieties of trees. The 'two_by_two' option is used to check if there is
-- room to generate huge trees for spruce and jungle. The 'balloon' option is -- room to generate huge trees for spruce and jungle. The 'balloon' option is
-- used to check if there is room to generate a balloon tree for oak. -- used to check if there is room to generate a balloon tree for oak.
function check_tree_growth(pos, tree_id, options) local function check_tree_growth(pos, tree_id, options)
local two_by_two = options and options.two_by_two local two_by_two = options and options.two_by_two
local balloon = options and options.balloon local balloon = options and options.balloon