Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Default/trees: Add requirement of light level 13 for sapling growth
  • Loading branch information
paramat committed Oct 17, 2015
1 parent c15bd9d commit ef8b7e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mods/default/trees.lua
Expand Up @@ -16,6 +16,10 @@ local function can_grow(pos)
if is_soil == 0 then
return false
end
local ll = minetest.get_node_light(pos)
if not ll or ll < 13 then -- Minimum light level for growth
return false -- matches grass, wheat and cotton
end
return true
end

Expand Down

4 comments on commit ef8b7e2

@kilbith
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to choose a clearer variable name like light_level for not requiring a comment aside.

@ShadowNinja
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing you tried to align these comments with a tab width of four. Don't do that -- it breaks with every other tab width. Instead put it before. It doesn't even make sense this way because "matches grass ..." isn't a comment about "return false".

@paramat
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 'll' was only used to match the farming mod.
I agree the comments are sloppy.
I may have to clean this up.

@0-afflatus
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for readable variable names. I'm not keen on inline comments either.

Please sign in to comment.