aestivalserver-mods/illuna_aestival/src/portal.lua

40 lines
1.9 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

-- This originally was the floatlands example portal as in https://github.com/minetest-mods/nether/blob/master/portal_examples.lua
local OTHER_WORLDS_LEVEL = 22000
nether.register_portal(
"asteroid_portal",
{
shape = nether.PortalShape_Platform,
frame_node_name = "illuna:astroportal_block",
wormhole_node_color = 5,
particle_texture = {
name = "nether_particle_anim1.png",
animation = {
type = "vertical_frames",
aspect_w = 7,
aspect_h = 7,
length = 1
},
scale = 1.5
},
title = "Asteroid Portal",
book_of_portals_pagetext = [[Ancient astro portal stones can be found at tremendous heights laying on different kinds of sand.
The portal itself requires 21 blocks of ancient astro-portal blocks, and is constructed in the shape of a 3 × 3 platform with walls, or like a bowl. A finished platform is 2 blocks high, and 5 blocks wide at the widest in both directions.
This portal is different to the others, rather than acting akin to a doorway it appears to the eye more like a small pool of water which can be stepped into. Upon setting foot in the portal we found ourselves in space.]],
is_within_realm = function(pos) -- return true if pos is inside the Nether
return pos.y > OTHER_WORLDS_LEVEL - 200
end,
find_realm_anchorPos = function(surface_anchorPos, player_name)
local destination_pos = {x = surface_anchorPos.x, y = OTHER_WORLDS_LEVEL + 2, z = surface_anchorPos.z}
local existing_portal_location, existing_portal_orientation =
nether.find_nearest_working_portal("asteroid_portal", destination_pos, 10, 0)
if existing_portal_location ~= nil then
return existing_portal_location, existing_portal_orientation
else
return destination_pos
end
end
}
)