Skip to content
Snippets Groups Projects
Commit 57240fe6 authored by tenplus1's avatar tenplus1
Browse files

Code tweaks

parent 2befb9a9
No related branches found
No related tags found
No related merge requests found
......@@ -63,20 +63,17 @@ minetest.register_abm({
action = function(pos, node)
local count_grasses = {}
local curr_max = 0
local curr_type = "ethereal:green_dirt_top" -- fallback Colour
local curr_type = "ethereal:green_dirt" -- fallback
local positions = minetest.find_nodes_in_area(
{x=(pos.x-2), y=(pos.y-2), z=(pos.z-2)},
{x=(pos.x+2), y=(pos.y+2), z=(pos.z+2)},
"group:ethereal_grass")
local n
-- count new grass nodes
for _,p in ipairs(positions) do
local n = minetest.get_node(p)
n = minetest.get_node_or_nil(p)
if n and n.name then
if not count_grasses[n.name] then
count_grasses[n.name] = 1
else
count_grasses[n.name] = count_grasses[n.name] + 1
end
count_grasses[n.name] = (count_grasses[n.name] or 0) + 1
-- we found a grass type with more than current max
if count_grasses[n.name] > curr_max then
curr_max = count_grasses[n.name]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment