Force emerge the target area.

We can likely remove the teleport hacks after this, but
I'll leave them in to be sure for now. This method works
well for me in another mod.
This commit is contained in:
Auke Kok 2016-04-16 20:38:03 -07:00
parent 21bf447cd0
commit b5a626e02a
1 changed files with 6 additions and 0 deletions

View File

@ -123,6 +123,12 @@ minetest.register_abm({
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local target = minetest.string_to_pos(meta:get_string("target")) local target = minetest.string_to_pos(meta:get_string("target"))
if target then if target then
-- force emerge of target area
minetest.get_voxel_manip():read_from_map(target, target)
if not minetest.get_node_or_nil(target) then
minetest.emerge_area(vector.subtract(target, 80), vector.add(target, 80))
end
-- teleport the player
minetest.after(3, function(obj, pos, target) minetest.after(3, function(obj, pos, target)
local objpos = obj:getpos() local objpos = obj:getpos()
objpos.y = objpos.y+0.1 -- Fix some glitches at -8000 objpos.y = objpos.y+0.1 -- Fix some glitches at -8000