1
0
Fork 0

Optimize dripping ABMs

mcl-structures-fixes
cora 2022-11-02 13:02:52 +01:00
parent 5355234af1
commit cdd8ea1dbc
1 changed files with 5 additions and 4 deletions

View File

@ -64,14 +64,15 @@ function mcl_dripping.register_drop(def)
interval = def.interval,
chance = def.chance,
action = function(pos)
local below = minetest.get_node(vector.offset(pos,0,-1,0)).name
if below ~= "air" then return end
local r = math.ceil(def.interval / 20)
local nn = minetest.find_nodes_in_area(vector.offset(pos, -r, 0, -r), vector.offset(pos, r, 0, r), def.nodes)
--start a bunch of particle cycles to be able to get away
--with longer abm cycles
table.shuffle(nn)
for i = 1, math.random(#nn) do
if minetest.get_item_group(minetest.get_node(vector.offset(nn[i], 0, 1, 0)).name, def.liquid) ~= 0
and minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name == "air" then
if minetest.get_item_group(minetest.get_node(vector.offset(nn[i], 0, 1, 0)).name, def.liquid) ~= 0 then
make_drop(nn[i], def.liquid, def.sound, def.interval, def.texture)
end
end
@ -85,7 +86,7 @@ mcl_dripping.register_drop({
light = 1,
nodes = { "group:opaque", "group:leaves" },
sound = "drippingwater_drip",
interval = 60,
interval = 60.3,
chance = 10,
})
@ -95,6 +96,6 @@ mcl_dripping.register_drop({
light = math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3),
nodes = { "group:opaque" },
sound = "drippingwater_lavadrip",
interval = 60,
interval = 110.1,
chance = 10,
})