Made some grammatical corrections

This commit is contained in:
Supergoat666 2020-07-29 09:20:46 +02:00
parent 6f681a2f4c
commit 7d77eb3a41
2 changed files with 13 additions and 16 deletions

@ -49,17 +49,17 @@ Additionally, `playerfactions` can optionally depend on the following mods:
I strongly recommend reading through the `init.lua` file; the functions at the top give you a pretty good idea of how to use it, but just in case you're short on time I'll list the most important functions below.
- `factions.version` is a variable to check the version of the playerfactions mod to assert compatibility:
- `factions.version` is a variable made to check the version of the playerfactions mod to assert compatibility:
* factions.version == nil for firsts version of playerfactions mod
* factions.version == 2 is the first time this variable is added, with adding multi-faction mode
- `player_is_in_faction(fname, player_name)`: true if the player is in the faction, nil in other cases
- `player_is_in_faction(fname, player_name)`: `true` if the player is in the faction, `nil` in other cases (facion or player doesn't exists or player is not a member of the faction)
- `get_facts()`: Get the table with all data. The structure is :
```{["name_of_faction1"]={
["owner"]=name_of_the_owner,
["members"]={["name_of_a_member1"]=true, ["name_of_a_member2"]=true}
}}
```
- `get_player_faction(player)`: Get a string with the faction a player belongs to, `nil` if they haven't joined a faction. In multi-faction mode, it will return the oldest faction which player is into. (It checks the facts variable from the top)
- `get_player_faction(player)`: Get a string with the faction a player belongs to, `nil` if they haven't joined a faction. In multi-faction mode, it will return the oldest created faction which player is into. (it's not necessarily the one they joined first. It checks the facts variable from the top)
- `get_player_factions(player)`: Get a table with the faction(s) a player belongs to, `nil` if they haven't joined a faction : {name_of_faction1, name_of_faction2}
- `get_owner(faction)`: Get the owner of a faction
- `chown(fname, owner)`: Change the owner of a faction
@ -68,7 +68,7 @@ I strongly recommend reading through the `init.lua` file; the functions at the t
- `get_password(faction)`: Gets a faction's password
- `set_password(faction, password)`: Sets a faction's password
- `join_faction(faction, player)`: Sets the given player as belonging to this faction
- `leave_faction(player)`: Clears a player's faction
- `leave_faction(faction, player)`: Remove the given player from the faction
Note that all of these functions have sanity checks : if faction or player does not exists, it return false. If operation succeed, it return true or the needed value.

@ -5,7 +5,7 @@ local S, NS = dofile(MP.."/intllib.lua")
-- Data
factions = {}
-- This variable "version" can be used by other mods to check the compatibility of the mods
-- This variable "version" can be used by other mods to check the compatibility of this mod
factions.version = 2
local facts = {}
@ -190,9 +190,9 @@ local function handle_command(name, param)
local own_factions = factions.get_owned_factions(name)
local number_factions = #own_factions
if number_factions == 0 then
password = "No importance, player will not be abble because player is not the owner of no faction"
password = "No importance, player won't be able because player is the owner of no faction"
elseif #params == 1 then
faction_name = "No importance, player will not be abble because no password is given"
faction_name = "No importance, player won't be able because no password is given"
elseif #params == 2 and number_factions == 1 then
password = params[2]
faction_name = own_factions[1]
@ -236,9 +236,6 @@ local function handle_command(name, param)
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)"))
end
if faction_name == nil then
minetest.chat_send_player(name, S("Missing faction name"))
elseif facts[faction_name] == nil then
minetest.chat_send_player(name, S("This faction is not registered"))
else
@ -250,7 +247,7 @@ local function handle_command(name, param)
fmembers = fmembers..", "..play
end
end
minetest.chat_send_player(name, S("Name: @1\nOwner: @2\nMembers: #@3", faction_name, factions.get_owner(faction_name), fmembers))
minetest.chat_send_player(name, S("Name: @1\nOwner: @2\nMembers: @3", faction_name, factions.get_owner(faction_name), fmembers))
if factions.get_owner(faction_name) == name or minetest.get_player_privs(name).playerfactions_admin then
minetest.chat_send_player(name, S("Password: @1", factions.get_password(faction_name)))
end
@ -328,7 +325,7 @@ local function handle_command(name, param)
elseif target == nil then
minetest.chat_send_player(name, S("Missing player name"))
elseif factions.get_owner(faction_name) ~= name and not minetest.get_player_privs(name).playerfactions_admin then
minetest.chat_send_player(name, S("Permission denied"))
minetest.chat_send_player(name, S("Permission denied: you are not the owner of this faction"))
elseif not facts[faction_name].members[target] then
minetest.chat_send_player(name, S("This player is not in the faction"))
elseif target == name then
@ -363,7 +360,7 @@ local function handle_command(name, param)
faction_name = params[2]
password = params[3]
elseif facts[params[2]] ~= nil then
faction_name = params[2]
faction_name = "No importance, there is no password"
end
if faction_name == nil then
if number_factions == 0 then
@ -374,7 +371,7 @@ local function handle_command(name, param)
elseif password == nil then
minetest.chat_send_player(name, S("Missing password"))
elseif factions.get_owner(faction_name) ~= name and not minetest.get_player_privs(name).playerfactions_admin then
minetest.chat_send_player(name, S("Permission denied"))
minetest.chat_send_player(name, S("Permission denied: you are not the owner of this faction"))
else
if factions.set_password(faction_name, password) then
minetest.chat_send_player(name, S("Password has been updated"))
@ -392,7 +389,7 @@ local function handle_command(name, param)
local password = nil
if #params < 3 then
faction_name = "No importance, there is no target or no password"
if minetest.player_exists(params[2]) then
if params[2] ~= nil and minetest.player_exists(params[2]) then
target = "No importance, there is no password"
end
elseif number_factions == 0 then
@ -446,7 +443,7 @@ local function handle_command(name, param)
minetest.chat_send_player(name, S("The player is already in the faction \"@1\"",factions.get_player_faction(target)))
else
if factions.join_faction(faction_name, target) then
minetest.chat_send_player(name, "The player is now a member of the guild")
minetest.chat_send_player(name, "The player is now a member of the faction")
return true
else
minetest.chat_send_player(name, S("Error on adding @1 into @2, please verify parameters and try again", target, faction_name))