[Mod] MultiHome [multihome]

Post Reply
User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

[Mod] MultiHome [multihome]

by octacian » Post

MultiHome [multihome]
Image
GitHub: octacian/multihome
Download: Master (latest, stable)

Warning: MultiHome uses important features currently only available in development builds of Minetest. In order to get MultiHome working properly, you'll need to build your own version of Minetest newer than this commit (January 26th, 2017).

MultiHome is a Minetest mod allowing players to set multiple homes rather than just one home through Minetest Game's sethome mod. MultiHome supports limiting the max number of homes per-player (default: 5) and has two compatibility layers to allow working with sethome. The chatcommands made available by MultiHome depend on the compatibility mode chosen, as shown below.

Note: If MultiHome is set to no compatibility mode, the multihome privilege is required to use MultiHome features, otherwise the home privilege from sethome is used.

Compatibility

MultiHome provides exactly two compatibility modes allowing the mod to work with homes previously created with the sethome mod. If no compatibility mode is set, the setting defaults to none and the default set of chatcommands is used. The compatibility mode can be set with multihome.compatiblity in minetest.conf, valid values being none, deprecate, and override.

The first two compatibility modes use the same chatcommand (/multihome) as documented below, however, deprecate overrides chatcommands from sethome causing them to display a message stating that they are deprecated and /multihome should be used instead. Note: If a compatibility mode is set and the sethome mod is not found, compatibility is automatically set to none.

When attempting to vist a home using any compatibility mode, if the player does not specify a home to teleport to and they only have one home, the player will be automatically teleported to that home.

Compatibility: None/Deprecate

Both the none and deprecate compatibility modes use the same chatcommand, however deprecate adds deprecation messages as mentioned above. The best way to learn how to use this /multihome chatcommand is to use the in-game help, /help multihome, however, an overview of the usage can be found below.

/multihome <action> <home name> | <set, del (delete), go, list> <home name (not required with list)>

Compatibility: Override

The override compatibility mode does not use one single chatcommand, but rather overrides the chatcommands used by sethome for use by MultiHome and registers two extras (see below).

/home <home name>: Teleport to the home specified
/sethome <home name>: Set the position of the home specified
/delhome <home name>: Delete the home specified
/listhomes: List player's homes

Importing Homes

MultiHome supports imported homes from sethome in both the deprecate and override compatibility options. Importing can be enabled by setting multihome.import = true in minetest.conf. This will cause MultiHome to automatically import homes created by sethome in the player attributes whenever a player with a home joins. MultiHome will also import homes from the `homes` file in the world directory, however, as they are imported they cannot be removed from the file but instead set an attribute on the player indicating that any old homes have already been imported and should not be overwritten. These homes will be named default in MultiHome and will be removed from the player attributes after they have been imported.
Last edited by octacian on Tue May 16, 2017 23:14, edited 3 times in total.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: [Mod] MultiHome [multihome]

by GreenXenith » Post

Yessss!
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

Chibi ghost
Member
Posts: 845
Joined: Fri Jan 08, 2016 21:17
In-game: Ghost

Re: [Mod] MultiHome [multihome]

by Chibi ghost » Post

cool nice idea before I got the teleport mod I was always loosing houses
and every now and then the teleporter bugs out and looses a location so to set a spare home location is ideal

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: [Mod] MultiHome [multihome]

by ExeterDad » Post

I'm very pleased with this one my friend :)
Especially since it's using player attributes so if and when it's time to cull out old players... the data goes with them when player files are removed.
However.. I seem to remember mention on Github that deletion of player attributes caused issues at this time. Did that get worked out and I haven't noticed?

Edit: Also MTG's newest /home also imports the homes from the homes flatfile and moves them into player attributes. Eventually the homes file will become empty. So homes that have already moved, will be missed.

Edited Edit: Okay looking closer you DO grab the homes from attributes for import, but not from the flatfile that might not of been imported yet with new MTG. Maybe include those if they exist?

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] MultiHome [multihome]

by azekill_DIABLO » Post

+1, needed on servers!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] MultiHome [multihome]

by octacian » Post

ExeterDad wrote:However.. I seem to remember mention on Github that deletion of player attributes caused issues at this time. Did that get worked out and I haven't noticed?
I was never aware that this was a problem, however, I can say that it definitely isn't at this point as everything works fine for me.
ExeterDad wrote: Edited Edit: Okay looking closer you DO grab the homes from attributes for import, but not from the flatfile that might not of been imported yet with new MTG. Maybe include those if they exist?
Just pushed an update that includes positions from the flat file. The one downfall is that I cannot easily remove the old homes from the flat file, so instead I just set another attribute on the player indicating that homes have already been imported and should not be imported again. Interestingly enough though, MTG's sethome doesn't actually import items from the file to attributes and then remove them from the file, it just reads old ones from the file and only stores new ones in attributes.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: [Mod] MultiHome [multihome]

by ExeterDad » Post

octacian wrote:I was never aware that this was a problem, however, I can say that it definitely isn't at this point as everything works fine for me.
I can't quote were I "thought'" I read about that. I likely misunderstood. Thanks for confirming :)
octacian wrote:Interestingly enough though, MTG's sethome doesn't actually import items from the file to attributes and then remove them from the file, it just reads old ones from the file and only stores new ones in attributes.
Unless I'm reading it wrong, the code in this commit says it does remove the homes entry?
https://github.com/minetest/minetest_ga ... 74e8e88047
At or near "-- remove `name` from the old storage file"

Anyhow... looking forward to getting this mod into our server :)

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] MultiHome [multihome]

by octacian » Post

ExeterDad wrote:Unless I'm reading it wrong, the code in this commit says it does remove the homes entry?
Ah, you're right it does. However, after giving this some thought it is still impossible for me to delete entries from the homes file once I import them into MultiHome, only the original sethome mod can do that as writing to the file with MultiHome as well could cause major issues. At this point I wouldn't worry about it though, the issue will never present itself as a real gameplay-affecting issue, plus, there isn't really anything I can do.

Also, thanks to all for the positive feedback, it's really an encouragement!
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

dawgdoc
Member
Posts: 260
Joined: Mon Feb 27, 2017 01:10
GitHub: dawgdoc

Re: [Mod] MultiHome [multihome]

by dawgdoc » Post

I imagine I may be doing something wrong, but I am getting errors when this mod is enabled.

I first added multihome.compatibility = override to minetest.conf. When that generated errors I tried multihome.compatibility = deprecate, which caused a similar error. I placed the setting below the basic_privs line. The errors generated were :

Code: Select all

2017-05-16 01:18:05: WARNING[Main]: Mod name conflict detected: "farming"
2017-05-16 01:18:05: WARNING[Main]: Will not load: /usr/share/minetest/games/minetest_game/mods/farming
2017-05-16 01:18:05: WARNING[Main]: Overridden by: /home/dawgdoc/.minetest/mods/farming
2017-05-16 01:18:05: ERROR[Main]: The following mods could not be found: "3dmushrooms" "along_shore" "bushes" "bushes_classic" "cavestuff" "dryplants" "ferns" "flowers_plus" "junglegrass" "molehills" "nature_classic" "trunks" "vines" "woodsoils" "youngtrees"
2017-05-16 01:18:05: WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition
2017-05-16 01:18:05: ERROR[Main]: ModError: Failed to load and run script from /home/dawgdoc/.minetest/mods/multihome/init.lua:
2017-05-16 01:18:05: ERROR[Main]: /home/dawgdoc/.minetest/mods/multihome/init.lua:219: attempt to call field 'override_chatcommand' (a nil value)
2017-05-16 01:18:05: ERROR[Main]: stack traceback:
2017-05-16 01:18:05: ERROR[Main]: 	/home/dawgdoc/.minetest/mods/multihome/init.lua:219: in main chunk
2017-05-16 01:18:05: ERROR[Main]: Check debug.txt for details.


-------------
  Separator
-------------

2017-05-16 01:21:40: WARNING[Main]: Mod name conflict detected: "farming"
2017-05-16 01:21:40: WARNING[Main]: Will not load: /usr/share/minetest/games/minetest_game/mods/farming
2017-05-16 01:21:40: WARNING[Main]: Overridden by: /home/dawgdoc/.minetest/mods/farming
2017-05-16 01:21:40: ERROR[Main]: The following mods could not be found: "3dmushrooms" "along_shore" "bushes" "bushes_classic" "cavestuff" "dryplants" "ferns" "flowers_plus" "junglegrass" "molehills" "nature_classic" "trunks" "vines" "woodsoils" "youngtrees"
2017-05-16 01:21:40: WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition
2017-05-16 01:21:41: ERROR[Main]: ModError: Failed to load and run script from /home/dawgdoc/.minetest/mods/multihome/init.lua:
2017-05-16 01:21:41: ERROR[Main]: /home/dawgdoc/.minetest/mods/multihome/init.lua:208: attempt to call field 'override_chatcommand' (a nil value)
2017-05-16 01:21:41: ERROR[Main]: stack traceback:
2017-05-16 01:21:41: ERROR[Main]: 	/home/dawgdoc/.minetest/mods/multihome/init.lua:208: in main chunk
2017-05-16 01:21:41: ERROR[Main]: Check debug.txt for details.
Is the issue as simple as me placing multihome.compatibility at the wrong place in minetest.conf?
Give a man a fish, feed him for a day. Give a kid a fish, it's going to die.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] MultiHome [multihome]

by octacian » Post

dawgdoc wrote:I first added multihome.compatibility = override to minetest.conf. When that generated errors I tried multihome.compatibility = deprecate, which caused a similar error. I placed the setting below the basic_privs line.
This is caused by the fact that you do not have a development build of Minetest, as 0.4.15 stable is missing two important features used by this my (player attributes and chatcommand override APIs). In order to get MultiHome working correctly, you'll need to build a new development version of Minetest with this commit or newer (simply doing git pull as in the linked guide will work fine).

BTW, placement in minetest.conf doesn't matter at all for anything, just so that you know :D (well, so long as you don't redefine the same thing later, but that's pretty obvious)
Last edited by octacian on Wed May 17, 2017 02:52, edited 1 time in total.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

dawgdoc
Member
Posts: 260
Joined: Mon Feb 27, 2017 01:10
GitHub: dawgdoc

Re: [Mod] MultiHome [multihome]

by dawgdoc » Post

octacian wrote:
dawgdoc wrote:I first added multihome.compatibility = override to minetest.conf. When that generated errors I tried multihome.compatibility = deprecate, which caused a similar error. I placed the setting below the basic_privs line.
This is caused by the fact that you do not have a development build of Minetest, as 0.4.14 stable is missing two important features used by this my (player attributes and chatcommand override APIs). In order to get MultiHome working correctly, you'll need to build a new development version of Minetest with this commit or newer (simply doing git pull as in the linked guide will work fine).

BTW, placement in minetest.conf doesn't matter at all for anything, just so that you know :D (well, so long as you don't redefine the same thing later, but that's pretty obvious)
I realized today, while away from the house, that I hadn't mentioned my MT version nor the OS of my computer. Thank you for replying in spite of that. (LinuxMint 18.1 based on Ubuntu Xenail, and MT 0.4.15 from the stable PPA). I really must have been sleepy while reading the first post to not catch that a -dev build was needed and to think that it and the readme said to add the line to minetest.conf. Thank you, again, for the reply.
Give a man a fish, feed him for a day. Give a kid a fish, it's going to die.

BBmine
Member
Posts: 3476
Joined: Sun Jul 12, 2015 22:51
GitHub: BBmine
IRC: BBmine
In-game: Baggins
Location: USA

Re: [Mod] MultiHome [multihome]

by BBmine » Post

Totes adding this to our LAN server :D

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] MultiHome [multihome]

by aristotle » Post

I have been using your mod in override mode and it just feels so natural. Thank you so much! :D
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] MultiHome [multihome]

by aristotle » Post

I am on MT 04.17.1 and when I set the multihome.max setting in minetest.conf to have up to 10 homes an error has occurred.

After line 5

Code: Select all

local max    = minetest.setting_get("multihome.max") or 5
I solved it by just adding a quick fix

Code: Select all

max = tonumber(max)
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] MultiHome [multihome]

by Nathan.S » Post

Looks like you have a spelling error in the readme file. multihome.compatiblity should probably be multihome.compatibility
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Walker
Member
Posts: 1816
Joined: Tue Oct 03, 2017 09:22
In-game: Walker
Contact:

Re: [Mod] MultiHome [multihome]

by Walker » Post

Bug ^^

Code: Select all

2019-10-18 18:46:05: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'multihome' in callback on_chat_message(): .../sda3/Minetest/server4/.minetest/mods/multihome/init.lua:65: attempt to compare string with number
2019-10-18 18:46:05: ERROR[Main]: stack traceback:
2019-10-18 18:46:05: ERROR[Main]: 	.../sda3/Minetest/server4/.minetest/mods/multihome/init.lua:65: in function 'func'
2019-10-18 18:46:05: ERROR[Main]: 	...test/bin/../share/minetest/builtin/game/chatcommands.lua:30: in function <...test/bin/../share/minetest/builtin/game/chatcommands.lua:9>
2019-10-18 18:46:05: ERROR[Main]: 	...minetest/bin/../share/minetest/builtin/game/register.lua:419: in function <...minetest/bin/../share/minetest/builtin/game/register.lua:399>
Codesegment:

Code: Select all

...
64	-- if home doesn't already exist (i.e. a new home is being created), check for space
65	if not homes[name] and count_homes(homes) >= max then
66		return false, "Too many homes. Remove one with /multihome del <name> or /delhome <name>"
67	end
...

User avatar
srutzky
New member
Posts: 6
Joined: Tue Oct 06, 2020 03:13
GitHub: srutzky
Contact:

Re: [Mod] MultiHome [multihome]

by srutzky » Post

Hello. I ran into the same error that @aristotle and @Walker ran into (comparing string and number) when setting multihome.max in minetest.conf. I went to the source repo to make the change only to find that it had already been done (even if not in the ideal spot). I also found that a settingtypes.txt file had been added so that the options could be configured via the "All Settings" GUI (something else I had been considering doing, so that's awesome), and one or two other minor improvements. Would it be possible to please publish / package up the changes so that they are available via ContentDB? (although, it does appear that the mod.conf file is missing a few details that are in the version I installed via ContentDB)

In the mean time, I did just submit a PR to improve the error handling / messaging, and I moved the tonumber() fix for the "setting max in minetest.conf" error to the ideal location (i.e. the source of setting the max variable) so that any other use of that variable in the future does not potentially run into that same error:

https://github.com/octacian/multihome/pull/6

Thanks and take care,
Solomon...
⦓ (blog) Sql Quantum Leap   ⟐   (info sites) Collations  •  Module Signing  •  SQLCLR ⦔

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests