mirror of
https://github.com/mt-mods/playerfactions.git
synced 2024-11-22 07:13:50 +01:00
Change the way to configure : now using minetest.conf
This commit is contained in:
parent
fa20136630
commit
fd8680b3f6
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
!*.md
|
||||
!mod.conf
|
||||
!.gitignore
|
||||
!settingtypes.txt
|
||||
|
@ -4,7 +4,7 @@ A simple mod which allows player created factions. Not very useful on its own, i
|
||||
|
||||
## Usage
|
||||
We can choose a mode : single or multi factions.
|
||||
By default players can only be in one faction at a time. If you want to allow players to join multiple factions at once, add `mode_unique_faction = false` to modpath/settings.txt
|
||||
By default players can only be in one faction at a time. If you want to allow players to join multiple factions at once, add `player_factions.mode_unique_faction = false` to minetest.conf
|
||||
|
||||
Parameters marked with square brackets ([]) are optional; most of these are only used if mode_unique_faction is false.
|
||||
|
||||
@ -15,7 +15,7 @@ These commands can be used by anyone:
|
||||
|
||||
- `/factions create <faction> <password>`: Create a new faction
|
||||
- `/factions list`: List available factions
|
||||
- `/factions info <faction>`: See information on a faction. For faction with lot of member we can choose the length of the member's list that's going to be shown by `adding max_members_list = int` to modpath/settings.txt, default is 50.
|
||||
- `/factions info <faction>`: See information on a faction. For faction with lot of member we can choose the length of the member's list that's going to be shown by adding `player_factions.max_members_list = int` to minetest.conf, default is 50.
|
||||
- `/factions join <faction> <password>`: Join an existing faction
|
||||
- `/factions leave [faction]`: Leave your faction
|
||||
|
||||
|
15
init.lua
15
init.lua
@ -20,9 +20,8 @@ for fname, fact in pairs(facts) do
|
||||
end
|
||||
end
|
||||
|
||||
settings = Settings(MP.."/settings.txt")
|
||||
factions.mode_unique_faction = settings:get_bool("mode_unique_faction", true)
|
||||
factions.max_members_list = tonumber(settings:get("max_members_list")) or 50
|
||||
factions.mode_unique_faction = minetest.settings:get_bool("player_factions.mode_unique_faction", true)
|
||||
factions.max_members_list = tonumber(minetest.settings:get("player_factions.max_members_list")) or 50
|
||||
|
||||
|
||||
|
||||
@ -46,6 +45,7 @@ function factions.get_player_faction(name)
|
||||
if not minetest.player_exists(name) then
|
||||
return false
|
||||
end
|
||||
minetest.log("warning", "Function factions.get_player_faction() is deprecated in favor of factions.get_player_factions(). Please check updates of mods depending on playerfactions.")
|
||||
for fname, fact in pairs(facts) do
|
||||
if fact.members[name] then
|
||||
return fname
|
||||
@ -223,8 +223,13 @@ local function handle_command(name, param)
|
||||
elseif action == "info" then
|
||||
local faction_name = params[2]
|
||||
if faction_name == nil then
|
||||
faction_name = factions.get_player_faction(name)
|
||||
minetest.chat_send_player(name, S("No faction were given, returning information about your oldest faction (e.g. the oldest created faction you are in)"))
|
||||
local player_factions = factions.get_player_factions(name)
|
||||
if #player_factions == 1 then
|
||||
faction_name = player_factions[1]
|
||||
else
|
||||
minetest.chat_send_player(name, S("You are in many factions, you have to choose one of them : @1", table.concat(player_factions, ", ")))
|
||||
return false
|
||||
end
|
||||
elseif facts[faction_name] == nil then
|
||||
minetest.chat_send_player(name, S("This faction is not registered"))
|
||||
else
|
||||
|
@ -1,2 +0,0 @@
|
||||
mode_unique_faction = false
|
||||
max_members_list = 50
|
2
settingtypes.txt
Normal file
2
settingtypes.txt
Normal file
@ -0,0 +1,2 @@
|
||||
player_factions.mode_unique_faction (Enable faction mode) bool true
|
||||
player_factions.max_members_list (The max number of members shown with info command) int 50
|
Loading…
Reference in New Issue
Block a user