From cdd8ea1dbc423fc0f2ed74ed5f277e8ae396b237 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 2 Nov 2022 13:02:52 +0100 Subject: [PATCH 1/3] Optimize dripping ABMs --- mods/ENTITIES/mcl_dripping/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_dripping/init.lua b/mods/ENTITIES/mcl_dripping/init.lua index f03ba3b24..b5a5043b7 100644 --- a/mods/ENTITIES/mcl_dripping/init.lua +++ b/mods/ENTITIES/mcl_dripping/init.lua @@ -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, }) From e9e76d2c1e0c0bd0b98f5e467379eb4919aabcbe Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 2 Nov 2022 13:03:13 +0100 Subject: [PATCH 2/3] Optimize snow pile-up ABM --- mods/ENVIRONMENT/mcl_weather/snow.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index a756c6e7f..8de0dc0ae 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -153,12 +153,17 @@ minetest.register_abm({ neighbors = {"air"}, interval = 27, chance = 33, + min_y = mcl_vars.mg_overworld_min, 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_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 if node.name:find("snow") then local l = node.name:sub(-1) From 48d6a2fd7253e00baa2d9839f2147c59e729a201 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 2 Nov 2022 13:03:29 +0100 Subject: [PATCH 3/3] Add some ABM limits for lava ABMs --- mods/ITEMS/mcl_blackstone/init.lua | 3 +++ mods/ITEMS/mcl_core/functions.lua | 3 ++- mods/ITEMS/mcl_crimson/init.lua | 2 +- mods/ITEMS/mcl_fire/init.lua | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index 99d168b15..00b9819f8 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -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") --lavacooling + minetest.register_abm({ label = "Lava cooling (basalt)", nodenames = {"group:lava"}, neighbors = {"mcl_core:ice"}, interval = 1, chance = 1, + min_y = mcl_vars.mg_end_min, 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 lavatype = minetest.registered_nodes[node.name].liquidtype @@ -225,6 +227,7 @@ minetest.register_abm({ neighbors = {"mcl_core:packed_ice"}, interval = 1, chance = 1, + min_y = mcl_vars.mg_end_min, 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 lavatype = minetest.registered_nodes[node.name].liquidtype diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index f5132d74b..5a01cd8c1 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -22,6 +22,7 @@ minetest.register_abm({ neighbors = {"group:water"}, interval = 1, chance = 1, + min_y = mcl_vars.mg_end_min, 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") @@ -174,7 +175,7 @@ minetest.register_abm({ nodenames = {"group:destroy_by_lava_flow"}, neighbors = {"group:lava"}, interval = 1, - chance = 1, + chance = 5, action = function(pos, node, active_object_count, active_object_count_wider) liquid_flow_action(pos, "lava", function(pos) minetest.remove_node(pos) diff --git a/mods/ITEMS/mcl_crimson/init.lua b/mods/ITEMS/mcl_crimson/init.lua index b225ab142..255295aba 100644 --- a/mods/ITEMS/mcl_crimson/init.lua +++ b/mods/ITEMS/mcl_crimson/init.lua @@ -236,7 +236,7 @@ minetest.register_node("mcl_crimson:warped_wart_block", { minetest.register_node("mcl_crimson:shroomlight", { description = S("Shroomlight"), 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, _mcl_hardness = 2, }) diff --git a/mods/ITEMS/mcl_fire/init.lua b/mods/ITEMS/mcl_fire/init.lua index 79b46a701..8827b9f9a 100644 --- a/mods/ITEMS/mcl_fire/init.lua +++ b/mods/ITEMS/mcl_fire/init.lua @@ -378,9 +378,9 @@ else -- Fire enabled minetest.register_abm({ label = "Ignite fire by lava", nodenames = {"mcl_core:lava_source","mcl_nether:nether_lava_source"}, - neighbors = {"air","group:flammable"}, - interval = 7, - chance = 3, + neighbors = {"group:flammable"}, + interval = 15, + chance = 9, catch_up = false, action = function(pos) local p=get_ignitable_by_lava(pos)