Solomon Rutzky 2ba85a7d5e Improve usability of max and compatibility in init.lua
1. Replace deprecated `minetest.setting_get()` with `minetest.settings:get()` ( https://github.com/minetest/minetest/search?q=setting_get%28 ). A few other functions are deprecated and should probably be addressed later (unless there is a specific reason to keep them, in which case the ones I replaced might need to be reverted).

2. Moved `tonumber()` fix for setting "multihome.max" in minetest.conf to where it's actually retrieved. It was previously added to the check performed when attempting to set a home, which did prevent the error, but any future uses of the `max` variable would potentially run into that same error. Fixing at the source ensures that `max` always has the correct type.

3. Added validation for `max` and `compat`. Gave `max` a lower-bound of 2 (instead of 1) because a max of 1 makes it no different than `sethome`, nor would it technically be _multi_ ;-). Not entirely sure what a "reasonable" upper-bound would/should be, so I just used 10,000, although I don't really see how even 1000 could be used / managed. Should it be lowered to 1000? or 2000 or 5000? or 200? I just figured that more then 10k is someone either testing to see if the limit works, or just trying to break things.

4. Improved error condition handling / messaging when setting a home. Previously it just checked for `>=` and suggested removing 1. However, the more recent addition of also checking to see if the name already exists rightly implies that overwriting an existing entry is valid, so it should be stated in the message. But, if (somehow) the current total is actually greater than the max, then a) removing 1 is only a fix if the total is over the max by only 1, and b) overwriting an existing entry _might_ seem acceptable, except it would then allow for someone having more than the desired max to effectively be grandfathered in with their overage as they could simply replace existing ones forever. So now that's not only handled, but the error message clearly states how many need to be removed before even replacing an existing one will work.
2021-06-17 14:30:38 -07:00
2017-05-12 19:27:59 -07:00
2017-05-16 16:04:26 -07:00
2017-05-12 18:41:01 -07:00
2017-05-06 20:04:44 -07:00
2017-05-06 20:04:44 -07:00
2017-05-12 19:27:59 -07:00
2020-07-30 08:19:10 -07:00

Screenshot

MultiHome [multihome]

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.

Description
No description provided
Readme 961 KiB
Languages
Lua 100%