Page 1 of 1

Bulk Teleport

PostPosted: Tue Jun 07, 2016 00:59
by basil60
Hi

is there, or is there anyway, to bulk teleport a bunch of players in Minetest?

I'm think of the education sphere, where you might want to bring kids to a central point.

I believe Minecraft Edu has something similar.

Basil

Re: Bulk Teleport

PostPosted: Tue Jun 07, 2016 16:44
by Krock
If there's no mod which does this job yet, you can simply create one.
Here an example code to add a chat command, read your position and teleport all players to you:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_chatcommand("tp2me", {
   params = "",
   description = "Teleports all players to you",
   privs = {teleport=true},
   func = function(name, param)
      local player_me = minetest.get_player_by_name(name)
      local pos_me = player_me:getpos()
      
      for _,player in ipairs(minetest.get_connected_players()) do
         local player_name = player:get_player_name()
         local player_privs = minetest.get_player_privs(player_name)
         
         -- Ignore players with teleport privilege (= yourself too)
         if not player_privs["teleport"] then
            player:setpos(pos_me)
         end
      end
   end
})

Re: Bulk Teleport

PostPosted: Mon Jun 13, 2016 01:45
by basil60
Thanks
I'll test as soon as I can.
Appreciate your help

Re: Bulk Teleport

PostPosted: Thu Jun 16, 2016 00:36
by basil60
Spot on - seems to work perfectly. Yet to test with larger numbers of players - but a handy tool with lots of promise.
Thanks Krock