2019-02-24 10:19:22 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
|
|
|
local math, minetest, nodecore
|
|
|
|
= math, minetest, nodecore
|
2020-02-18 06:30:43 -05:00
|
|
|
local math_floor, math_pow
|
|
|
|
= math.floor, math.pow
|
2019-02-24 10:19:22 -05:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
|
|
|
nodecore.hard_stone_strata = 7
|
|
|
|
|
|
|
|
function nodecore.hard_stone_tile(n)
|
2020-02-18 06:30:43 -05:00
|
|
|
local o = math_floor(math_pow(n, 0.75) * 59)
|
2019-02-24 10:19:22 -05:00
|
|
|
if o <= 0 then
|
|
|
|
return modname .. "_stone.png"
|
|
|
|
end
|
|
|
|
if o >= 255 then
|
|
|
|
return modname .. "_stone.png^"
|
|
|
|
.. modname .. "_stone_hard.png"
|
|
|
|
end
|
|
|
|
return modname .. "_stone.png^("
|
|
|
|
.. modname .. "_stone_hard.png^[opacity:"
|
|
|
|
.. o .. ")"
|
|
|
|
end
|
2019-12-27 10:09:00 -05:00
|
|
|
|
2020-02-14 21:25:25 -05:00
|
|
|
function nodecore.register_dirt_leaching(fromnode, tonode, rate)
|
2019-12-27 10:09:00 -05:00
|
|
|
local function waterat(pos, dx, dy, dz)
|
|
|
|
pos = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
return minetest.get_item_group(node.name, "water") ~= 0
|
|
|
|
end
|
|
|
|
nodecore.register_soaking_abm({
|
2020-02-14 21:25:25 -05:00
|
|
|
label = fromnode .. " leaching to " .. tonode,
|
|
|
|
fieldname = "leach",
|
2019-12-27 10:09:00 -05:00
|
|
|
nodenames = {fromnode},
|
|
|
|
neighbors = {"group:water"},
|
|
|
|
interval = 5,
|
|
|
|
chance = 1,
|
|
|
|
soakrate = function(pos)
|
|
|
|
if not waterat(pos, 0, 1, 0) then return false end
|
|
|
|
local qty = 1
|
|
|
|
if waterat(pos, 1, 0, 0) then qty = qty * 1.5 end
|
|
|
|
if waterat(pos, -1, 0, 0) then qty = qty * 1.5 end
|
|
|
|
if waterat(pos, 0, 0, 1) then qty = qty * 1.5 end
|
|
|
|
if waterat(pos, 0, 0, -1) then qty = qty * 1.5 end
|
|
|
|
if waterat(pos, 0, -1, 0) then qty = qty * 1.5 end
|
|
|
|
return qty * (rate or 1)
|
|
|
|
end,
|
|
|
|
soakcheck = function(data, pos)
|
|
|
|
if data.total < 5000 then return end
|
2020-02-14 21:25:25 -05:00
|
|
|
nodecore.witness(pos, "leach " .. fromnode)
|
2020-01-16 22:02:59 -05:00
|
|
|
nodecore.set_loud(pos, {name = tonode})
|
2019-12-27 10:09:00 -05:00
|
|
|
return nodecore.fallcheck(pos)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end
|