1
0
Fork 0

Merge pull request 'Fix frequent ABM warning when lots of lava is in active block range' (#2894) from fix_lava_abms into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2894
mcl-structures-fixes
cora 2022-11-03 13:14:31 +00:00
commit f1cdb24545
6 changed files with 22 additions and 12 deletions

View File

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

View File

@ -153,12 +153,17 @@ minetest.register_abm({
neighbors = {"air"}, neighbors = {"air"},
interval = 27, interval = 27,
chance = 33, chance = 33,
min_y = mcl_vars.mg_overworld_min,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
if node.name == "mcl_core:snowblock" then return end if (mcl_weather.state ~= "rain" and mcl_weather.state ~= "thunder" and mcl_weather.state ~= "snow")
or not mcl_weather.has_snow(pos)
or node.name == "mcl_core:snowblock" then
return end
local above = vector.offset(pos,0,1,0) local above = vector.offset(pos,0,1,0)
local above_node = minetest.get_node(above) local above_node = minetest.get_node(above)
if above_node.name ~= "air" then return end
if (mcl_weather.state == "rain" or mcl_weather.state == "thunder" or mcl_weather.state == "snow") and mcl_weather.is_outdoor(pos) and mcl_weather.has_snow(pos) then if above_node.name == "air" and mcl_weather.is_outdoor(pos) then
local nn = nil local nn = nil
if node.name:find("snow") then if node.name:find("snow") then
local l = node.name:sub(-1) local l = node.name:sub(-1)

View File

@ -196,12 +196,14 @@ mcl_stairs.register_stair_and_slab_simple("blackstone_brick_polished", "mcl_blac
mcl_walls.register_wall("mcl_blackstone:wall", S("Blackstone Wall"), "mcl_blackstone:blackstone") mcl_walls.register_wall("mcl_blackstone:wall", S("Blackstone Wall"), "mcl_blackstone:blackstone")
--lavacooling --lavacooling
minetest.register_abm({ minetest.register_abm({
label = "Lava cooling (basalt)", label = "Lava cooling (basalt)",
nodenames = {"group:lava"}, nodenames = {"group:lava"},
neighbors = {"mcl_core:ice"}, neighbors = {"mcl_core:ice"},
interval = 1, interval = 1,
chance = 1, chance = 1,
min_y = mcl_vars.mg_end_min,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "mcl_core:ice") local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "mcl_core:ice")
local lavatype = minetest.registered_nodes[node.name].liquidtype local lavatype = minetest.registered_nodes[node.name].liquidtype
@ -225,6 +227,7 @@ minetest.register_abm({
neighbors = {"mcl_core:packed_ice"}, neighbors = {"mcl_core:packed_ice"},
interval = 1, interval = 1,
chance = 1, chance = 1,
min_y = mcl_vars.mg_end_min,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "mcl_core:packed_ice") local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "mcl_core:packed_ice")
local lavatype = minetest.registered_nodes[node.name].liquidtype local lavatype = minetest.registered_nodes[node.name].liquidtype

View File

@ -22,6 +22,7 @@ minetest.register_abm({
neighbors = {"group:water"}, neighbors = {"group:water"},
interval = 1, interval = 1,
chance = 1, chance = 1,
min_y = mcl_vars.mg_end_min,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "group:water") local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "group:water")
@ -174,7 +175,7 @@ minetest.register_abm({
nodenames = {"group:destroy_by_lava_flow"}, nodenames = {"group:destroy_by_lava_flow"},
neighbors = {"group:lava"}, neighbors = {"group:lava"},
interval = 1, interval = 1,
chance = 1, chance = 5,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
liquid_flow_action(pos, "lava", function(pos) liquid_flow_action(pos, "lava", function(pos)
minetest.remove_node(pos) minetest.remove_node(pos)

View File

@ -236,7 +236,7 @@ minetest.register_node("mcl_crimson:warped_wart_block", {
minetest.register_node("mcl_crimson:shroomlight", { minetest.register_node("mcl_crimson:shroomlight", {
description = S("Shroomlight"), description = S("Shroomlight"),
tiles = {"shroomlight.png"}, tiles = {"shroomlight.png"},
groups = {handy = 1, hoe = 7, swordy = 1, leafdecay = 5, leaves = 1, deco_block = 1}, groups = {handy = 1, hoe = 7, swordy = 1, deco_block = 1},
light_source = minetest.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
_mcl_hardness = 2, _mcl_hardness = 2,
}) })

View File

@ -378,9 +378,9 @@ else -- Fire enabled
minetest.register_abm({ minetest.register_abm({
label = "Ignite fire by lava", label = "Ignite fire by lava",
nodenames = {"mcl_core:lava_source","mcl_nether:nether_lava_source"}, nodenames = {"mcl_core:lava_source","mcl_nether:nether_lava_source"},
neighbors = {"air","group:flammable"}, neighbors = {"group:flammable"},
interval = 7, interval = 15,
chance = 3, chance = 9,
catch_up = false, catch_up = false,
action = function(pos) action = function(pos)
local p=get_ignitable_by_lava(pos) local p=get_ignitable_by_lava(pos)