whitespace and comments

This commit is contained in:
Luke aka SwissalpS 2024-09-16 16:31:27 +02:00
parent e4851ade83
commit 279b1efe1e

@ -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
@ -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
@ -540,11 +539,16 @@ minetest.register_chatcommand("factions", {
.. "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 = {},