135701f4f8
These cause some issues, like the ability to soak dirt under water for a short time to initialize the soaking metadata, then remove the water flow, then add it in and have leaching complete instantly because the neighbor check prevented the soaking ABM from firing to detect that the water was removed. In the course of investigating why ABMs are so slow to begin with, it was discovered that having neighbor checks can slow an ABM down by a factor of something like 7x, so clearly the assumption that the neigbor check being done in C++ as "efficient" was false. This means that we may be better off just always firing the ABM and letting Lua check only a couple of relevant nodes (e.g. for water flows in the space above) instead for performance. The main performance concern was dirt leaching, since dirt generates naturally in the world in bulk, but if the single check for water above may be faster than checking all 26 neighbors in C++ anyway, we might as well let the soaking API run for it so that it can detect the water having been removed and reset the counters.
40 lines
967 B
Lua
40 lines
967 B
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local minetest, nodecore
|
|
= minetest, nodecore
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
nodecore.register_soaking_abm({
|
|
label = "lux renew",
|
|
fieldname = "lavalux",
|
|
interval = 10,
|
|
nodenames = {"group:amalgam"},
|
|
soakrate = nodecore.lux_soak_rate,
|
|
soakcheck = function(data, pos)
|
|
if data.total < 12500 then return end
|
|
nodecore.set_loud(pos, {name = modname .. ":cobble"
|
|
.. nodecore.lux_react_qty(pos, 1)})
|
|
nodecore.witness(pos, "lux renewal")
|
|
end
|
|
})
|
|
|
|
nodecore.register_craft({
|
|
label = "lode renew",
|
|
action = "pummel",
|
|
toolgroups = {thumpy = 2},
|
|
normal = {y = 1},
|
|
indexkeys = {"nc_lode:prill_hot"},
|
|
nodes = {
|
|
{
|
|
match = "nc_lode:prill_hot",
|
|
replace = "air"
|
|
},
|
|
{
|
|
y = -1,
|
|
match = modname .. ":cobble8",
|
|
replace = "nc_lode:cobble_hot"
|
|
}
|
|
}
|
|
})
|