Fix ice not melting properly by non-Sun light

This commit is contained in:
Wuzzy 2019-06-02 10:12:36 +02:00
parent 23630bbac0
commit 6e9d712c5e
2 changed files with 19 additions and 8 deletions

View File

@ -1175,9 +1175,13 @@ minetest.register_abm({
chance = 8,
action = function(pos, node)
if minetest.get_node_light(pos, 0) >= 12 then
if node.name == "mcl_core:ice" then
mcl_core.melt_ice(pos)
else
minetest.remove_node(pos)
end
end
end
})
--[[ Call this for vines nodes only.
@ -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.

View File

@ -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,