[Mod] Home GUI [home_gui] Set and go home using inventory.

Post Reply
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

[Mod] Home GUI [home_gui] Set and go home using inventory.

by cornernote » Post

Home GUI for Minetest

Set home position and then go to it using the inventory screen.

Requirements Documentation | GitHub Project

Image

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.

Sokomine
Member
Posts: 4290
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

by Sokomine » Post

Very helpful. Unfortionately it collides with the bag mod. Would it be possible to use both?
A list of my mods can be found here.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

get the latest version of bag mod, they work together just fine (thanks to inventory_plus). Same with Armor, that should just drop in too with no conflicts.

Sokomine
Member
Posts: 4290
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

by Sokomine » Post

Thanks! Very nice and helpful.
A list of my mods can be found here.

User avatar
0gb.us
Member
Posts: 841
Joined: Sun Sep 16, 2012 01:55
Location: 0gb.us:30000
Contact:

by 0gb.us » Post

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.

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})
EDIT: I might integrate your bookmakrs_gui with the /go command one of these days, when I'm not being so lazy.
Last edited by 0gb.us on Fri Nov 09, 2012 23:08, edited 1 time in total.

User avatar
TenPlus1
Member
Posts: 3728
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

by TenPlus1 » Post

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...
Attachments

[The extension lua has been deactivated and can no longer be displayed.]


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

by Krock » Post

When this already is open, I'd like to make a little correction too.
Source: https://github.com/cornernote/minetest- ... it.lua#L46

Code: Select all

output:write(math.floor(v.x).." "..math.floor(v.y).." "..math.floor(v.z).." "..k.."\n")
This will teleport players into the node below them.

Code: Select all

output:write(math.floor(v.x).." "..math.floor(v.y+0.5).." "..math.floor(v.z).." "..k.."\n")
..would solve it.

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>

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Home GUI [home_gui] Set and go home using inventor

by amadin » Post

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.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 41 guests