Exit portal and spawn platform -> mcl_structures
This commit is contained in:
parent
52c4a7dc28
commit
1d942e9946
|
@ -163,6 +163,7 @@ mcl_vars.mg_end_min = -27073 -- Carefully chosen to be at a mapchunk border
|
||||||
mcl_vars.mg_end_max_official = mcl_vars.mg_end_min + minecraft_height_limit
|
mcl_vars.mg_end_max_official = mcl_vars.mg_end_min + minecraft_height_limit
|
||||||
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
|
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
|
||||||
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 74, z = 0 }
|
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 74, z = 0 }
|
||||||
|
mcl_vars.mg_end_exit_portal_pos = vector.new(-3, mcl_vars.mg_end_min + 72, -3)
|
||||||
|
|
||||||
-- Realm barrier used to safely separate the End from the void below the Overworld
|
-- Realm barrier used to safely separate the End from the void below the Overworld
|
||||||
mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max
|
mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max
|
||||||
|
|
|
@ -3215,7 +3215,6 @@ local function register_decorations()
|
||||||
flags = "place_center_x, place_center_z",
|
flags = "place_center_x, place_center_z",
|
||||||
rotation = "random",
|
rotation = "random",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Spruce
|
-- Spruce
|
||||||
local function quick_spruce(seed, offset, sprucename, biomes, y)
|
local function quick_spruce(seed, offset, sprucename, biomes, y)
|
||||||
if not y then
|
if not y then
|
||||||
|
|
|
@ -118,6 +118,36 @@ if string.len(mg_flags_str) > 0 then
|
||||||
end
|
end
|
||||||
minetest.set_mapgen_setting("mg_flags", mg_flags_str, true)
|
minetest.set_mapgen_setting("mg_flags", mg_flags_str, true)
|
||||||
|
|
||||||
|
local function between(x, y, z) -- x is between y and z (inclusive)
|
||||||
|
return y <= x and x <= z
|
||||||
|
end
|
||||||
|
local function in_cube(tpos,wpos1,wpos2)
|
||||||
|
local xmax=wpos2.x
|
||||||
|
local xmin=wpos1.x
|
||||||
|
|
||||||
|
local ymax=wpos2.y
|
||||||
|
local ymin=wpos1.y
|
||||||
|
|
||||||
|
local zmax=wpos2.z
|
||||||
|
local zmin=wpos1.z
|
||||||
|
if wpos1.x > wpos2.x then
|
||||||
|
xmax=wpos1.x
|
||||||
|
xmin=wpos2.x
|
||||||
|
end
|
||||||
|
if wpos1.y > wpos2.y then
|
||||||
|
ymax=wpos1.y
|
||||||
|
ymin=wpos2.y
|
||||||
|
end
|
||||||
|
if wpos1.z > wpos2.z then
|
||||||
|
zmax=wpos1.z
|
||||||
|
zmin=wpos2.z
|
||||||
|
end
|
||||||
|
if between(tpos.x,xmin,xmax) and between(tpos.y,ymin,ymax) and between(tpos.z,zmin,zmax) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- Helper function for converting a MC probability to MT, with
|
-- Helper function for converting a MC probability to MT, with
|
||||||
-- regards to MapBlocks.
|
-- regards to MapBlocks.
|
||||||
-- Some MC generated structures are generated on per-chunk
|
-- Some MC generated structures are generated on per-chunk
|
||||||
|
@ -214,23 +244,6 @@ local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_
|
||||||
return lvm_used
|
return lvm_used
|
||||||
end
|
end
|
||||||
|
|
||||||
local function generate_end_exit_portal(pos)
|
|
||||||
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._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")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function generate_structures(minp, maxp, blockseed, biomemap)
|
|
||||||
-- End exit portal
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Buffers for LuaVoxelManip
|
-- Buffers for LuaVoxelManip
|
||||||
-- local lvm_buffer = {}
|
-- local lvm_buffer = {}
|
||||||
-- local lvm_buffer_param2 = {}
|
-- local lvm_buffer_param2 = {}
|
||||||
|
@ -710,28 +723,6 @@ local function end_basic(vm, data, data2, emin, emax, area, minp, maxp, blocksee
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Obsidian spawn platform
|
|
||||||
if minp.y <= mcl_vars.mg_end_platform_pos.y and maxp.y >= mcl_vars.mg_end_platform_pos.y and
|
|
||||||
minp.x <= mcl_vars.mg_end_platform_pos.x and maxp.x >= mcl_vars.mg_end_platform_pos.z and
|
|
||||||
minp.z <= mcl_vars.mg_end_platform_pos.z and maxp.z >= mcl_vars.mg_end_platform_pos.z then
|
|
||||||
|
|
||||||
--local pos1 = {x = math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), y = math.max(minp.y, mcl_vars.mg_end_platform_pos.y), z = math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2)}
|
|
||||||
--local pos2 = {x = math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2), y = math.min(maxp.y, mcl_vars.mg_end_platform_pos.y+2), z = math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2)}
|
|
||||||
|
|
||||||
for x=math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2) do
|
|
||||||
for z=math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2), math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2) do
|
|
||||||
for y=math.max(minp.y, mcl_vars.mg_end_platform_pos.y), math.min(maxp.y, mcl_vars.mg_end_platform_pos.y+2) do
|
|
||||||
local p_pos = area:index(x, y, z)
|
|
||||||
if y == mcl_vars.mg_end_platform_pos.y then
|
|
||||||
data[p_pos] = c_obsidian
|
|
||||||
else
|
|
||||||
data[p_pos] = c_air
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
lvm_used = true
|
|
||||||
end
|
|
||||||
-- Final hackery: Set sun light level in the End.
|
-- Final hackery: Set sun light level in the End.
|
||||||
-- -26912 is at a mapchunk border.
|
-- -26912 is at a mapchunk border.
|
||||||
vm:set_lighting({day=15, night=15})
|
vm:set_lighting({day=15, night=15})
|
||||||
|
@ -746,24 +737,12 @@ local function end_basic(vm, data, data2, emin, emax, area, minp, maxp, blocksee
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function end_node(minp, maxp, blockseed)
|
|
||||||
if minp.y <= END_EXIT_PORTAL_POS.y and maxp.y >= END_EXIT_PORTAL_POS.y and
|
|
||||||
minp.x <= END_EXIT_PORTAL_POS.x and maxp.x >= END_EXIT_PORTAL_POS.x and
|
|
||||||
minp.z <= END_EXIT_PORTAL_POS.z and maxp.z >= END_EXIT_PORTAL_POS.z then
|
|
||||||
for y=maxp.y, minp.y, -1 do
|
|
||||||
local p = {x=END_EXIT_PORTAL_POS.x, y=y, z=END_EXIT_PORTAL_POS.z}
|
|
||||||
if minetest.get_node(p).name == "mcl_end:end_stone" then
|
|
||||||
generate_end_exit_portal(p)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
generate_end_exit_portal(END_EXIT_PORTAL_POS)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
mcl_mapgen_core.register_generator("main", basic, nil, 1, true)
|
mcl_mapgen_core.register_generator("main", basic, nil, 1, true)
|
||||||
mcl_mapgen_core.register_generator("end_fixes", end_basic, end_node, 20, true)
|
mcl_mapgen_core.register_generator("end_fixes", end_basic, nil, 20, true)
|
||||||
|
|
||||||
|
if mg_name ~= "v6" then
|
||||||
|
mcl_mapgen_core.register_generator("block_fixes", block_fixes, nil, 5, true)
|
||||||
|
end
|
||||||
|
|
||||||
mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blockseed)
|
mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blockseed)
|
||||||
local gennotify = minetest.get_mapgen_object("gennotify")
|
local gennotify = minetest.get_mapgen_object("gennotify")
|
||||||
|
@ -771,8 +750,8 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks
|
||||||
local has = false
|
local has = false
|
||||||
local poshash = minetest.hash_node_position(minp)
|
local poshash = minetest.hash_node_position(minp)
|
||||||
for _,struct in pairs(mcl_structures.registered_structures) do
|
for _,struct in pairs(mcl_structures.registered_structures) do
|
||||||
|
local pr = PseudoRandom(blockseed + 42)
|
||||||
if struct.deco_id then
|
if struct.deco_id then
|
||||||
local pr = PseudoRandom(blockseed + 42)
|
|
||||||
for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do
|
for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do
|
||||||
local realpos = vector.offset(pos,0,1,0)
|
local realpos = vector.offset(pos,0,1,0)
|
||||||
minetest.remove_node(realpos)
|
minetest.remove_node(realpos)
|
||||||
|
@ -781,6 +760,12 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks
|
||||||
has=true
|
has=true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif struct.static_pos then
|
||||||
|
for _,p in pairs(struct.static_pos) do
|
||||||
|
if in_cube(p,minp,maxp) then
|
||||||
|
mcl_structures.place_structure(p,struct,pr,blockseed)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, 100, true)
|
end, 100, true)
|
||||||
|
|
|
@ -201,28 +201,31 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it
|
||||||
sbgroups.structblock = nil
|
sbgroups.structblock = nil
|
||||||
sbgroups.structblock_lbm = 1
|
sbgroups.structblock_lbm = 1
|
||||||
else
|
else
|
||||||
minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered
|
if def.place_on then
|
||||||
def.deco = minetest.register_decoration({
|
minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered
|
||||||
name = "mcl_structures:deco_"..name,
|
def.deco = minetest.register_decoration({
|
||||||
decoration = structblock,
|
name = "mcl_structures:deco_"..name,
|
||||||
deco_type = "simple",
|
decoration = structblock,
|
||||||
place_on = def.place_on,
|
deco_type = "simple",
|
||||||
spawn_by = def.spawn_by,
|
place_on = def.place_on,
|
||||||
num_spawn_by = def.num_spawn_by,
|
spawn_by = def.spawn_by,
|
||||||
sidelen = 80,
|
num_spawn_by = def.num_spawn_by,
|
||||||
fill_ratio = def.fill_ratio,
|
sidelen = 80,
|
||||||
noise_params = def.noise_params,
|
fill_ratio = def.fill_ratio,
|
||||||
flags = flags,
|
noise_params = def.noise_params,
|
||||||
biomes = def.biomes,
|
flags = flags,
|
||||||
y_max = def.y_max,
|
biomes = def.biomes,
|
||||||
y_min = def.y_min
|
y_max = def.y_max,
|
||||||
})
|
y_min = def.y_min
|
||||||
minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups})
|
})
|
||||||
def.structblock = structblock
|
|
||||||
def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name)
|
minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups})
|
||||||
minetest.set_gen_notify({decoration=true}, { def.deco_id })
|
def.structblock = structblock
|
||||||
--catching of gennotify happens in mcl_mapgen_core
|
def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name)
|
||||||
end)
|
minetest.set_gen_notify({decoration=true}, { def.deco_id })
|
||||||
|
--catching of gennotify happens in mcl_mapgen_core
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
mcl_structures.registered_structures[name] = def
|
mcl_structures.registered_structures[name] = def
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local S = minetest.get_translator(modname)
|
||||||
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
|
||||||
|
|
||||||
|
mcl_structures.register_structure("end_spawn_obsidian_platform",{
|
||||||
|
static_pos ={mcl_vars.mg_end_platform_pos},
|
||||||
|
place_func = function(pos,def,pr)
|
||||||
|
local nn = minetest.find_nodes_in_area(vector.offset(pos,-2,0,-2),vector.offset(pos,2,0,2),{"air","mcl_end:end_stone"})
|
||||||
|
minetest.bulk_set_node(nn,{name="mcl_core:obsidian"})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
mcl_structures.register_structure("end_exit_portal",{
|
||||||
|
static_pos = { mcl_vars.mg_end_exit_portal_pos },
|
||||||
|
filenames = {
|
||||||
|
modpath.."/schematics/mcl_structures_end_exit_portal.mts"
|
||||||
|
},
|
||||||
|
after_place = function(pos,def,pr)
|
||||||
|
local nn = minetest.find_nodes_in_area(vector.offset(pos,-5,-1,-5),vector.offset(pos,5,5,5),{"mcl_end:portal_end"})
|
||||||
|
minetest.bulk_set_node(nn,{name="air"})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
mcl_structures.register_structure("end_exit_portal_open",{
|
||||||
|
--static_pos = { mcl_vars.mg_end_exit_portal_pos },
|
||||||
|
filenames = {
|
||||||
|
modpath.."/schematics/mcl_structures_end_exit_portal.mts"
|
||||||
|
},
|
||||||
|
})
|
|
@ -81,28 +81,13 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr)
|
||||||
if not rotation then
|
if not rotation then
|
||||||
rotation = "random"
|
rotation = "random"
|
||||||
end
|
end
|
||||||
if struct_style == "end_exit_portal" then
|
if struct_style == "end_gateway_portal" then
|
||||||
return mcl_structures.generate_end_exit_portal(pos, rotation)
|
|
||||||
elseif struct_style == "end_exit_portal_open" then
|
|
||||||
return mcl_structures.generate_end_exit_portal_open(pos, rotation)
|
|
||||||
elseif struct_style == "end_gateway_portal" then
|
|
||||||
return mcl_structures.generate_end_gateway_portal(pos, rotation)
|
return mcl_structures.generate_end_gateway_portal(pos, rotation)
|
||||||
elseif struct_style == "end_portal_shrine" then
|
elseif struct_style == "end_portal_shrine" then
|
||||||
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
|
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function mcl_structures.generate_end_exit_portal(pos, rot)
|
|
||||||
local path = modpath.."/schematics/mcl_structures_end_exit_portal.mts"
|
|
||||||
return mcl_structures.place_schematic(pos, path, rot or "0", {["mcl_portals:portal_end"] = "air"}, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_structures.generate_end_exit_portal_open(pos, rot)
|
|
||||||
local path = modpath.."/schematics/mcl_structures_end_exit_portal.mts"
|
|
||||||
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_structures.generate_end_gateway_portal(pos, rot)
|
function mcl_structures.generate_end_gateway_portal(pos, rot)
|
||||||
local path = modpath.."/schematics/mcl_structures_end_gateway_portal.mts"
|
local path = modpath.."/schematics/mcl_structures_end_gateway_portal.mts"
|
||||||
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
||||||
|
@ -247,6 +232,7 @@ dofile(modpath.."/woodland_mansion.lua")
|
||||||
dofile(modpath.."/ruined_portal.lua")
|
dofile(modpath.."/ruined_portal.lua")
|
||||||
dofile(modpath.."/geode.lua")
|
dofile(modpath.."/geode.lua")
|
||||||
dofile(modpath.."/pillager_outpost.lua")
|
dofile(modpath.."/pillager_outpost.lua")
|
||||||
|
dofile(modpath.."/end_spawn.lua")
|
||||||
|
|
||||||
|
|
||||||
mcl_structures.register_structure("desert_well",{
|
mcl_structures.register_structure("desert_well",{
|
||||||
|
@ -310,7 +296,7 @@ mcl_structures.register_structure("ice_spike_large",{
|
||||||
|
|
||||||
-- Debug command
|
-- Debug command
|
||||||
minetest.register_chatcommand("spawnstruct", {
|
minetest.register_chatcommand("spawnstruct", {
|
||||||
params = "end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon",
|
params = "end_gateway_portal | end_portal_shrine | nether_portal | dungeon",
|
||||||
description = S("Generate a pre-defined structure near your position."),
|
description = S("Generate a pre-defined structure near your position."),
|
||||||
privs = {debug = true},
|
privs = {debug = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
@ -324,11 +310,7 @@ minetest.register_chatcommand("spawnstruct", {
|
||||||
local pr = PseudoRandom(pos.x+pos.y+pos.z)
|
local pr = PseudoRandom(pos.x+pos.y+pos.z)
|
||||||
local errord = false
|
local errord = false
|
||||||
local message = S("Structure placed.")
|
local message = S("Structure placed.")
|
||||||
if param == "end_exit_portal" then
|
if param == "end_gateway_portal" then
|
||||||
mcl_structures.generate_end_exit_portal(pos, rot, pr)
|
|
||||||
elseif param == "end_exit_portal_open" then
|
|
||||||
mcl_structures.generate_end_exit_portal_open(pos, rot, pr)
|
|
||||||
elseif param == "end_gateway_portal" then
|
|
||||||
mcl_structures.generate_end_gateway_portal(pos, rot, pr)
|
mcl_structures.generate_end_gateway_portal(pos, rot, pr)
|
||||||
elseif param == "end_portal_shrine" then
|
elseif param == "end_portal_shrine" then
|
||||||
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
||||||
|
|
Loading…
Reference in New Issue