Merge branch 'master' into doc-refactoring
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 611 B |
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 681 B |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 695 B |
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 650 B |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 729 B |
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 733 B |
|
@ -309,7 +309,7 @@ minetest.register_node("mcl_end:chorus_plant", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Grow a complete chorus plant at pos
|
-- Grow a complete chorus plant at pos
|
||||||
mcl_end.grow_chorus_plant = function(pos, node)
|
mcl_end.grow_chorus_plant = function(pos, node, pr)
|
||||||
local flowers = { pos }
|
local flowers = { pos }
|
||||||
-- Plant initial flower (if it isn't there already)
|
-- Plant initial flower (if it isn't there already)
|
||||||
if not node then
|
if not node then
|
||||||
|
@ -321,7 +321,7 @@ mcl_end.grow_chorus_plant = function(pos, node)
|
||||||
while true do
|
while true do
|
||||||
local new_flowers_list = {}
|
local new_flowers_list = {}
|
||||||
for f=1, #flowers do
|
for f=1, #flowers do
|
||||||
local new_flowers = mcl_end.grow_chorus_plant_step(flowers[f], minetest.get_node(flowers[f]))
|
local new_flowers = mcl_end.grow_chorus_plant_step(flowers[f], minetest.get_node(flowers[f]), pr)
|
||||||
if #new_flowers > 0 then
|
if #new_flowers > 0 then
|
||||||
table.insert(new_flowers_list, new_flowers)
|
table.insert(new_flowers_list, new_flowers)
|
||||||
end
|
end
|
||||||
|
@ -340,7 +340,7 @@ end
|
||||||
|
|
||||||
-- Grow a single step of a chorus plant at pos.
|
-- Grow a single step of a chorus plant at pos.
|
||||||
-- Pos must be a chorus flower.
|
-- Pos must be a chorus flower.
|
||||||
mcl_end.grow_chorus_plant_step = function(pos, node)
|
mcl_end.grow_chorus_plant_step = function(pos, node, pr)
|
||||||
local new_flower_buds = {}
|
local new_flower_buds = {}
|
||||||
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
|
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
local node_above = minetest.get_node(above)
|
local node_above = minetest.get_node(above)
|
||||||
|
@ -396,7 +396,7 @@ mcl_end.grow_chorus_plant_step = function(pos, node)
|
||||||
|
|
||||||
if grow_chance then
|
if grow_chance then
|
||||||
local new_flowers = {}
|
local new_flowers = {}
|
||||||
local r = math.random(1, 100)
|
local r = pr:next(1, 100)
|
||||||
local age = node.param2
|
local age = node.param2
|
||||||
if r <= grow_chance then
|
if r <= grow_chance then
|
||||||
table.insert(new_flowers, above)
|
table.insert(new_flowers, above)
|
||||||
|
@ -404,13 +404,13 @@ mcl_end.grow_chorus_plant_step = function(pos, node)
|
||||||
age = age + 1
|
age = age + 1
|
||||||
local branches
|
local branches
|
||||||
if branching == false then
|
if branching == false then
|
||||||
branches = math.random(1, 4)
|
branches = pr:next(1, 4)
|
||||||
elseif branching == true then
|
elseif branching == true then
|
||||||
branches = math.random(0, 3)
|
branches = pr:next(0, 3)
|
||||||
end
|
end
|
||||||
local branch_grown = false
|
local branch_grown = false
|
||||||
for b=1, branches do
|
for b=1, branches do
|
||||||
local next_branch = math.random(1, #around)
|
local next_branch = pr:next(1, #around)
|
||||||
local branch = vector.add(pos, around[next_branch])
|
local branch = vector.add(pos, around[next_branch])
|
||||||
local below_branch = vector.add(branch, {x=0,y=-1,z=0})
|
local below_branch = vector.add(branch, {x=0,y=-1,z=0})
|
||||||
if minetest.get_node(below_branch).name == "air" then
|
if minetest.get_node(below_branch).name == "air" then
|
||||||
|
@ -457,7 +457,7 @@ minetest.register_abm({
|
||||||
interval = 35.0,
|
interval = 35.0,
|
||||||
chance = 4.0,
|
chance = 4.0,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
mcl_end.grow_chorus_plant_step(pos, node)
|
mcl_end.grow_chorus_plant_step(pos, node, pr)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -3974,9 +3974,16 @@ if mg_name ~= "singlenode" 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)
|
||||||
local gennotify = minetest.get_mapgen_object("gennotify")
|
local gennotify = minetest.get_mapgen_object("gennotify")
|
||||||
--local poslist = {}
|
--local poslist = {}
|
||||||
|
local pr = PseudoRandom(blockseed + 14)
|
||||||
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 realpos = { x = pos.x, y = pos.y + 1, z = pos.z }
|
local x, y, z = pos.x, pos.y, pos.z
|
||||||
mcl_end.grow_chorus_plant(realpos)
|
if x < -2 or x > 2 or z < -2 or z > 2 then
|
||||||
|
local realpos = { x = x, y = y + 1, z = z }
|
||||||
|
local node = minetest.get_node(realpos)
|
||||||
|
if node and node.name == "mcl_end:chorus_flower" then
|
||||||
|
mcl_end.grow_chorus_plant(realpos, node, pr)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1248,9 +1248,14 @@ local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_
|
||||||
end
|
end
|
||||||
|
|
||||||
local function generate_end_exit_portal(pos)
|
local function generate_end_exit_portal(pos)
|
||||||
local dragon_entity = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity()
|
local obj = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon")
|
||||||
|
if obj then
|
||||||
|
local dragon_entity = obj:get_luaentity()
|
||||||
dragon_entity._initial = true
|
dragon_entity._initial = true
|
||||||
dragon_entity._portal_pos = pos
|
dragon_entity._portal_pos = pos
|
||||||
|
else
|
||||||
|
minetest.log("error", "[mcl_mapgen_core] ERROR! Ender dragon doesn't want to spawn")
|
||||||
|
end
|
||||||
mcl_structures.call_struct(pos, "end_exit_portal")
|
mcl_structures.call_struct(pos, "end_exit_portal")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|