forked from minetest/minetest_game
Fix indentation, use log() instead of print() and use get_item_group() in tree growing ABM
This commit is contained in:
parent
4c0c7ae146
commit
5d0795a1a7
|
@ -136,9 +136,13 @@ minetest.register_abm({
|
|||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
|
||||
if is_soil == nil or is_soil == 0 then return end
|
||||
print("A sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local is_soil = minetest.get_item_group(nu, "soil")
|
||||
if is_soil == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||
|
@ -155,9 +159,13 @@ minetest.register_abm({
|
|||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
|
||||
if is_soil == nil or is_soil == 0 then return end
|
||||
print("A jungle sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local is_soil = minetest.get_item_group(nu, "soil")
|
||||
if is_soil == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A jungle sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y-1, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||
|
|
Loading…
Reference in New Issue
Block a user