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"
|
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"),
|
description = ("water_logged_mangrove_roots"),
|
||||||
_doc_items_entry_name = S("water_logged_roots"),
|
_doc_items_entry_name = S("water_logged_roots"),
|
||||||
_doc_items_longdesc =
|
_doc_items_longdesc =
|
||||||
|
@ -618,7 +618,16 @@ minetest.register_node("mcl_mangrove:water_logged_roots", {
|
||||||
minetest.set_node(pos, {name="mcl_core:water_source"})
|
minetest.set_node(pos, {name="mcl_core:water_source"})
|
||||||
end
|
end
|
||||||
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
|
if minetest.get_modpath("mcl_mud") then
|
||||||
|
@ -690,17 +699,23 @@ local adjacents = {
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Waterlog mangrove roots",
|
label = "Waterlog mangrove roots",
|
||||||
nodenames = {"mcl_mangrove:mangrove_roots"},
|
nodenames = {"mcl_mangrove:mangrove_roots"},
|
||||||
neighbors = {"mcl_core:water_source"},
|
neighbors = {"group:water"},
|
||||||
interval = 5,
|
interval = 5,
|
||||||
chance = 5,
|
chance = 5,
|
||||||
action = function(pos,value)
|
action = function(pos,value)
|
||||||
for _,v in pairs(adjacents) do
|
for _,v in pairs(adjacents) do
|
||||||
if minetest.get_node(vector.add(pos,v)).name == "mcl_core:water_source" then
|
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"})
|
minetest.swap_node(pos,{name="mcl_mangrove:water_logged_roots"})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
------------tree_growth_abm------------
|
------------tree_growth_abm------------
|
||||||
|
|
|
@ -3082,7 +3082,7 @@ local function register_decorations()
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
place_on = {"mcl_mangrove:mangrove_roots"},
|
place_on = {"mcl_mangrove:mangrove_roots"},
|
||||||
spawn_by = {"mcl_core:water_source"},
|
spawn_by = {"group:water"},
|
||||||
num_spawn_by = 2,
|
num_spawn_by = 2,
|
||||||
sidelen = 80,
|
sidelen = 80,
|
||||||
fill_ratio = 10,
|
fill_ratio = 10,
|
||||||
|
@ -4886,16 +4886,19 @@ if mg_name ~= "singlenode" then
|
||||||
local pr = PseudoRandom(blockseed + 14)
|
local pr = PseudoRandom(blockseed + 14)
|
||||||
for _,f in pairs(deco_ids_trees) do
|
for _,f in pairs(deco_ids_trees) do
|
||||||
for _, pos in ipairs(gennotify["decoration#"..f] or {}) 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
|
for _,v in pairs(nn) do
|
||||||
local l = pr:next(2,16)
|
local l = pr:next(2,16)
|
||||||
if minetest.get_node(vector.offset(v,0,-1,0)).name == "mcl_core:water_source" then
|
local n = minetest.get_node(vector.offset(v,0,-1,0)).name
|
||||||
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"})
|
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
|
end
|
||||||
if minetest.get_node(vector.offset(v,0,-1,0)).name == "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),{"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"})
|
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
|
elseif n == "air" then
|
||||||
if minetest.get_node(vector.offset(v,0,-1,0)).name == "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"})
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user