forked from VoxeLibre/VoxeLibre
Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 into mcl-wip-refactoring
This commit is contained in:
commit
a6bceb08ee
|
@ -312,7 +312,7 @@ function mcl_experience.add_experience(player, experience)
|
|||
temp_pool.xp = math.min(math.max(temp_pool.xp + experience, 0), max_xp)
|
||||
|
||||
if (temp_pool.xp < temp_pool.xp_next_level) and (temp_pool.xp >= old_xp) then
|
||||
temp_pool.bar = mcl_experience.xp_to_bar(temp_pool.xp, temp_pool.level)
|
||||
temp_pool.bar = temp_pool.bar + temp_pool.bar_step * experience
|
||||
else
|
||||
temp_pool.level = mcl_experience.xp_to_level(temp_pool.xp)
|
||||
temp_pool.bar, temp_pool.bar_step, temp_pool.xp_next_level = mcl_experience.xp_to_bar(temp_pool.xp, temp_pool.level)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
-- FIXME: Chests may appear at openings
|
||||
|
||||
mcl_dungeons = {}
|
||||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
-- Are dungeons disabled?
|
||||
|
@ -10,6 +12,11 @@ end
|
|||
local min_y = math.max(mcl_vars.mg_overworld_min, mcl_vars.mg_bedrock_overworld_max) + 1
|
||||
local max_y = mcl_vars.mg_overworld_max - 1
|
||||
|
||||
-- Calculate the number of dungeon spawn attempts
|
||||
-- In Minecraft, there 8 dungeon spawn attempts Minecraft chunk (16*256*16 = 65536 blocks).
|
||||
-- Minetest chunks don't have this size, so scale the number accordingly.
|
||||
local attempts = math.ceil(((mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE) ^ 3) / 8192) -- 63 = 80*80*80/8192
|
||||
|
||||
local dungeonsizes = {
|
||||
{ x=5, y=4, z=5},
|
||||
{ x=5, y=4, z=7},
|
||||
|
@ -91,24 +98,20 @@ if mg_name == "v6" then
|
|||
end
|
||||
|
||||
|
||||
-- Calculate the number of dungeon spawn attempts
|
||||
-- In Minecraft, there 8 dungeon spawn attempts Minecraft chunk (16*256*16 = 65536 blocks).
|
||||
-- Minetest chunks don't have this size, so scale the number accordingly.
|
||||
local attempts = math.ceil(((mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE) ^ 3) / 8192) -- 63 = 80*80*80/8192
|
||||
|
||||
local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
||||
if calls_remaining >= 1 then return end
|
||||
|
||||
local p1, p2, dim, pr = param.p1, param.p2, param.dim, param.pr
|
||||
local x, y, z = p1.x, p1.y, p1.z
|
||||
local check = not (param.dontcheck or false)
|
||||
|
||||
-- Check floor and ceiling: Must be *completely* solid
|
||||
local y_floor = y
|
||||
local y_ceiling = y + dim.y + 1
|
||||
for tx = x, x + dim.x do for tz = z, z + dim.z do
|
||||
if check then for tx = x+1, x+dim.x do for tz = z+1, z+dim.z do
|
||||
if not minetest.registered_nodes[mcl_mapgen_core.get_node({x = tx, y = y_floor , z = tz}).name].walkable
|
||||
or not minetest.registered_nodes[mcl_mapgen_core.get_node({x = tx, y = y_ceiling, z = tz}).name].walkable then return false end
|
||||
end end
|
||||
end end end
|
||||
|
||||
-- Check for air openings (2 stacked air at ground level) in wall positions
|
||||
local openings_counter = 0
|
||||
|
@ -118,36 +121,59 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
-- so entities can get through.
|
||||
local corners = {}
|
||||
|
||||
local walls = {
|
||||
-- walls along x axis (contain corners)
|
||||
{ x, x+dim.x+1, "x", "z", z },
|
||||
{ x, x+dim.x+1, "x", "z", z+dim.z+1 },
|
||||
-- walls along z axis (exclude corners)
|
||||
{ z+1, z+dim.z, "z", "x", x },
|
||||
{ z+1, z+dim.z, "z", "x", x+dim.x+1 },
|
||||
}
|
||||
local x2,z2 = x+dim.x+1, z+dim.z+1
|
||||
|
||||
for w=1, #walls do
|
||||
local wall = walls[w]
|
||||
for iter = wall[1], wall[2] do
|
||||
local pos = {}
|
||||
pos[wall[3]] = iter
|
||||
pos[wall[4]] = wall[5]
|
||||
pos.y = y+1
|
||||
|
||||
if openings[pos.x] == nil then openings[pos.x] = {} end
|
||||
local doorname1 = mcl_mapgen_core.get_node(pos).name
|
||||
pos.y = y+2
|
||||
local doorname2 = mcl_mapgen_core.get_node(pos).name
|
||||
if doorname1 == "air" and doorname2 == "air" then
|
||||
if mcl_mapgen_core.get_node({x=x, y=y+1, z=z}).name == "air" and mcl_mapgen_core.get_node({x=x, y=y+2, z=z}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
openings[pos.x][pos.z] = true
|
||||
if not openings[x] then openings[x]={} end
|
||||
openings[x][z] = true
|
||||
table.insert(corners, {x=x, z=z})
|
||||
end
|
||||
if mcl_mapgen_core.get_node({x=x2, y=y+1, z=z}).name == "air" and mcl_mapgen_core.get_node({x=x2, y=y+2, z=z}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
if not openings[x2] then openings[x2]={} end
|
||||
openings[x2][z] = true
|
||||
table.insert(corners, {x=x2, z=z})
|
||||
end
|
||||
if mcl_mapgen_core.get_node({x=x, y=y+1, z=z2}).name == "air" and mcl_mapgen_core.get_node({x=x, y=y+2, z=z2}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
if not openings[x] then openings[x]={} end
|
||||
openings[x][z2] = true
|
||||
table.insert(corners, {x=x, z=z2})
|
||||
end
|
||||
if mcl_mapgen_core.get_node({x=x2, y=y+1, z=z2}).name == "air" and mcl_mapgen_core.get_node({x=x2, y=y+2, z=z2}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
if not openings[x2] then openings[x2]={} end
|
||||
openings[x2][z2] = true
|
||||
table.insert(corners, {x=x2, z=z2})
|
||||
end
|
||||
|
||||
-- Record corners
|
||||
if wall[3] == "x" and (iter == wall[1] or iter == wall[2]) then
|
||||
table.insert(corners, {x=pos.x, z=pos.z})
|
||||
for wx = x+1, x+dim.x do
|
||||
if mcl_mapgen_core.get_node({x=wx, y=y+1, z=z}).name == "air" and mcl_mapgen_core.get_node({x=wx, y=y+2, z=z}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
if check and openings_counter > 5 then return end
|
||||
if not openings[wx] then openings[wx]={} end
|
||||
openings[wx][z] = true
|
||||
end
|
||||
if mcl_mapgen_core.get_node({x=wx, y=y+1, z=z2}).name == "air" and mcl_mapgen_core.get_node({x=wx, y=y+2, z=z2}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
if check and openings_counter > 5 then return end
|
||||
if not openings[wx] then openings[wx]={} end
|
||||
openings[wx][z2] = true
|
||||
end
|
||||
end
|
||||
for wz = z+1, z+dim.z do
|
||||
if mcl_mapgen_core.get_node({x=x, y=y+1, z=wz}).name == "air" and mcl_mapgen_core.get_node({x=x, y=y+2, z=wz}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
if check and openings_counter > 5 then return end
|
||||
if not openings[x] then openings[x]={} end
|
||||
openings[x][wz] = true
|
||||
end
|
||||
if mcl_mapgen_core.get_node({x=x2, y=y+1, z=wz}).name == "air" and mcl_mapgen_core.get_node({x=x2, y=y+2, z=wz}).name == "air" then
|
||||
openings_counter = openings_counter + 1
|
||||
if check and openings_counter > 5 then return end
|
||||
if not openings[x2] then openings[x2]={} end
|
||||
openings[x2][wz] = true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -175,6 +201,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
openings[cx][czn] = true
|
||||
openings_counter = openings_counter + 1
|
||||
if openings_counter < 5 then
|
||||
if not openings[cxn] then openings[cxn]={} end
|
||||
openings[cxn][cz] = true
|
||||
openings_counter = openings_counter + 1
|
||||
end
|
||||
|
@ -182,7 +209,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
end
|
||||
|
||||
-- Check conditions. If okay, start generating
|
||||
if openings_counter < 1 or openings_counter > 5 then return end
|
||||
if check and (openings_counter < 1 or openings_counter > 5) then return end
|
||||
|
||||
minetest.log("action","[mcl_dungeons] Placing new dungeon at "..minetest.pos_to_string({x=x,y=y,z=z}))
|
||||
-- Okay! Spawning starts!
|
||||
|
@ -196,7 +223,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
|
||||
-- We assign each position at the wall a number and each chest gets one of these numbers randomly
|
||||
local totalChests = 2 -- this code strongly relies on this number being 2
|
||||
local totalChestSlots = (dim.x-1) * (dim.z-1)
|
||||
local totalChestSlots = (dim.x + dim.z - 2) * 2
|
||||
local chestSlots = {}
|
||||
-- There is a small chance that both chests have the same slot.
|
||||
-- In that case, we give a 2nd chance for the 2nd chest to get spawned.
|
||||
|
@ -234,7 +261,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
-- Do not overwrite nodes with is_ground_content == false (e.g. bedrock)
|
||||
-- Exceptions: cobblestone and mossy cobblestone so neighborings dungeons nicely connect to each other
|
||||
local name = mcl_mapgen_core.get_node(p).name
|
||||
if name == "mcl_core:cobble" or name == "mcl_core:mossycobble" or minetest.registered_nodes[name].is_ground_content then
|
||||
if minetest.registered_nodes[name].is_ground_content or name == "mcl_core:cobble" or name == "mcl_core:mossycobble" then
|
||||
-- Floor
|
||||
if ty == y then
|
||||
if pr:next(1,4) == 1 then
|
||||
|
@ -248,16 +275,16 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
The solid blocks above the dungeon are considered as the “ceiling”.
|
||||
It is possible (but rare) for a dungeon to generate below sand or gravel. ]]
|
||||
|
||||
elseif ty > y and (tx == x or tx == maxx or (tz == z or tz == maxz)) then
|
||||
elseif tx == x or tz == z or tx == maxx or tz == maxz then
|
||||
-- Check if it's an opening first
|
||||
if (not openings[tx][tz]) or ty == maxy then
|
||||
if (ty == maxy) or (not (openings[tx] and openings[tx][tz])) then
|
||||
-- Place wall or ceiling
|
||||
minetest.swap_node(p, {name = "mcl_core:cobble"})
|
||||
elseif ty < maxy - 1 then
|
||||
-- Normally the openings are already clear, but not if it is a corner
|
||||
-- widening. Make sure to clear at least the bottom 2 nodes of an opening.
|
||||
minetest.swap_node(p, {name = "air"})
|
||||
elseif ty == maxy - 1 and mcl_mapgen_core.get_node(p).name ~= "air" then
|
||||
if name ~= "air" then minetest.swap_node(p, {name = "air"}) end
|
||||
elseif name ~= "air" then
|
||||
-- This allows for variation between 2-node and 3-node high openings.
|
||||
minetest.swap_node(p, {name = "mcl_core:cobble"})
|
||||
end
|
||||
|
@ -265,6 +292,13 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
|
||||
-- Room interiour
|
||||
else
|
||||
if (ty==y+1) and (tx==x+1 or tx==maxx-1 or tz==z+1 or tz==maxz-1) and (currentChest < totalChests + 1) and (chestSlots[currentChest] == chestSlotCounter) then
|
||||
currentChest = currentChest + 1
|
||||
table.insert(chests, {x=tx, y=ty, z=tz})
|
||||
else
|
||||
minetest.swap_node(p, {name = "air"})
|
||||
end
|
||||
|
||||
local forChest = ty==y+1 and (tx==x+1 or tx==maxx-1 or tz==z+1 or tz==maxz-1)
|
||||
|
||||
-- Place next chest at the wall (if it was its chosen wall slot)
|
||||
|
@ -272,7 +306,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
currentChest = currentChest + 1
|
||||
table.insert(chests, {x=tx, y=ty, z=tz})
|
||||
else
|
||||
minetest.swap_node(p, {name = "air"})
|
||||
--minetest.swap_node(p, {name = "air"})
|
||||
end
|
||||
if forChest then
|
||||
chestSlotCounter = chestSlotCounter + 1
|
||||
|
@ -338,9 +372,9 @@ local function dungeons_nodes(minp, maxp, blockseed)
|
|||
local pr = PseudoRandom(blockseed)
|
||||
for a=1, attempts do
|
||||
local dim = dungeonsizes[pr:next(1, #dungeonsizes)]
|
||||
local x = pr:next(minp.x, maxp.x-dim.x-2)
|
||||
local y = pr:next(ymin , ymax -dim.y-2)
|
||||
local z = pr:next(minp.z, maxp.z-dim.z-2)
|
||||
local x = pr:next(minp.x, maxp.x-dim.x-1)
|
||||
local y = pr:next(ymin , ymax -dim.y-1)
|
||||
local z = pr:next(minp.z, maxp.z-dim.z-1)
|
||||
local p1 = {x=x,y=y,z=z}
|
||||
local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1}
|
||||
minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
|
||||
|
@ -349,4 +383,13 @@ local function dungeons_nodes(minp, maxp, blockseed)
|
|||
end
|
||||
end
|
||||
|
||||
function mcl_dungeons.spawn_dungeon(p1, _, pr)
|
||||
if not p1 or not pr or not p1.x or not p1.y or not p1.z then return end
|
||||
local dim = dungeonsizes[pr:next(1, #dungeonsizes)]
|
||||
local p2 = {x = p1.x+dim.x+1, y = p1.y+dim.y+1, z = p1.z+dim.z+1}
|
||||
minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
|
||||
local param = {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true}
|
||||
minetest.emerge_area(p1, p2, ecb_spawn_dungeon, param)
|
||||
end
|
||||
|
||||
mcl_mapgen_core.register_generator("dungeons", nil, dungeons_nodes, 999999)
|
||||
|
|
|
@ -1863,7 +1863,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
|||
|
||||
for _, rec in pairs(mcl_mapgen_core.registered_generators) do
|
||||
if rec.vf then
|
||||
local lvm_used0, shadow0 = rec.vf(vm, data, data2, e1, e2, area, p1, p2, blockseed)
|
||||
local lvm_used0, shadow0 = rec.vf(vm, data, data2, p1, p2, area, p1, p2, blockseed)
|
||||
if lvm_used0 then
|
||||
lvm_used = true
|
||||
end
|
||||
|
@ -2048,8 +2048,8 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
|||
|
||||
-- Big lava seas by replacing air below a certain height
|
||||
if mcl_vars.mg_lava then
|
||||
lvm_used = set_layers(data, area, c_lava, c_air, mcl_vars.mg_overworld_min, mcl_vars.mg_lava_overworld_max, emin, emax, lvm_used, pr)
|
||||
lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, emin, emax, lvm_used, pr)
|
||||
lvm_used = set_layers(data, area, c_lava, c_air, mcl_vars.mg_overworld_min, mcl_vars.mg_lava_overworld_max, minp, maxp, lvm_used, pr)
|
||||
lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, minp, maxp, lvm_used, pr)
|
||||
end
|
||||
|
||||
-- Clay, vines, cocoas
|
||||
|
@ -2064,7 +2064,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
|||
-- Snow and sand fixes. This code implements snow consistency
|
||||
-- and fixes floating sand and cut plants.
|
||||
-- A snowy grass block must be below a top snow or snow block at all times.
|
||||
if emin.y <= mcl_vars.mg_overworld_max and emax.y >= mcl_vars.mg_overworld_min then
|
||||
if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then
|
||||
-- v6 mapgen:
|
||||
if mg_name == "v6" then
|
||||
|
||||
|
@ -2078,7 +2078,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
|||
altogether if ANY of their nodes could not be placed.
|
||||
2) Cavegen: Removes the bottom part, the upper part floats
|
||||
3) Mudflow: Same as 2) ]]
|
||||
local plants = minetest.find_nodes_in_area(emin, emax, "group:double_plant")
|
||||
local plants = minetest.find_nodes_in_area(minp, maxp, "group:double_plant")
|
||||
for n = 1, #plants do
|
||||
local node = vm:get_node_at(plants[n])
|
||||
local is_top = minetest.get_item_group(node.name, "double_plant") == 2
|
||||
|
@ -2130,12 +2130,12 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
|||
-- Nether block fixes:
|
||||
-- * Replace water with Nether lava.
|
||||
-- * Replace stone, sand dirt in v6 so the Nether works in v6.
|
||||
elseif emin.y <= mcl_vars.mg_nether_max and emax.y >= mcl_vars.mg_nether_min then
|
||||
elseif minp.y <= mcl_vars.mg_nether_max and maxp.y >= mcl_vars.mg_nether_min then
|
||||
local nodes
|
||||
if mg_name == "v6" then
|
||||
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
|
||||
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
|
||||
else
|
||||
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source"})
|
||||
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source"})
|
||||
end
|
||||
for n=1, #nodes do
|
||||
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
|
||||
|
@ -2155,12 +2155,12 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
|||
-- * Replace water with end stone or air (depending on height).
|
||||
-- * Remove stone, sand, dirt in v6 so our End map generator works in v6.
|
||||
-- * Generate spawn platform (End portal destination)
|
||||
elseif emin.y <= mcl_vars.mg_end_max and emax.y >= mcl_vars.mg_end_min then
|
||||
elseif minp.y <= mcl_vars.mg_end_max and maxp.y >= mcl_vars.mg_end_min then
|
||||
local nodes, node
|
||||
if mg_name == "v6" then
|
||||
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
|
||||
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
|
||||
else
|
||||
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source"})
|
||||
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source"})
|
||||
end
|
||||
if #nodes > 0 then
|
||||
lvm_used = true
|
||||
|
|
|
@ -92,10 +92,10 @@ mcl_structures.call_struct = function(pos, struct_style, rotation, pr)
|
|||
end
|
||||
end
|
||||
|
||||
mcl_structures.generate_desert_well = function(pos)
|
||||
mcl_structures.generate_desert_well = function(pos, rot)
|
||||
local newpos = {x=pos.x,y=pos.y-2,z=pos.z}
|
||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_well.mts"
|
||||
return mcl_structures.place_schematic(newpos, path, "0", nil, true)
|
||||
return mcl_structures.place_schematic(newpos, path, rot or "0", nil, true)
|
||||
end
|
||||
|
||||
mcl_structures.generate_igloo = function(pos, rotation, pr)
|
||||
|
@ -265,7 +265,7 @@ mcl_structures.generate_boulder = function(pos, rotation, pr)
|
|||
|
||||
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
|
||||
|
||||
return minetest.place_schematic(newpos, path) -- don't serialize schematics for registered biome decorations, for MT 5.4.0, https://github.com/minetest/minetest/issues/10995
|
||||
return minetest.place_schematic(newpos, path, rotation) -- don't serialize schematics for registered biome decorations, for MT 5.4.0, https://github.com/minetest/minetest/issues/10995
|
||||
end
|
||||
|
||||
local function hut_placement_callback(p1, p2, size, orientation, pr)
|
||||
|
@ -284,14 +284,14 @@ mcl_structures.generate_witch_hut = function(pos, rotation, pr)
|
|||
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, hut_placement_callback, pr)
|
||||
end
|
||||
|
||||
mcl_structures.generate_ice_spike_small = function(pos)
|
||||
mcl_structures.generate_ice_spike_small = function(pos, rotation)
|
||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_small.mts"
|
||||
return minetest.place_schematic(pos, path, "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
|
||||
return minetest.place_schematic(pos, path, rotation or "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
|
||||
end
|
||||
|
||||
mcl_structures.generate_ice_spike_large = function(pos)
|
||||
mcl_structures.generate_ice_spike_large = function(pos, rotation)
|
||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_large.mts"
|
||||
return minetest.place_schematic(pos, path, "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
|
||||
return minetest.place_schematic(pos, path, rotation or "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
|
||||
end
|
||||
|
||||
mcl_structures.generate_fossil = function(pos, rotation, pr)
|
||||
|
@ -309,12 +309,12 @@ mcl_structures.generate_fossil = function(pos, rotation, pr)
|
|||
}
|
||||
local r = pr:next(1, #fossils)
|
||||
local path = minetest.get_modpath("mcl_structures").."/schematics/"..fossils[r]
|
||||
return mcl_structures.place_schematic(newpos, path, "random", nil, true)
|
||||
return mcl_structures.place_schematic(newpos, path, rotation or "random", nil, true)
|
||||
end
|
||||
|
||||
mcl_structures.generate_end_exit_portal = function(pos)
|
||||
mcl_structures.generate_end_exit_portal = function(pos, rot)
|
||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
|
||||
return mcl_structures.place_schematic(pos, path, "0", nil, true)
|
||||
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
||||
end
|
||||
|
||||
local function shrine_placement_callback(p1, p2, size, rotation, pr)
|
||||
|
@ -401,7 +401,7 @@ mcl_structures.generate_end_portal_shrine = function(pos, rotation, pr)
|
|||
local newpos = { x = pos.x - offset.x, y = pos.y, z = pos.z - offset.z }
|
||||
|
||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_portal_room_simple.mts"
|
||||
mcl_structures.place_schematic(newpos, path, "0", nil, true, nil, shrine_placement_callback, pr)
|
||||
mcl_structures.place_schematic(newpos, path, rotation or "0", nil, true, nil, shrine_placement_callback, pr)
|
||||
end
|
||||
|
||||
local function temple_placement_callback(p1, p2, size, rotation, pr)
|
||||
|
@ -488,7 +488,7 @@ mcl_structures.generate_desert_temple = function(pos, rotation, pr)
|
|||
if newpos == nil then
|
||||
return
|
||||
end
|
||||
mcl_structures.place_schematic(newpos, path, "random", nil, true, nil, temple_placement_callback, pr)
|
||||
mcl_structures.place_schematic(newpos, path, rotation or "random", nil, true, nil, temple_placement_callback, pr)
|
||||
end
|
||||
|
||||
local registered_structures = {}
|
||||
|
@ -534,7 +534,7 @@ end
|
|||
|
||||
-- Debug command
|
||||
minetest.register_chatcommand("spawnstruct", {
|
||||
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine",
|
||||
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | dungeon",
|
||||
description = S("Generate a pre-defined structure near your position."),
|
||||
privs = {debug = true},
|
||||
func = function(name, param)
|
||||
|
@ -551,7 +551,7 @@ minetest.register_chatcommand("spawnstruct", {
|
|||
if param == "desert_temple" then
|
||||
mcl_structures.generate_desert_temple(pos, rot, pr)
|
||||
elseif param == "desert_well" then
|
||||
mcl_structures.generate_desert_well(pos, rot, pr)
|
||||
mcl_structures.generate_desert_well(pos, rot)
|
||||
elseif param == "igloo" then
|
||||
mcl_structures.generate_igloo(pos, rot, pr)
|
||||
elseif param == "witch_hut" then
|
||||
|
@ -568,6 +568,8 @@ minetest.register_chatcommand("spawnstruct", {
|
|||
mcl_structures.generate_end_exit_portal(pos, rot, pr)
|
||||
elseif param == "end_portal_shrine" then
|
||||
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
||||
elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then
|
||||
mcl_dungeons.spawn_dungeon(pos, rot, pr)
|
||||
elseif param == "" then
|
||||
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
|
||||
errord = true
|
||||
|
|
Loading…
Reference in New Issue