[Mod] MultiHome [multihome]

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

[Mod] MultiHome [multihome]

by octacian » Sat May 13, 2017 02:32

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)
 

User avatar
GreenDimond
Member
 
Posts: 1196
Joined: Wed Oct 28, 2015 01:26
Location: A place
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond
 

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

Re: [Mod] MultiHome [multihome]

by Chibi ghost » Sat May 13, 2017 21:21

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
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [Mod] MultiHome [multihome]

by ExeterDad » Sun May 14, 2017 02:21

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: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

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

Re: [Mod] MultiHome [multihome]

by octacian » Sun May 14, 2017 13:52

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)
 

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

Re: [Mod] MultiHome [multihome]

by ExeterDad » Sun May 14, 2017 17:59

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: 593
Joined: Mon Dec 21, 2015 22:18
Location: BC, Canada
GitHub: octacian
IRC: octacian
In-game: octacian

Re: [Mod] MultiHome [multihome]

by octacian » Mon May 15, 2017 05:05

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)
 

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

Re: [Mod] MultiHome [multihome]

by dawgdoc » Tue May 16, 2017 07:24

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?
 

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

Re: [Mod] MultiHome [multihome]

by octacian » Tue May 16, 2017 23:11

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)
 

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

Re: [Mod] MultiHome [multihome]

by dawgdoc » Wed May 17, 2017 01:28

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.
 

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


Return to WIP Mods



Who is online

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