From 6e9d712c5eefd98a32b9a56f7bc615d448eca86b Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 2 Jun 2019 10:12:36 +0200 Subject: [PATCH] Fix ice not melting properly by non-Sun light --- mods/ITEMS/mcl_core/functions.lua | 19 ++++++++++++++++++- mods/ITEMS/mcl_core/nodes_base.lua | 8 +------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index bcbab0e70..215db3f08 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1175,7 +1175,11 @@ minetest.register_abm({ chance = 8, action = function(pos, node) if minetest.get_node_light(pos, 0) >= 12 then - minetest.remove_node(pos) + if node.name == "mcl_core:ice" then + mcl_core.melt_ice(pos) + else + minetest.remove_node(pos) + end end end }) @@ -1206,6 +1210,19 @@ function mcl_core.check_vines_supported(pos, node) return supported end +-- Melt ice at pos. mcl_core:ice MUST be a post if you call this! +function mcl_core.melt_ice(pos) + -- Create a water source if ice is destroyed and there was something below it + local below = {x=pos.x, y=pos.y-1, z=pos.z} + local belownode = minetest.get_node(below) + local dim = mcl_worlds.pos_to_dimension(below) + if dim ~= "nether" and belownode.name ~= "air" and belownode.name ~= "ignore" and belownode.name ~= "mcl_core:void" then + minetest.set_node(pos, {name="mcl_core:water_source"}) + else + minetest.remove_node(pos) + end +end + ---- FUNCTIONS FOR SNOWED NODES ---- -- These are nodes which change their appearence when they are below a snow cover -- and turn back into “normal” when the snow cover is removed. diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 9062c8e71..50c1d1cc7 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -781,13 +781,7 @@ minetest.register_node("mcl_core:ice", { sounds = mcl_sounds.node_sound_glass_defaults(), node_dig_prediction = "mcl_core:water_source", after_dig_node = function(pos, oldnode) - -- Create a water source if ice is destroyed and there was something below it - local below = {x=pos.x, y=pos.y-1, z=pos.z} - local belownode = minetest.get_node(below) - local dim = mcl_worlds.pos_to_dimension(below) - if dim ~= "nether" and belownode.name ~= "air" and belownode.name ~= "ignore" and belownode.name ~= "mcl_core:void" then - minetest.set_node(pos, {name="mcl_core:water_source"}) - end + mcl_core.melt_ice(pos) end, _mcl_blast_resistance = 2.5, _mcl_hardness = 0.5,