From dc07eea59077b096049da2d9574346040f5593ab Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 13 Nov 2023 15:56:59 +0100 Subject: [PATCH 1/5] Freeze water in cold areas --- mods/ITEMS/mcl_core/functions.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index ad2346dd9..f90664e8e 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1451,6 +1451,20 @@ minetest.register_abm({ end }) +-- Freeze water +minetest.register_abm({ + label = "Freeze water in cold areas", + nodenames = {"mcl_core:water_source", "mclx_core:river_water_source"}, + interval = 32, + chance = 8, + action = function(pos, node) + if mcl_weather.has_snow(pos) then + node.name = "mcl_core:ice" + minetest.swap_node(pos, node) + end + end +}) + --[[ Call this for vines nodes only. Given the pos and node of a vines node, this returns true if the vines are supported and false if the vines are currently floating. From c2098d777f314eed386043e4320dfd5313bba777 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 21 Nov 2023 16:53:57 +0100 Subject: [PATCH 2/5] Prevent water freezing and ice melting ABMs from fighting --- mods/ITEMS/mcl_core/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index f90664e8e..664982145 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1458,7 +1458,7 @@ minetest.register_abm({ interval = 32, chance = 8, action = function(pos, node) - if mcl_weather.has_snow(pos) then + if mcl_weather.has_snow(pos) and minetest.get_node_light(pos, 0) < 12 then node.name = "mcl_core:ice" minetest.swap_node(pos, node) end From f23014005f2dc63f412703ffdf2d9b3e65003ad6 Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 25 Nov 2023 06:31:30 +0100 Subject: [PATCH 3/5] Only freeze water under open air and if light level < 10 --- mods/ITEMS/mcl_core/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 664982145..6b3c9f251 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1458,7 +1458,7 @@ minetest.register_abm({ interval = 32, chance = 8, action = function(pos, node) - if mcl_weather.has_snow(pos) and minetest.get_node_light(pos, 0) < 12 then + if mcl_weather.has_snow(pos) and minetest.get_natural_light(vector.offset(pos,0,1,0), 0.5) == minetest.LIGHT_MAX + 1 and minetest.get_node_light(pos) < 10 then node.name = "mcl_core:ice" minetest.swap_node(pos, node) end From a785be59d91495edc87839e6d8ae3c6a80a94b6a Mon Sep 17 00:00:00 2001 From: WillConker Date: Mon, 1 Jul 2024 16:28:19 +0100 Subject: [PATCH 4/5] Changed node light check to artificial light so that water can freeze in the day --- mods/ITEMS/mcl_core/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 6b3c9f251..e66ce8db7 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1458,7 +1458,7 @@ minetest.register_abm({ interval = 32, chance = 8, action = function(pos, node) - if mcl_weather.has_snow(pos) and minetest.get_natural_light(vector.offset(pos,0,1,0), 0.5) == minetest.LIGHT_MAX + 1 and minetest.get_node_light(pos) < 10 then + if mcl_weather.has_snow(pos) and minetest.get_natural_light(vector.offset(pos,0,1,0), 0.5) == minetest.LIGHT_MAX + 1 and minetest.get_artificial_light(minetest.get_node(pos).param1) < 10 then node.name = "mcl_core:ice" minetest.swap_node(pos, node) end From 6c614d8376e3e461e644bee430e9e93835c9006b Mon Sep 17 00:00:00 2001 From: WillConker Date: Sat, 13 Jul 2024 12:30:39 +0200 Subject: [PATCH 5/5] Added line breaks in water freezing condition --- mods/ITEMS/mcl_core/functions.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index e66ce8db7..b520777d6 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1458,7 +1458,9 @@ minetest.register_abm({ interval = 32, chance = 8, action = function(pos, node) - if mcl_weather.has_snow(pos) and minetest.get_natural_light(vector.offset(pos,0,1,0), 0.5) == minetest.LIGHT_MAX + 1 and minetest.get_artificial_light(minetest.get_node(pos).param1) < 10 then + if mcl_weather.has_snow(pos) + and minetest.get_natural_light(vector.offset(pos,0,1,0), 0.5) == minetest.LIGHT_MAX + 1 + and minetest.get_artificial_light(minetest.get_node(pos).param1) < 10 then node.name = "mcl_core:ice" minetest.swap_node(pos, node) end