make waterlogged roots work with river water
This commit is contained in:
parent
51f79eaa39
commit
77c878f609
|
@ -583,7 +583,7 @@ end
|
|||
local water_tex = "default_water_source_animated.png^[verticalframe:16:0"
|
||||
|
||||
|
||||
minetest.register_node("mcl_mangrove:water_logged_roots", {
|
||||
local wlroots = {
|
||||
description = ("water_logged_mangrove_roots"),
|
||||
_doc_items_entry_name = S("water_logged_roots"),
|
||||
_doc_items_longdesc =
|
||||
|
@ -618,7 +618,16 @@ minetest.register_node("mcl_mangrove:water_logged_roots", {
|
|||
minetest.set_node(pos, {name="mcl_core:water_source"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
}
|
||||
minetest.register_node("mcl_mangrove:water_logged_roots", wlroots)
|
||||
local rwlroots = table.copy(wlroots)
|
||||
water_tex = "default_river_water_source_animated.png^[verticalframe:16:0"
|
||||
rwlroots.tiles = {
|
||||
"("..water_tex..")^mcl_mangrove_roots_top.png", "("..water_tex..")^mcl_mangrove_roots_top.png",
|
||||
"("..water_tex..")^mcl_mangrove_roots_side.png", "("..water_tex..")^mcl_mangrove_roots_side.png",
|
||||
"("..water_tex..")^mcl_mangrove_roots_side.png", "("..water_tex..")^mcl_mangrove_roots_side.png"
|
||||
}
|
||||
minetest.register_node("mcl_mangrove:river_water_logged_roots",rwlroots)
|
||||
|
||||
------------------------
|
||||
if minetest.get_modpath("mcl_mud") then
|
||||
|
@ -690,14 +699,20 @@ local adjacents = {
|
|||
minetest.register_abm({
|
||||
label = "Waterlog mangrove roots",
|
||||
nodenames = {"mcl_mangrove:mangrove_roots"},
|
||||
neighbors = {"mcl_core:water_source"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 5,
|
||||
chance = 5,
|
||||
action = function(pos,value)
|
||||
for _,v in pairs(adjacents) do
|
||||
if minetest.get_node(vector.add(pos,v)).name == "mcl_core:water_source" then
|
||||
minetest.swap_node(pos,{name="mcl_mangrove:water_logged_roots"})
|
||||
return
|
||||
local n = minetest.get_node(vector.add(pos,v)).name
|
||||
if minetest.get_item_group(n,"water") > 0 then
|
||||
if n:find("river") then
|
||||
minetest.swap_node(pos,{name="mcl_mangrove:river_water_logged_roots"})
|
||||
return
|
||||
else
|
||||
minetest.swap_node(pos,{name="mcl_mangrove:water_logged_roots"})
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3082,7 +3082,7 @@ local function register_decorations()
|
|||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"mcl_mangrove:mangrove_roots"},
|
||||
spawn_by = {"mcl_core:water_source"},
|
||||
spawn_by = {"group:water"},
|
||||
num_spawn_by = 2,
|
||||
sidelen = 80,
|
||||
fill_ratio = 10,
|
||||
|
@ -4886,16 +4886,19 @@ if mg_name ~= "singlenode" then
|
|||
local pr = PseudoRandom(blockseed + 14)
|
||||
for _,f in pairs(deco_ids_trees) do
|
||||
for _, pos in ipairs(gennotify["decoration#"..f] or {}) do
|
||||
local nn=minetest.find_nodes_in_area(vector.offset(pos,-8,-1,-8),vector.offset(pos,8,2,8),{"mcl_mangrove:mangrove_roots"})
|
||||
local nn=minetest.find_nodes_in_area(vector.offset(pos,-8,-1,-8),vector.offset(pos,8,0,8),{"mcl_mangrove:mangrove_roots"})
|
||||
for _,v in pairs(nn) do
|
||||
local l = pr:next(2,16)
|
||||
if minetest.get_node(vector.offset(v,0,-1,0)).name == "mcl_core:water_source" then
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(v,0,0,0),vector.offset(v,0,-l,0),{"mcl_core:water_source"}),{name="mcl_mangrove:water_logged_roots"})
|
||||
end
|
||||
if minetest.get_node(vector.offset(v,0,-1,0)).name == "mcl_mud:mud" then
|
||||
local n = minetest.get_node(vector.offset(v,0,-1,0)).name
|
||||
if minetest.get_item_group(n,"water") > 0 then
|
||||
local wl = "mcl_mangrove:water_logged_roots"
|
||||
if n:find("river") then
|
||||
wl = "mcl_mangrove:river_water_logged_roots"
|
||||
end
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(v,0,0,0),vector.offset(v,0,-l,0),{"group:water"}),{name=wl})
|
||||
elseif n == "mcl_mud:mud" then
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(v,0,0,0),vector.offset(v,0,-l,0),{"mcl_mud:mud"}),{name="mcl_mangrove:mangrove_mud_roots"})
|
||||
end
|
||||
if minetest.get_node(vector.offset(v,0,-1,0)).name == "air" then
|
||||
elseif n == "air" then
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(v,0,0,0),vector.offset(v,0,-l,0),{"air"}),{name="mcl_mangrove:mangrove_roots"})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user