mirror of
https://github.com/mt-mods/playerfactions.git
synced 2024-11-22 23:33:51 +01:00
whitespace and comments
This commit is contained in:
parent
e4851ade83
commit
279b1efe1e
44
init.lua
44
init.lua
@ -3,7 +3,8 @@ local S = minetest.get_translator("playerfactions")
|
|||||||
|
|
||||||
-- Global factions table
|
-- Global factions table
|
||||||
factions = {}
|
factions = {}
|
||||||
-- This variable "version" can be used by other mods to check the compatibility of this mod
|
-- This variable "version" can be used by other mods to check
|
||||||
|
-- the compatibility of this mod
|
||||||
factions.version = 2
|
factions.version = 2
|
||||||
|
|
||||||
-- Settings
|
-- Settings
|
||||||
@ -31,8 +32,6 @@ if storage:get_string("facts") ~= "" then
|
|||||||
facts = minetest.deserialize(storage:get_string("facts"))
|
facts = minetest.deserialize(storage:get_string("facts"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function save_factions()
|
local function save_factions()
|
||||||
storage:set_string("facts", minetest.serialize(facts))
|
storage:set_string("facts", minetest.serialize(facts))
|
||||||
end
|
end
|
||||||
@ -40,7 +39,7 @@ end
|
|||||||
local function table_copy(data)
|
local function table_copy(data)
|
||||||
local copy = {}
|
local copy = {}
|
||||||
if type(data) == "table" then
|
if type(data) == "table" then
|
||||||
for k,v in pairs(data) do
|
for k, v in pairs(data) do
|
||||||
copy[k]=table_copy(v)
|
copy[k]=table_copy(v)
|
||||||
end
|
end
|
||||||
return copy
|
return copy
|
||||||
@ -49,22 +48,22 @@ local function table_copy(data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Data manipulation (API)
|
||||||
-- Data manipulation
|
|
||||||
function factions.get_facts()
|
function factions.get_facts()
|
||||||
return table_copy(facts)
|
return table_copy(facts)
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.player_is_in_faction(faction_name, player_name)
|
function factions.player_is_in_faction(faction_name, player_name)
|
||||||
if not minetest.player_exists(player_name) or not facts[faction_name] then
|
if not (facts[faction_name] and minetest.player_exists(player_name)) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return facts[faction_name].members[player_name]
|
return facts[faction_name].members[player_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.get_player_faction(player_name)
|
function factions.get_player_faction(player_name)
|
||||||
minetest.log("warning", "Function factions.get_player_faction() is deprecated in favor of " ..
|
minetest.log("warning", "Function factions.get_player_faction() "
|
||||||
"factions.get_player_factions(). Please check updates of mods depending on playerfactions.")
|
.. "is deprecated in favor of factions.get_player_factions(). "
|
||||||
|
.. "Please check updates of mods depending on playerfactions.")
|
||||||
if not minetest.player_exists(player_name) then
|
if not minetest.player_exists(player_name) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -534,17 +533,22 @@ local function handle_command(player_name, param)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_chatcommand("factions", {
|
minetest.register_chatcommand("factions", {
|
||||||
params = "create <faction> <password>: "..S("Create a new faction").."\n"
|
params = "create <faction> <password>: " .. S("Create a new faction") .. "\n"
|
||||||
.."list: "..S("List available factions").."\n"
|
.. "list: " .. S("List available factions") .. "\n"
|
||||||
.."info [<faction>]: "..S("See information about a faction").."\n"
|
.. "info [<faction>]: " .. S("See information about a faction") .. "\n"
|
||||||
.."player_info [<player>]: "..S("See information about a player").."\n"
|
.. "player_info [<player>]: " .. S("See information about a player") .. "\n"
|
||||||
.."join <faction> <password>: "..S("Join an existing faction").."\n"
|
.. "join <faction> <password>: " .. S("Join an existing faction") .. "\n"
|
||||||
.."leave [<faction>]: "..S("Leave your faction").."\n"
|
.. "leave [<faction>]: " .. S("Leave your faction") .. "\n"
|
||||||
.."kick <player> [<faction>]: "..S("Kick someone from your faction or from the given faction").."\n"
|
.. "kick <player> [<faction>]: "
|
||||||
.."disband <password> [<faction>]: "..S("Disband your faction or the given faction").."\n"
|
.. S("Kick someone from your faction or from the given faction") .. "\n"
|
||||||
.."passwd <password> [<faction>]: "..S("Change your faction's password or the password of the given faction").."\n"
|
.. "disband <password> [<faction>]: "
|
||||||
.."chown <player> <password> [<faction>]: "..S("Transfer ownership of your faction").."\n"
|
.. S("Disband your faction or the given faction") .. "\n"
|
||||||
.."invite <player> <faction>: "..S("Add player to a faction, you need @1 priv", factions.priv).."\n",
|
.. "passwd <password> [<faction>]: "
|
||||||
|
.. S("Change your faction's password or the password of the given faction") .." \n"
|
||||||
|
.. "chown <player> <password> [<faction>]: "
|
||||||
|
.. S("Transfer ownership of your faction") .. "\n"
|
||||||
|
.. "invite <player> <faction>: "
|
||||||
|
.. S("Add player to a faction, you need @1 priv", factions.priv) .. "\n",
|
||||||
|
|
||||||
description = "",
|
description = "",
|
||||||
privs = {},
|
privs = {},
|
||||||
|
Loading…
Reference in New Issue
Block a user