Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
nodenames = "default:dirt" "default:stone"
nodenames = "default:dirt" "default:stone" ALLNODES = {} -- new
function minetest.register_node(name, nodedef)
nodedef.type = "node"
minetest.register_item(name, nodedef)
table.insert(ALLNODES, name) -- new
endminetest.register_abm(
{nodenames =
interval = 1,
chance = 1,
action = function(pos)
minetest.env:add_node(pos, {name="default:dirt_with_grass"})
end,
})celeron55 wrote:What are you going to do with such an ABM?
Do you realize having a chance higher than, say, 1/1000 (to only randomly affect one out of a thousand nodes) will completely screw the functioning of the server by overloading it insanely?
if CURRENT_SEASON == 1 then
if node.name == 'madblocks:grass_autumn' or node.name == 'default:dirt_with_grass' or node.name == 'madblocks:grass_spring' then
minetest.env:add_node(pos,{type="node",name='madblocks:grass_winter'})
elseif node.name == 'madblocks:leaves_autumn' or node.name == 'default:leaves' or node.name == 'madblocks:leaves_spring' then
minetest.env:add_node(pos,{type="node",name='madblocks:leaves_winter'})
elseif node.name == 'default:desert_sand' then
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
if above ~= nil and above.name == 'air' then
minetest.env:add_node(pos,{type="node",name='madblocks:desertsand_winter'})
end
elseif node.name == 'default:sand' then
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
if above ~= nil and above.name == 'air' then
minetest.env:add_node(pos,{type="node",name='madblocks:sand_winter'})
end
elseif node.name == 'default:cactus' then
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
if above ~= nil and above.name == 'air' then
minetest.env:add_node(pos,{type="node",name='madblocks:cactus_winter'})
end
elseif node.name == 'default:water_source' then
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
if above ~= nil and above.name == 'air' then
minetest.env:add_node(pos,{type="node",name='madblocks:ice_source'})
end
elseif node.name == 'default:water_flowing' then
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
if above ~= nil and above.name == 'air' then
minetest.env:add_node(pos,{type="node",name='madblocks:ice_flowing'})
end
end
Users browsing this forum: No registered users and 24 guests