forked from VoxeLibre/VoxeLibre
Generate Azalea tree
This commit is contained in:
parent
eaa06289a1
commit
4aa9bdce68
|
@ -2452,6 +2452,7 @@ local function register_dimension_ores()
|
|||
end
|
||||
|
||||
local deco_id_makelake
|
||||
local deco_id_makeazalea
|
||||
-- All mapgens except mgv6
|
||||
|
||||
-- Template to register a grass or fern decoration
|
||||
|
@ -4401,6 +4402,20 @@ local function register_decorations()
|
|||
biomes = lushcaves,
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
name = "mcl_biomes:azalea_structblock",
|
||||
decoration = "mcl_lush_caves:azalea_structblock",
|
||||
deco_type = "simple",
|
||||
place_on = {"group:material_stone","mcl_core:gravel","mcl_lush_caves:moss","mcl_core:clay"},
|
||||
spawn_by = {"air"},
|
||||
num_spawn_by = 4,
|
||||
y_min = -40,
|
||||
sidelen = 16,
|
||||
fill_ratio = 10,
|
||||
flags = "place_center_x, place_center_z, force_placement, all_ceilings",
|
||||
biomes = lushcaves,
|
||||
})
|
||||
|
||||
minetest.register_decoration({
|
||||
decoration = "mcl_lush_caves:cave_vines",
|
||||
deco_type = "simple",
|
||||
|
@ -4829,6 +4844,9 @@ local function register_dimension_decorations()
|
|||
deco_id_makelake = minetest.get_decoration_id("mcl_biomes:lake_structblock")
|
||||
minetest.set_gen_notify({decoration=true}, { deco_id_makelake })
|
||||
|
||||
deco_id_makeazalea = minetest.get_decoration_id("mcl_biomes:azalea_structblock")
|
||||
minetest.set_gen_notify({decoration=true}, { deco_id_makeazalea })
|
||||
|
||||
-- TODO: End cities
|
||||
|
||||
end
|
||||
|
@ -4899,9 +4917,22 @@ if mg_name ~= "singlenode" then
|
|||
end)
|
||||
end
|
||||
|
||||
mcl_mapgen_core.register_generator("mcl_lush_caves:lakegen", nil, function(minp, maxp, blockseed)
|
||||
mcl_mapgen_core.register_generator("mcl_lush_caves", nil, function(minp, maxp, blockseed)
|
||||
local gennotify = minetest.get_mapgen_object("gennotify")
|
||||
local pr = PseudoRandom(blockseed + 15)
|
||||
|
||||
local az = false
|
||||
for _, pos in ipairs(gennotify["decoration#"..deco_id_makeazalea] or {}) do
|
||||
local realpos = vector.offset(pos,0,-1,0)
|
||||
local node = minetest.get_node(realpos)
|
||||
if node and node.name == "mcl_lush_caves:azalea_structblock" then
|
||||
minetest.remove_node(realpos)
|
||||
if not az and mcl_lush_caves.makeazaela(realpos) then
|
||||
az = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, pos in ipairs(gennotify["decoration#"..deco_id_makelake] or {}) do
|
||||
local realpos = vector.offset(pos,0,1,0)
|
||||
local node = minetest.get_node(realpos)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
local adjacents = {
|
||||
vector.new(1,0,0),
|
||||
|
@ -7,7 +9,7 @@ local adjacents = {
|
|||
vector.new(0,0,-1),
|
||||
vector.new(0,-1,0)
|
||||
}
|
||||
local vector_distance_xz = function(a, b)
|
||||
local function vector_distance_xz(a, b)
|
||||
return vector.distance(
|
||||
{ x=a.x, y=0, z=a.z },
|
||||
{ x=b.x, y=0, z=b.z }
|
||||
|
@ -40,7 +42,42 @@ function mcl_lush_caves.makelake(pos,pr)
|
|||
end
|
||||
end
|
||||
|
||||
function mcl_lush_caves.makeazaela(pos,pr)
|
||||
local airup = minetest.find_nodes_in_area_under_air(vector.offset(pos,0,40,0),pos,{"mcl_core:dirt_with_grass"})
|
||||
if #airup == 0 then
|
||||
return end
|
||||
local surface_pos = airup[1]
|
||||
local nn = minetest.find_nodes_in_area(vector.offset(pos,-4,0,-4),vector.offset(pos,4,40,4),{"group:material_stone","mcl_core:dirt","mcl_core:coarse_dirt"})
|
||||
table.sort(nn,function(a, b) return vector_distance_xz(surface_pos, a) < vector_distance_xz(surface_pos, b) end)
|
||||
minetest.set_node(pos,{name="mcl_lush_caves:rooted_dirt"})
|
||||
for i=1,math.random(1,#nn) do
|
||||
local below = vector.offset(nn[i],0,-1,0)
|
||||
minetest.set_node(nn[i],{name="mcl_lush_caves:rooted_dirt"})
|
||||
if minetest.get_node(below).name == "air" then
|
||||
minetest.set_node(below,{name = "mcl_lush_caves:hanging_roots"})
|
||||
end
|
||||
end
|
||||
for _,v in pairs(nn) do
|
||||
for _,a in pairs(adjacents) do
|
||||
local p = vector.add(v,a)
|
||||
if minetest.get_item_group(minetest.get_node(p).name,"material_stone") > 0 then
|
||||
if math.random(2) == 1 then minetest.set_node(p,{name="mcl_core:stone"}) end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.place_schematic(vector.offset(surface_pos,-2,0,-2),modpath.."/schematics/azalea1.mts","random",nil,nil,"place_center_x place_center_z")
|
||||
minetest.log("action","[mcl_lush_caves] Azalea generated at "..minetest.pos_to_string(surface_pos))
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("makeazalea",{func=function(n,p)
|
||||
local pl = minetest.get_player_by_name(n)
|
||||
local pos = pl:get_pos()
|
||||
mcl_lush_caves.makeazaela(pos)
|
||||
end})
|
||||
|
||||
minetest.register_node("mcl_lush_caves:lake_structblock", {drawtype="airlike",walkable = false,pointable=false,groups = {structblock=1,not_in_creative_inventory=1},})
|
||||
minetest.register_node("mcl_lush_caves:azalea_structblock", {drawtype="airlike",walkable = false,pointable=false,groups = {structblock=1,not_in_creative_inventory=1},})
|
||||
|
||||
minetest.register_node("mcl_lush_caves:moss", {
|
||||
description = S("Moss"),
|
||||
|
@ -320,6 +357,55 @@ minetest.register_craftitem("mcl_lush_caves:glow_berry", {
|
|||
_mcl_saturation = 1.2,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_lush_caves:azalea_leaves", {
|
||||
description = description,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "allfaces_optional",
|
||||
waving = 2,
|
||||
place_param2 = 1, -- Prevent leafdecay for placed nodes
|
||||
tiles = { "mcl_lush_caves_azalea_leaves.png" },
|
||||
paramtype = "light",
|
||||
stack_max = 64,
|
||||
groups = {
|
||||
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
|
||||
leaves = 1, leafdecay = leafdecay_distance, deco_block = 1,
|
||||
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
|
||||
compostability = 30
|
||||
},
|
||||
--drop = get_drops(0),
|
||||
_mcl_shears_drop = true,
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
_mcl_silk_touch_drop = true,
|
||||
--_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
|
||||
})
|
||||
minetest.register_node("mcl_lush_caves:azalea_leaves_flowering", {
|
||||
description = description,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_hidden = false,
|
||||
drawtype = "allfaces_optional",
|
||||
waving = 2,
|
||||
place_param2 = 1, -- Prevent leafdecay for placed nodes
|
||||
tiles = { "mcl_lush_caves_azalea_leaves_flowering.png" },
|
||||
paramtype = "light",
|
||||
stack_max = 64,
|
||||
groups = {
|
||||
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
|
||||
leaves = 1, leafdecay = leafdecay_distance, deco_block = 1,
|
||||
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
|
||||
compostability = 30
|
||||
},
|
||||
--drop = get_drops(0),
|
||||
_mcl_shears_drop = true,
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
_mcl_silk_touch_drop = true,
|
||||
--_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
Loading…
Reference in New Issue