Casimir wrote:...kable.
licnese: GLPv3 or la...
Casimir wrote:...urce.
licnese: GLPv3 or la...
thanksCasimir wrote:Sometimes some tings are to small to have a home of their own. You are invited to post your tiny mods here.

Inocudom wrote:
To be on the safe side, you may want to make textures of your own for it.
--
-- Remove nodes in liquids
--
local function dissolve(pos_dissolve, pos_liquid)
local node = minetest.get_node(pos_liquid)
local name = node.name
local nodedef = minetest.registered_nodes[name]
if nodedef and nodedef.liquidtype ~= "none" then
local min_level = 8 - nodedef.liquid_range
if node.param2 == 0 or node.param2 == 240 then
minetest.set_node(pos_dissolve, {name = nodedef.liquid_alternative_flowing, param2 = 7})
elseif node.param2 > min_level then
minetest.set_node(pos_dissolve, {name = name, param2 = node.param2-1})
end
return true
end
end
minetest.register_abm({
nodenames = {"group:dissolve"},
neighbors = {"group:liquid"},
interval = 5,
chance = 1,
action = function(pos, node)
if dissolve(pos, {x=pos.x, y=pos.y+1, z=pos.z}) then return end
if dissolve(pos, {x=pos.x+1, y=pos.y, z=pos.z}) then return end
if dissolve(pos, {x=pos.x-1, y=pos.y, z=pos.z}) then return end
if dissolve(pos, {x=pos.x, y=pos.y, z=pos.z+1}) then return end
if dissolve(pos, {x=pos.x, y=pos.y, z=pos.z-1}) then return end
end,
})
Casimir wrote:This removes all nodes that are in the "dissolve" group when in contact with liquids. I hope that I covert all cases of remove or not remove. There also seems a strange thing when liquid sources get renewed, the param2 gets 240 then.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
--
-- Remove nodes in liquids
--
local function dissolve(pos_dissolve, pos_liquid)
local node = minetest.get_node(pos_liquid)
local name = node.name
local nodedef = minetest.registered_nodes[name]
if nodedef and nodedef.liquidtype ~= "none" then
local min_level = 8 - nodedef.liquid_range
if node.param2 == 0 or node.param2 == 240 then
minetest.set_node(pos_dissolve, {name = nodedef.liquid_alternative_flowing, param2 = 7})
elseif node.param2 > min_level then
minetest.set_node(pos_dissolve, {name = name, param2 = node.param2-1})
end
return true
end
end
minetest.register_abm({
nodenames = {"group:dissolve"},
neighbors = {"group:liquid"},
interval = 5,
chance = 1,
action = function(pos, node)
if dissolve(pos, {x=pos.x, y=pos.y+1, z=pos.z}) then return end
if dissolve(pos, {x=pos.x+1, y=pos.y, z=pos.z}) then return end
if dissolve(pos, {x=pos.x-1, y=pos.y, z=pos.z}) then return end
if dissolve(pos, {x=pos.x, y=pos.y, z=pos.z+1}) then return end
if dissolve(pos, {x=pos.x, y=pos.y, z=pos.z-1}) then return end
end,
})
Users browsing this forum: No registered users and 10 guests