Fix waterlogged mangrove roots leaving water in the nether

This commit is contained in:
PrairieWind 2023-05-12 14:46:33 -06:00 committed by ancientmarinerdev
parent 6ded4d2322
commit d467b80491
3 changed files with 32 additions and 17 deletions

@ -57,6 +57,7 @@ if mod_mcl_core then
tt_help = S("Places a water source"),
extra_check = function(pos, placer)
local nn = minetest.get_node(pos).name
local dim = mcl_worlds.pos_to_dimension(pos)
-- Pour water into cauldron
if minetest.get_item_group(nn, "cauldron") ~= 0 then
-- Put water into cauldron
@ -66,17 +67,14 @@ if mod_mcl_core then
sound_place("mcl_core:water_source", pos)
return false, true
-- Put water into mangrove roots
elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" then
elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" and dim ~= "nether" then
minetest.set_node(pos, {name="mcl_mangrove:water_logged_roots"})
sound_place("mcl_core:water_source", pos)
return false, true
-- Evaporate water if used in Nether (except on cauldron)
else
local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
return false, true
end
elseif dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
return false, true
end
end,
groups = { water_bucket = 1 },
@ -96,6 +94,7 @@ if mod_mclx_core then
tt_help = S("Places a river water source"),
extra_check = function(pos, placer)
local nn = minetest.get_node(pos).name
local dim = mcl_worlds.pos_to_dimension(pos)
-- Pour into cauldron
if minetest.get_item_group(nn, "cauldron") ~= 0 then
-- Put water into cauldron
@ -105,17 +104,14 @@ if mod_mclx_core then
sound_place("mcl_core:water_source", pos)
return false, true
-- Put river water into mangrove roots
elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" then
elseif minetest.get_node(pos).name == "mcl_mangrove:mangrove_roots" and dim ~= "nether" then
minetest.set_node(pos, {name="mcl_mangrove:river_water_logged_roots"})
sound_place("mcl_core:water_source", pos)
return false, true
else
-- Evaporate water if used in Nether (except on cauldron)
local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
return false, true
end
-- Evaporate water if used in Nether (except on cauldron)
elseif dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
return false, true
end
end,
groups = { water_bucket = 1 },

@ -352,10 +352,20 @@ local wlroots = {
handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 },
_mcl_blast_resistance = 100,
_mcl_hardness = -1, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
on_construct = function(pos)
local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
minetest.set_node(pos, {name="mcl_mangrove:mangrove_roots"})
end
end,
after_dig_node = function(pos)
local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "water") == 0 then
local dim = mcl_worlds.pos_to_dimension(pos)
if minetest.get_item_group(node.name, "water") == 0 and dim ~= "nether" then
minetest.set_node(pos, {name="mcl_core:water_source"})
else
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end
end,
}
@ -369,6 +379,15 @@ rwlroots.tiles = {
"("..water_tex..")^mcl_mangrove_roots_side.png",
"("..water_tex..")^mcl_mangrove_roots_side.png",
}
rwlroots.after_dig_node = function(pos)
local node = minetest.get_node(pos)
local dim = mcl_worlds.pos_to_dimension(pos)
if minetest.get_item_group(node.name, "water") == 0 and dim ~= "nether" then
minetest.set_node(pos, {name="mclx_core:river_water_source"})
else
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end
end
minetest.register_node("mcl_mangrove:water_logged_roots", wlroots)
minetest.register_node("mcl_mangrove:river_water_logged_roots",rwlroots)

@ -1,3 +1,3 @@
name = mcl_mangrove
author = thunder1035
depends = mcl_core, mcl_doors, mcl_stairs, mcl_walls, mclx_fences, mcl_boats, mcl_flowerpots, mcl_mud, mcl_util
depends = mcl_core, mcl_doors, mcl_stairs, mcl_walls, mclx_fences, mcl_boats, mcl_flowerpots, mcl_mud, mcl_util, mcl_worlds