Move world-related functions to mcl_worlds

This commit is contained in:
Wuzzy 2017-11-24 03:10:02 +01:00
parent 06ef86ddd3
commit b0c87f74fe
35 changed files with 212 additions and 202 deletions

View file

@ -1,5 +1,5 @@
mcl_init
mcl_util
mcl_worlds
mcl_core
mcl_nether
mcl_end

View file

@ -200,7 +200,7 @@ minetest.register_abm({
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
if obj:is_player() or lua_entity then
local _, dim = mcl_util.y_to_layer(pos.y)
local dim = mcl_worlds.pos_to_dimension(pos)
local objpos = obj:getpos()
if objpos == nil then
@ -263,7 +263,7 @@ minetest.register_abm({
-- Teleport
obj:set_pos(target)
if obj:is_player() then
-- Look towards the End island
-- Look towards the main End island
if dim ~= "end" then
obj:set_look_horizontal(math.pi/2)
end

View file

@ -289,7 +289,7 @@ end
-- Returns true on success and false on failure.
function mcl_portals.light_nether_portal(pos)
-- Only allow to make portals in Overworld and Nether
local _, dim = mcl_util.y_to_layer(pos.y)
local dim = mcl_worlds.pos_to_dimension(pos)
if dim ~= "overworld" and dim ~= "nether" then
return false
end
@ -433,7 +433,7 @@ minetest.register_abm({
end
-- Teleport
obj:setpos(target)
obj:set_pos(target)
if obj:is_player() then
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16})
end
@ -469,7 +469,7 @@ minetest.override_item("mcl_core:obsidian", {
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal")
-- Achievement for finishing a Nether portal TO the Nether
local _, dim = mcl_util.y_to_layer(pos.y)
local dim = mcl_worlds.pos_to_dimension(pos)
if minetest.get_modpath("awards") and dim ~= "nether" and user:is_player() then
awards.unlock(user:get_player_name(), "mcl:buildNetherPortal")
end