[Mod] Home GUI [home_gui] Set and go home using inventory.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
[Mod] Home GUI [home_gui] Set and go home using inventory.
Home GUI for Minetest
Set home position and then go to it using the inventory screen.
Requirements Documentation | GitHub Project
About
This module is open source, so it's distributed freely. If you find it useful then I ask not for your wealth, but simply to spare your time to consider the world we share by watching Earthlings, a multi-award winning film available to watch online for free. A must-see for anyone who wishes to make the world a better place.
License
BSD-3-Clause, Copyright © 2014 Brett O'Donnell
Set home position and then go to it using the inventory screen.
Requirements Documentation | GitHub Project
About
This module is open source, so it's distributed freely. If you find it useful then I ask not for your wealth, but simply to spare your time to consider the world we share by watching Earthlings, a multi-award winning film available to watch online for free. A must-see for anyone who wishes to make the world a better place.
License
BSD-3-Clause, Copyright © 2014 Brett O'Donnell
Last edited by cornernote on Thu Jan 16, 2014 10:57, edited 1 time in total.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
This is awesome! But some of my users prefer the commands, while others prefer the graphical interface. I tried to write a plugin that hooks into yours and adds commands, but your local variables cannot be accessed from outside your script. So I had to build a patch. Feel free to integrate it or don't, or modify it if you don't like it.
Adding this to the end of the file adds the /home and /sethome commands, both without arguments, that function as you would expect, and use the same set of home locations as the rest of your plugin. I had to do some wacky conversions, because the chat command API returns a name, but your plugin expects a player object. So, this takes a name, converts it to a player object, and passes it to your function, which immediately converts it back into a name. I should have probably come up with something more efficient, but hey, at least it works.
EDIT: I might integrate your bookmakrs_gui with the /go command one of these days, when I'm not being so lazy.
Adding this to the end of the file adds the /home and /sethome commands, both without arguments, that function as you would expect, and use the same set of home locations as the rest of your plugin. I had to do some wacky conversions, because the chat command API returns a name, but your plugin expects a player object. So, this takes a name, converts it to a player object, and passes it to your function, which immediately converts it back into a name. I should have probably come up with something more efficient, but hey, at least it works.
Code: Select all
-- Added by 0gb.us --
minetest.register_chatcommand("sethome", {
params = "",
description = "Set home location",
privs = {},
func = function(name, param)
player = minetest.env:get_player_by_name(name)
home_gui.set_home(player, player:getpos())
minetest.chat_send_player(name, "Home location set.")
end})
minetest.register_chatcommand("home", {
params = "",
description = "Go to home location",
privs = {},
func = function(name, param)
home_gui.go_home(minetest.env:get_player_by_name(name))
minetest.chat_send_player(name, "Warped to home location.")
end})
Last edited by 0gb.us on Fri Nov 09, 2012 23:08, edited 1 time in total.
Hope you dont mind but I've changed the mod slightly so that clicking the Home button automatically takes you to static_spawn or 0,0,0 if it's not set... A few newbs on the server keep getting lost and ask to take them back to spawn, this way your mod does it for me
Please find attached the new init.lua file...
Please find attached the new init.lua file...
- Attachments
-
[The extension lua has been deactivated and can no longer be displayed.]
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
When this already is open, I'd like to make a little correction too.
..would solve it.
EDIT: another suggestion: Only allow players with interact to set their home.
This will teleport players into the node below them.Source: https://github.com/cornernote/minetest- ... it.lua#L46Code: Select all
output:write(math.floor(v.x).." "..math.floor(v.y).." "..math.floor(v.z).." "..k.."\n")
Code: Select all
output:write(math.floor(v.x).." "..math.floor(v.y+0.5).." "..math.floor(v.z).." "..k.."\n")
EDIT: another suggestion: Only allow players with interact to set their home.
Last edited by Krock on Sun Feb 16, 2014 14:51, edited 1 time in total.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
Re: [Mod] Home GUI [home_gui] Set and go home using inventor
Do you can add the option (on/off) in init.lua for time limit to using home button, for example player will can use button "home" not more than once every 20 minutes. I think it is a good idea add the option to enable teleport home with a time delay. I mean if player press "Home" he will teleporting after 5 seconds timeout, it will very good for pvp servers.
Who is online
Users browsing this forum: No registered users and 21 guests