Move end exit portal to 0, 0; Add end gateway portals (WIP)
This commit is contained in:
parent
f65c40f805
commit
430f958fae
|
@ -77,6 +77,7 @@ mobs:register_mob("mobs_mc:enderdragon", {
|
|||
end,
|
||||
on_die = function(self, pos)
|
||||
if self._portal_pos then
|
||||
mcl_portals.spawn_gateway_portal()
|
||||
mcl_structures.call_struct(self._portal_pos, "end_exit_portal_open")
|
||||
if self._initial then
|
||||
mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
-- Load files
|
||||
|
||||
mcl_portals = {}
|
||||
mcl_portals = {
|
||||
storage = minetest.get_mod_storage(),
|
||||
}
|
||||
|
||||
-- Nether portal:
|
||||
-- Obsidian frame, activated by flint and steel
|
||||
|
@ -10,3 +12,5 @@ dofile(minetest.get_modpath("mcl_portals").."/portal_nether.lua")
|
|||
-- Red nether brick block frame, activated by an eye of ender
|
||||
dofile(minetest.get_modpath("mcl_portals").."/portal_end.lua")
|
||||
|
||||
dofile(minetest.get_modpath("mcl_portals").."/portal_gateway.lua")
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
local S = minetest.get_translator("mcl_portals")
|
||||
local storage = mcl_portals.storage
|
||||
|
||||
local gateway_positions = {
|
||||
{x = 96, y = -26925, z = 0},
|
||||
{x = 91, y = -26925, z = 29},
|
||||
{x = 77, y = -26925, z = 56},
|
||||
{x = 56, y = -26925, z = 77},
|
||||
{x = 29, y = -26925, z = 91},
|
||||
{x = 0, y = -26925, z = 96},
|
||||
{x = -29, y = -26925, z = 91},
|
||||
{x = -56, y = -26925, z = 77},
|
||||
{x = -77, y = -26925, z = 56},
|
||||
{x = -91, y = -26925, z = 29},
|
||||
{x = -96, y = -26925, z = 0},
|
||||
{x = -91, y = -26925, z = -29},
|
||||
{x = -77, y = -26925, z = -56},
|
||||
{x = -56, y = -26925, z = -77},
|
||||
{x = -29, y = -26925, z = -91},
|
||||
{x = 0, y = -26925, z = -96},
|
||||
{x = 29, y = -26925, z = -91},
|
||||
{x = 56, y = -26925, z = -77},
|
||||
{x = 77, y = -26925, z = -56},
|
||||
{x = 91, y = -26925, z = -29},
|
||||
}
|
||||
|
||||
function mcl_portals.spawn_gateway_portal()
|
||||
local id = storage:get_int("gateway_last_id") + 1
|
||||
local pos = gateway_positions[id]
|
||||
if not pos then return end
|
||||
storage:set_int("gateway_last_id", id)
|
||||
mcl_structures.call_struct(vector.add(pos, vector.new(-1, -2, -1)), "end_gateway_portal")
|
||||
end
|
||||
|
||||
local gateway_def = table.copy(minetest.registered_nodes["mcl_portals:portal_end"])
|
||||
gateway_def.description = S("End Gateway Portal")
|
||||
gateway_def._tt_help = S("Used to construct end gateway portals")
|
||||
gateway_def._doc_items_longdesc = S("An End gateway portal teleports creatures and objects to the outer End (and back!).")
|
||||
gateway_def._doc_items_usagehelp = S("Throw an ender pearl into the portal to teleport. Entering an Gateway portal near the Overworld teleports you to the outer End. At this destination another gateway portal will be constructed, which you can use to get back.")
|
||||
gateway_def.after_destruct = nil
|
||||
gateway_def.drawtype = "normal"
|
||||
gateway_def.node_box = nil
|
||||
gateway_def.walkable = true
|
||||
gateway_def.tiles[3] = nil
|
||||
minetest.register_node("mcl_portals:portal_gateway", gateway_def)
|
|
@ -47,7 +47,7 @@ local chatter = {}
|
|||
local queue = {}
|
||||
local chunks = {}
|
||||
|
||||
local storage = minetest.get_mod_storage()
|
||||
local storage = mcl_portals.storage
|
||||
local exits = {}
|
||||
local keys = minetest.deserialize(storage:get_string("nether_exits_keys") or "return {}") or {}
|
||||
for _, key in pairs(keys) do
|
||||
|
|
|
@ -8,12 +8,10 @@ local noisemap = PerlinNoiseMap({
|
|||
}, {x = 151, y = 30, z = 151}):get_3d_map({x = 0, y = 0, z = 0})
|
||||
|
||||
local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
|
||||
|
||||
local x_offset = mcl_vars.mg_end_platform_pos.x - 27
|
||||
local y_offset = -2
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp)
|
||||
if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < (-75 + x_offset) or minp.x > (75 + x_offset) or maxp.z < -75 or minp.z > 75 then
|
||||
if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < -75 or minp.x > 75 or maxp.z < -75 or minp.z > 75 then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -21,10 +19,10 @@ minetest.register_on_generated(function(minp, maxp)
|
|||
local data = vm:get_data()
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
|
||||
for idx in area:iter(math.max(minp.x, -75 + x_offset), math.max(minp.y, -27025 + y_offset + 4), math.max(minp.z, -75), math.min(maxp.x, 75 + x_offset), math.min(maxp.y, -27000 + y_offset), math.min(maxp.z, 75)) do
|
||||
for idx in area:iter(math.max(minp.x, -75), math.max(minp.y, -27025 + y_offset + 4), math.max(minp.z, -75), math.min(maxp.x, 75), math.min(maxp.y, -27000 + y_offset), math.min(maxp.z, 75)) do
|
||||
local pos = area:position(idx)
|
||||
local y = 27025 + pos.y - y_offset
|
||||
if noisemap[pos.x + 75 - x_offset + 1][y + 1][pos.z + 75 + 1] > (math.abs(1 - y / 25) ^ 2 + math.abs((pos.x - x_offset) / 75) ^ 2 + math.abs(pos.z / 75) ^ 2) then
|
||||
if noisemap[pos.x + 75 + 1][y + 1][pos.z + 75 + 1] > (math.abs(1 - y / 25) ^ 2 + math.abs(pos.x / 75) ^ 2 + math.abs(pos.z / 75) ^ 2) then
|
||||
data[idx] = c_end_stone
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,10 +55,7 @@ local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superfl
|
|||
local WITCH_HUT_HEIGHT = 3 -- Exact Y level to spawn witch huts at. This height refers to the height of the floor
|
||||
|
||||
-- End exit portal position
|
||||
local END_EXIT_PORTAL_POS = table.copy(mcl_vars.mg_end_platform_pos)
|
||||
END_EXIT_PORTAL_POS.x = END_EXIT_PORTAL_POS.x - 30
|
||||
END_EXIT_PORTAL_POS.z = END_EXIT_PORTAL_POS.z - 3
|
||||
END_EXIT_PORTAL_POS.y = END_EXIT_PORTAL_POS.y - 3
|
||||
local END_EXIT_PORTAL_POS = vector.new(-3, -27003, -3)
|
||||
|
||||
-- Content IDs
|
||||
local c_bedrock = minetest.get_content_id("mcl_core:bedrock")
|
||||
|
|
|
@ -89,6 +89,8 @@ mcl_structures.call_struct = function(pos, struct_style, rotation, pr)
|
|||
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)
|
||||
elseif struct_style == "end_portal_shrine" then
|
||||
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
|
||||
end
|
||||
|
@ -324,6 +326,11 @@ mcl_structures.generate_end_exit_portal_open = function(pos, rot)
|
|||
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
||||
end
|
||||
|
||||
mcl_structures.generate_end_gateway_portal = function(pos, rot)
|
||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_gateway_portal.mts"
|
||||
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
||||
end
|
||||
|
||||
local function shrine_placement_callback(p1, p2, size, rotation, pr)
|
||||
-- Find and setup spawner with silverfish
|
||||
local spawners = minetest.find_nodes_in_area(p1, p2, "mcl_mobspawners:spawner")
|
||||
|
@ -575,6 +582,8 @@ minetest.register_chatcommand("spawnstruct", {
|
|||
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)
|
||||
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
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue