forked from VoxeLibre/VoxeLibre
Generate end exit portal near the spawn in the End
This commit is contained in:
parent
71be25f44a
commit
fc17303b1e
|
@ -336,9 +336,11 @@ minetest.register_abm({
|
||||||
|
|
||||||
-- Teleport
|
-- Teleport
|
||||||
obj:set_pos(target)
|
obj:set_pos(target)
|
||||||
-- Look towards the End island
|
if obj:is_player() then
|
||||||
if obj:is_player() and dim ~= "end" then
|
-- Look towards the End island
|
||||||
obj:set_look_horizontal(math.pi/2)
|
if dim ~= "end" then
|
||||||
|
obj:set_look_horizontal(math.pi/2)
|
||||||
|
end
|
||||||
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16})
|
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,6 +43,13 @@ local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
|
|
||||||
local WITCH_HUT_HEIGHT = 3 -- Exact Y level to spawn witch huts at. This height refers to the height of the floor
|
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. This is temporary.
|
||||||
|
-- TODO: Remove the exit portal generation when the ender dragon has been implemented.
|
||||||
|
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
|
||||||
|
|
||||||
-- Content IDs
|
-- Content IDs
|
||||||
local c_bedrock = minetest.get_content_id("mcl_core:bedrock")
|
local c_bedrock = minetest.get_content_id("mcl_core:bedrock")
|
||||||
local c_obsidian = minetest.get_content_id("mcl_core:obsidian")
|
local c_obsidian = minetest.get_content_id("mcl_core:obsidian")
|
||||||
|
@ -1333,6 +1340,22 @@ local function generate_structures(minp, maxp, seed, biomemap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- End exit portal
|
||||||
|
elseif 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
|
||||||
|
local built = false
|
||||||
|
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
|
||||||
|
mcl_structures.call_struct(p, "end_exit_portal")
|
||||||
|
built = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not built then
|
||||||
|
mcl_structures.call_struct(END_EXIT_PORTAL_POS, "end_exit_portal")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ mcl_structures.call_struct = function(pos, struct_style, rotation)
|
||||||
return mcl_structures.generate_boulder(pos, rotation)
|
return mcl_structures.generate_boulder(pos, rotation)
|
||||||
elseif struct_style == "fossil" then
|
elseif struct_style == "fossil" then
|
||||||
return mcl_structures.generate_fossil(pos, rotation)
|
return mcl_structures.generate_fossil(pos, rotation)
|
||||||
|
elseif struct_style == "end_exit_portal" then
|
||||||
|
return mcl_structures.generate_end_exit_portal(pos, rotation)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -116,6 +118,11 @@ mcl_structures.generate_fossil = function(pos)
|
||||||
return minetest.place_schematic(newpos, path, "random", nil, true)
|
return minetest.place_schematic(newpos, path, "random", nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_structures.generate_end_exit_portal = function(pos)
|
||||||
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
|
||||||
|
return minetest.place_schematic(pos, path, "0", nil, true)
|
||||||
|
end
|
||||||
|
|
||||||
mcl_structures.generate_desert_temple = function(pos)
|
mcl_structures.generate_desert_temple = function(pos)
|
||||||
-- No Generating for the temple ... Why using it ? No Change
|
-- No Generating for the temple ... Why using it ? No Change
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_temple.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_temple.mts"
|
||||||
|
@ -194,7 +201,7 @@ end
|
||||||
|
|
||||||
-- Debug command
|
-- Debug command
|
||||||
minetest.register_chatcommand("spawnstruct", {
|
minetest.register_chatcommand("spawnstruct", {
|
||||||
params = "desert_temple | desert_well | igloo | village | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil",
|
params = "desert_temple | desert_well | igloo | village | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal",
|
||||||
description = "Generate a pre-defined structure near your position.",
|
description = "Generate a pre-defined structure near your position.",
|
||||||
privs = {debug = true},
|
privs = {debug = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
@ -230,6 +237,9 @@ minetest.register_chatcommand("spawnstruct", {
|
||||||
elseif param == "ice_spike_large" then
|
elseif param == "ice_spike_large" then
|
||||||
mcl_structures.generate_ice_spike_large(pos)
|
mcl_structures.generate_ice_spike_large(pos)
|
||||||
minetest.chat_send_player(name, "Large ice spike placed.")
|
minetest.chat_send_player(name, "Large ice spike placed.")
|
||||||
|
elseif param == "end_exit_portal" then
|
||||||
|
mcl_structures.generate_end_exit_portal(pos)
|
||||||
|
minetest.chat_send_player(name, "End exit portal placed.")
|
||||||
elseif param == "" then
|
elseif param == "" then
|
||||||
minetest.chat_send_player(name, "Error: No structure type given. Please use “/spawnstruct <type>”.")
|
minetest.chat_send_player(name, "Error: No structure type given. Please use “/spawnstruct <type>”.")
|
||||||
errord = true
|
errord = true
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue