Setup a "teleport to" point

Post Reply
User avatar
Visitor247
Member
Posts: 19
Joined: Tue Dec 03, 2019 11:09

Setup a "teleport to" point

by Visitor247 » Post

Hi,
Is there a way or a mod that can do the following.
My students are creating things, or doing tasks. I want to visit the results when no one is on the server.
Maybe they can set something with their name on, where I can teleport to?

Is there a way to find places when the player is not online?
Will it help if the players use the Area Mod?
Last edited by Visitor247 on Wed Dec 04, 2019 18:18, edited 1 time in total.

User avatar
Visitor247
Member
Posts: 19
Joined: Tue Dec 03, 2019 11:09

Re: Setup a "teleport to" point

by Visitor247 » Post

I just found "Points of Interest". It sounds if it is what I need. !?

User avatar
Krock
Developer
Posts: 4570
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Setup a "teleport to" point

by Krock » Post

EDIT2:
Okay. This is a little bit hacky. Let's abuse the sethome mod.
1) Create an empty file called "homes" (no file extension) in your world directory
2) Add the following code to the bottom of sethome/init.lua: (quote post to preserve tabs)

Code: Select all

-- CUSTOM MODIFICATION START
sethome.set = function(name, pos)
	local player = minetest.get_player_by_name(name)
	if not player or not pos then
		return false
	end
	player:set_attribute("sethome:home", minetest.pos_to_string(pos))

	-- ADD! `name` to the old storage file
	local data = {}
	local output = io.open(homes_file, "w")
	if output then
		homepos[name] = vector.new(pos)
		for i, v in pairs(homepos) do
			table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, i))
		end
		output:write(table.concat(data))
		io.close(output)
		return true
	end
	return true -- if the file doesn't exist - don't return an error.
end

sethome.get = function(name)
	local player = minetest.get_player_by_name(name)
	-- Player may also be offline
	local pos = player and minetest.string_to_pos(player:get_attribute("sethome:home"))
	if pos then
		return pos
	end

	-- fetch old entry from storage table
	pos = homepos[name]
	if pos then
		return vector.new(pos)
	else
		return nil
	end
end

minetest.register_chatcommand("student_home", {
	-- Require server privilege to use this cmd
	privs = {server = true},
	func = function(name, dst_name)
		local pos = sethome.get(dst_name)
		local player = minetest.get_player_by_name(name)
		if player and pos then
			player:set_pos(pos)
			return true, S("Teleported to home!")
		end
		return false, S("Player not found!")
	end,
})

-- CUSTOM MODIFICATION END
3) Tell your players to use /sethome again to add it to the file.
4) Use "/student_home Lucifer44" to teleport to someone's home
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Sokomine
Member
Posts: 4159
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Setup a "teleport to" point

by Sokomine » Post

Or just use my travelnet mod in combination with a hub (=place where everyone places one station). That way, the students may also visit each other.
A list of my mods can be found here.

User avatar
Visitor247
Member
Posts: 19
Joined: Tue Dec 03, 2019 11:09

Re: Setup a "teleport to" point

by Visitor247 » Post

Thanks everyone, but Points of Interest it was.
I set the Categories to the names of my classes. The students can now set PoIs with the GUI and they have to name them with their real names. Through the categories I can filter them by class.
I now can double-click a name in the GUI and am teleported to the building site of the player.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests