Fix water- and mudlogged roots, add w. logging abm
This commit is contained in:
parent
f003aefe19
commit
e8fc56ab33
|
@ -1,5 +1,6 @@
|
||||||
|
local S = minetest.get_translator("mcl_mangrove")
|
||||||
|
|
||||||
local S = minetest.get_translator("mcl_core")
|
local leafdecay_distance = 4
|
||||||
|
|
||||||
local register_tree_trunk = function(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark)
|
local register_tree_trunk = function(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark)
|
||||||
minetest.register_node("mcl_mangrove:"..subname, {
|
minetest.register_node("mcl_mangrove:"..subname, {
|
||||||
|
@ -310,9 +311,7 @@ minetest.register_node("mcl_mangrove:mangrove_roots", {
|
||||||
mesh = "node.obj",
|
mesh = "node.obj",
|
||||||
groups = {
|
groups = {
|
||||||
handy = 1, hoey = 1, shearsy = 1, axey = 1, swordy = 1, dig_by_piston = 0,
|
handy = 1, hoey = 1, shearsy = 1, axey = 1, swordy = 1, dig_by_piston = 0,
|
||||||
leaves = 1, leafdecay = leafdecay_distance, deco_block = 1,
|
leaves = 1, deco_block = 1,flammable = 10, fire_encouragement = 30, fire_flammability = 60, compostability = 30
|
||||||
flammable = 10, fire_encouragement = 30, fire_flammability = 60,
|
|
||||||
compostability = 30
|
|
||||||
},
|
},
|
||||||
drop = "mcl_mangrove:mangrove_roots",
|
drop = "mcl_mangrove:mangrove_roots",
|
||||||
_mcl_shears_drop = true,
|
_mcl_shears_drop = true,
|
||||||
|
@ -609,9 +608,7 @@ minetest.register_node("mcl_mangrove:water_logged_roots", {
|
||||||
drop = "mcl_mangrove:mangrove_roots",
|
drop = "mcl_mangrove:mangrove_roots",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = {
|
groups = {
|
||||||
handy = 1, hoey = 1, shearsy = 1, swordy = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1,
|
handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 },
|
||||||
leaves = 1, leafdecay = leafdecay_distance, deco_block = 1, not_in_creative_inventory=1, fire_encouragement = 0, fire_flammability = 0,
|
|
||||||
},
|
|
||||||
_mcl_blast_resistance = 100,
|
_mcl_blast_resistance = 100,
|
||||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||||
_mcl_hardness = -1,
|
_mcl_hardness = -1,
|
||||||
|
@ -683,6 +680,29 @@ minetest.register_node("mcl_mangrove:hanging_propagule_1", {
|
||||||
wield_image = "mcl_mangrove_propagule.png",
|
wield_image = "mcl_mangrove_propagule.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local adjacents = {
|
||||||
|
vector.new(1,0,0),
|
||||||
|
vector.new(-1,0,0),
|
||||||
|
vector.new(0,0,1),
|
||||||
|
vector.new(0,0,-1),
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
label = "Waterlog mangrove roots",
|
||||||
|
nodenames = {"mcl_mangrove:mangrove_roots"},
|
||||||
|
neighbors = {"mcl_core:water_source"},
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
------------tree_growth_abm------------
|
------------tree_growth_abm------------
|
||||||
|
|
||||||
local propagule_nodes = {
|
local propagule_nodes = {
|
||||||
|
|
|
@ -2562,6 +2562,7 @@ local warm_oceans = {
|
||||||
"Jungle_ocean",
|
"Jungle_ocean",
|
||||||
"Desert_ocean",
|
"Desert_ocean",
|
||||||
"JungleM_ocean",
|
"JungleM_ocean",
|
||||||
|
"MangroveSwamp_ocean"
|
||||||
}
|
}
|
||||||
local corals = {
|
local corals = {
|
||||||
"brain",
|
"brain",
|
||||||
|
@ -3026,6 +3027,7 @@ local function register_decorations()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
|
name = "mcl_biomes:mangrove_tree_1",
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
place_on = {"mcl_mud:mud"},
|
place_on = {"mcl_mud:mud"},
|
||||||
sidelen = 80,
|
sidelen = 80,
|
||||||
|
@ -3038,6 +3040,7 @@ local function register_decorations()
|
||||||
rotation = "random",
|
rotation = "random",
|
||||||
})
|
})
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
|
name = "mcl_biomes:mangrove_tree_2",
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
place_on = {"mcl_mud:mud"},
|
place_on = {"mcl_mud:mud"},
|
||||||
sidelen = 80,
|
sidelen = 80,
|
||||||
|
@ -3050,6 +3053,7 @@ local function register_decorations()
|
||||||
rotation = "random",
|
rotation = "random",
|
||||||
})
|
})
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
|
name = "mcl_biomes:mangrove_tree_3",
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
place_on = {"mcl_mud:mud"},
|
place_on = {"mcl_mud:mud"},
|
||||||
sidelen = 80,
|
sidelen = 80,
|
||||||
|
@ -3062,6 +3066,43 @@ local function register_decorations()
|
||||||
rotation = "random",
|
rotation = "random",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = {"mcl_mud:mud"},
|
||||||
|
sidelen = 80,
|
||||||
|
fill_ratio = 0.045,
|
||||||
|
biomes = {"MangroveSwamp","MangroveSwamp_shore"},
|
||||||
|
y_min = 0,
|
||||||
|
y_max = 0,
|
||||||
|
decoration = "mcl_mangrove:water_logged_roots",
|
||||||
|
flags = "place_center_x, place_center_z, force_placement",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = {"mcl_mangrove:mangrove_roots"},
|
||||||
|
spawn_by = {"mcl_core:water_source"},
|
||||||
|
num_spawn_by = 2,
|
||||||
|
sidelen = 80,
|
||||||
|
fill_ratio = 10,
|
||||||
|
biomes = {"MangroveSwamp","MangroveSwamp_shore"},
|
||||||
|
y_min = 0,
|
||||||
|
y_max = 0,
|
||||||
|
decoration = "mcl_mangrove:water_logged_roots",
|
||||||
|
flags = "place_center_x, place_center_z, force_placement, all_ceilings",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = {"mcl_mud:mud"},
|
||||||
|
sidelen = 80,
|
||||||
|
fill_ratio = 0.045,
|
||||||
|
biomes = {"MangroveSwamp","MangroveSwamp_shore"},
|
||||||
|
place_offset_y = -1,
|
||||||
|
decoration = "mcl_mangrove:mangrove_mud_roots",
|
||||||
|
flags = "place_center_x, place_center_z, force_placement",
|
||||||
|
})
|
||||||
|
|
||||||
-- Jungle tree
|
-- Jungle tree
|
||||||
|
|
||||||
-- Huge jungle tree (2 variants)
|
-- Huge jungle tree (2 variants)
|
||||||
|
@ -4810,14 +4851,38 @@ if mg_name ~= "singlenode" then
|
||||||
minetest.get_decoration_id("mcl_biomes:warped_tree2"),
|
minetest.get_decoration_id("mcl_biomes:warped_tree2"),
|
||||||
minetest.get_decoration_id("mcl_biomes:warped_tree3")
|
minetest.get_decoration_id("mcl_biomes:warped_tree3")
|
||||||
}
|
}
|
||||||
|
local deco_ids_trees = {
|
||||||
|
minetest.get_decoration_id("mcl_biomes:mangrove_tree_1"),
|
||||||
|
minetest.get_decoration_id("mcl_biomes:mangrove_tree_2"),
|
||||||
|
minetest.get_decoration_id("mcl_biomes:mangrove_tree_3"),
|
||||||
|
}
|
||||||
for _,f in pairs(deco_ids_fungus) do
|
for _,f in pairs(deco_ids_fungus) do
|
||||||
minetest.set_gen_notify({decoration=true}, { f })
|
minetest.set_gen_notify({decoration=true}, { f })
|
||||||
end
|
end
|
||||||
if deco_id_chorus_plant or deco_id_crimson_tree or deco_id_warped_tree then
|
for _,f in pairs(deco_ids_trees) do
|
||||||
|
minetest.set_gen_notify({decoration=true}, { f })
|
||||||
|
end
|
||||||
|
if deco_id_chorus_plant or deco_ids_fungus or deco_ids_trees then
|
||||||
mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
|
mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
|
||||||
if minp.y > -26900 then return end
|
|
||||||
local gennotify = minetest.get_mapgen_object("gennotify")
|
local gennotify = minetest.get_mapgen_object("gennotify")
|
||||||
local pr = PseudoRandom(blockseed + 14)
|
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"})
|
||||||
|
for _,v in pairs(nn) do
|
||||||
|
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,-10,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
|
||||||
|
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(v,0,0,0),vector.offset(v,0,-10,0),{"mcl_mud:mud"}),{name="mcl_mangrove:mud_roots"})
|
||||||
|
end
|
||||||
|
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,-10,0),{"air"}),{name="mcl_mangrove:mangrove_roots"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if minp.y > -26900 then return end
|
||||||
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
|
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
|
||||||
local x, y, z = pos.x, pos.y, pos.z
|
local x, y, z = pos.x, pos.y, pos.z
|
||||||
if x < -2 or x > 2 or z < -2 or z > 2 then
|
if x < -2 or x > 2 or z < -2 or z > 2 then
|
||||||
|
|
Loading…
Reference in New Issue