Cleaning the code
This commit is contained in:
parent
0f6ee94dfe
commit
289d1bc98a
22
init.lua
22
init.lua
@ -207,18 +207,17 @@ minetest.register_abm({
|
||||
for dy = -2,2 do
|
||||
for dz = -2,1 do
|
||||
local pos1 = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(pos1).name
|
||||
if n == "nsspf:amanita_muscaria_mycelium" or n == "nsspf:amanita_phalloides_mycelium" or n == "nsspf:boletus_edulis_mycelium" or n == "nsspf:boletus_satanas_mycelium" then
|
||||
local n = minetest.get_node(pos1).name
|
||||
if string.match(n,"mycelium") then -- if the name contains "mycelium" then exit
|
||||
flag = 1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if flag == 0 then
|
||||
--if no other mycelium have been found:
|
||||
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "nsspf:"..name.."_mycelium"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
@ -226,8 +225,7 @@ minetest.register_abm({
|
||||
neighbors = {"air"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action =
|
||||
function(pos, node)
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {name="default:dirt"})
|
||||
end
|
||||
})
|
||||
@ -250,14 +248,13 @@ minetest.register_abm({
|
||||
action = function(pos, node)
|
||||
local pos1 = {x=pos.x, y=pos.y+2, z=pos.z}
|
||||
local pos2 = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local n = minetest.env:get_node(pos1).name
|
||||
local nn = minetest.env:get_node(pos2).name
|
||||
local n = minetest.get_node(pos1).name
|
||||
local nn = minetest.get_node(pos2).name
|
||||
if n== "air" and nn== "default:dirt_with_grass" then
|
||||
minetest.set_node({x = pos1.x, y = pos1.y, z = pos1.z}, {name = "nsspf:"..name})
|
||||
minetest.set_node(pos1, {name = "nsspf:"..name})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -294,18 +291,15 @@ minetest.register_abm({
|
||||
for dy = -2,2 do
|
||||
for dz = -2,1 do
|
||||
local pos1 = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(pos1).name
|
||||
local n = minetest.get_node(pos1).name
|
||||
if n == "nsspf:tuber_magnatum_pico" or n == "nsspf:tuber_melanosporum" or n == "nsspf:tuber_borchii" or n == "nsspf:terfezia_arenaria" then
|
||||
flag = 1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if flag == 0 then
|
||||
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "nsspf:"..name.."_tuber_mycelium"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
|
Loading…
x
Reference in New Issue
Block a user