forked from mtcontrib/factions
Make faction_user priv off by default
This commit is contained in:
parent
82a96ccea7
commit
a9d8b58223
100
chatcommands.lua
100
chatcommands.lua
@ -135,11 +135,16 @@ init_commands = function()
|
||||
}
|
||||
)
|
||||
|
||||
local def_privs = { interact=true}
|
||||
if factions_config.faction_user_priv then
|
||||
def_privs.faction_user = true
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("factions",
|
||||
{
|
||||
params = "<cmd> <parameter 1> .. <parameter n>",
|
||||
description = "faction administration functions",
|
||||
privs = { interact=true,faction_user=true },
|
||||
privs = def_privs,
|
||||
func = factions_chat.cmdhandler,
|
||||
}
|
||||
)
|
||||
@ -149,7 +154,7 @@ init_commands = function()
|
||||
{
|
||||
params = "<command> parameters",
|
||||
description = "Factions commands. Type /f help for available commands.",
|
||||
privs = { interact=true,faction_user=true},
|
||||
privs = def_privs,
|
||||
func = factions_chat.cmdhandler,
|
||||
}
|
||||
)
|
||||
@ -160,10 +165,23 @@ end
|
||||
-- R E G I S T E R E D C O M M A N D S |
|
||||
-------------------------------------------
|
||||
|
||||
local def_global_privileges = nil
|
||||
|
||||
if factions_config.faction_user_priv then
|
||||
minetest.register_on_newplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local privs = minetest.get_player_privs(name)
|
||||
privs.faction_user = true
|
||||
minetest.set_player_privs(name, privs)
|
||||
end
|
||||
)
|
||||
def_global_privileges = {"faction_user"}
|
||||
end
|
||||
|
||||
factions.register_command ("claim", {
|
||||
faction_permissions = {"claim"},
|
||||
description = "Claim the plot of land you're on.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local can_claim = faction:can_claim_parcel(parcelpos)
|
||||
if can_claim then
|
||||
@ -192,7 +210,7 @@ factions.register_command ("claim", {
|
||||
factions.register_command("unclaim", {
|
||||
faction_permissions = {"claim"},
|
||||
description = "Unclaim the plot of land you're on.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local parcel_faction = factions.get_parcel_faction(parcelpos)
|
||||
if not parcel_faction then
|
||||
@ -213,7 +231,7 @@ factions.register_command("unclaim", {
|
||||
factions.register_command("list", {
|
||||
description = "List all registered factions.",
|
||||
infaction = false,
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local list = factions.get_faction_list()
|
||||
local tosend = "Existing factions:"
|
||||
@ -242,7 +260,7 @@ factions.register_command("version", {
|
||||
factions.register_command("info", {
|
||||
format = {"faction"},
|
||||
description = "Shows a faction's description.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player,
|
||||
"factions: " .. args.factions[1].name .. ": " ..
|
||||
@ -253,7 +271,7 @@ factions.register_command("info", {
|
||||
|
||||
factions.register_command("leave", {
|
||||
description = "Leave your faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:remove_player(player)
|
||||
return true
|
||||
@ -264,7 +282,7 @@ factions.register_command("kick", {
|
||||
faction_permissions = {"playerslist"},
|
||||
format = {"player"},
|
||||
description = "Kick a player from your faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local victim = args.players[1]
|
||||
local victim_faction = factions.get_player_faction(victim:get_player_name())
|
||||
@ -286,7 +304,7 @@ factions.register_command("create", {
|
||||
format = {"string"},
|
||||
infaction = false,
|
||||
description = "Create a new faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction then
|
||||
send_error(player, "You are already in a faction.")
|
||||
@ -309,7 +327,7 @@ factions.register_command("join", {
|
||||
format = {"faction"},
|
||||
description = "Join a faction.",
|
||||
infaction = false,
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local new_faction = args.factions[1]
|
||||
if new_faction:can_join(player) then
|
||||
@ -328,7 +346,7 @@ factions.register_command("join", {
|
||||
factions.register_command("disband", {
|
||||
faction_permissions = {"disband"},
|
||||
description = "Disband your faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:disband()
|
||||
return true
|
||||
@ -338,7 +356,7 @@ factions.register_command("disband", {
|
||||
factions.register_command("close", {
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Make your faction invite-only.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:toggle_join_free(false)
|
||||
return true
|
||||
@ -348,7 +366,7 @@ factions.register_command("close", {
|
||||
factions.register_command("open", {
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Allow any player to join your faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:toggle_join_free(true)
|
||||
return true
|
||||
@ -358,7 +376,7 @@ factions.register_command("open", {
|
||||
factions.register_command("description", {
|
||||
faction_permissions = {"description"},
|
||||
description = "Set your faction's description",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:set_description(table.concat(args.other," "))
|
||||
return true
|
||||
@ -369,7 +387,7 @@ factions.register_command("invite", {
|
||||
format = {"player"},
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Invite a player to your faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:invite_player(args.players[1]:get_player_name())
|
||||
return true
|
||||
@ -380,7 +398,7 @@ factions.register_command("uninvite", {
|
||||
format = {"player"},
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Revoke a player's invite.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:revoke_invite(args.players[1]:get_player_name())
|
||||
return true
|
||||
@ -400,7 +418,7 @@ factions.register_command("delete", {
|
||||
|
||||
factions.register_command("ranks", {
|
||||
description = "List ranks within your faction",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
for rank, permissions in pairs(faction.ranks) do
|
||||
minetest.chat_send_player(player, rank..": "..table.concat(permissions, " "))
|
||||
@ -411,7 +429,7 @@ factions.register_command("ranks", {
|
||||
|
||||
factions.register_command("rank_privileges", {
|
||||
description = "List available rank privileges.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player, "Privileges available:\n")
|
||||
for i, k in pairs(factions.permissions) do
|
||||
@ -425,7 +443,7 @@ factions.register_command("set_message_of_the_day", {
|
||||
format = {"string"},
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Sets the message that shows up every time a faction member logs-in.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local s = ""
|
||||
for i,l in pairs(args.strings) do
|
||||
@ -439,7 +457,7 @@ factions.register_command("set_message_of_the_day", {
|
||||
if factions_config.faction_diplomacy then
|
||||
factions.register_command("send_alliance", {
|
||||
description = "Send an alliance request to another faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction:has_permission(player, "diplomacy") then
|
||||
@ -479,7 +497,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("send_neutral", {
|
||||
description = "Send neutral to another faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction:has_permission(player, "diplomacy") then
|
||||
@ -519,7 +537,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("accept", {
|
||||
description = "accept an request from another faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction:has_permission(player, "diplomacy") then
|
||||
@ -550,7 +568,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("refuse", {
|
||||
description = "refuse an request from another faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction:has_permission(player, "diplomacy") then
|
||||
@ -574,7 +592,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("delcare_war", {
|
||||
description = "Delcare war on a faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction:has_permission(player, "diplomacy") then
|
||||
@ -605,7 +623,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("break", {
|
||||
description = "Break an alliance.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction:has_permission(player, "diplomacy") then
|
||||
@ -630,7 +648,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("inbox", {
|
||||
description = "Check your diplomacy request inbox.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction:has_permission(player, "diplomacy") then
|
||||
local empty = true
|
||||
@ -655,7 +673,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("allies", {
|
||||
description = "Shows the factions that are allied to you.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local empty = true
|
||||
for i,k in pairs(faction.allies) do
|
||||
@ -670,7 +688,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("neutral", {
|
||||
description = "Shows the factions that are neutral with you.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local empty = true
|
||||
for i,k in pairs(faction.neutral) do
|
||||
@ -685,7 +703,7 @@ if factions_config.faction_diplomacy then
|
||||
|
||||
factions.register_command("enemies", {
|
||||
description = "Shows enemies of your faction.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local empty = true
|
||||
for i,k in pairs(faction.enemies) do
|
||||
@ -701,7 +719,7 @@ end
|
||||
|
||||
factions.register_command("who", {
|
||||
description = "List players in your faction, and their ranks.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if not faction.players then
|
||||
minetest.chat_send_player(player, "There is nobody in this faction ("..faction.name..")")
|
||||
@ -719,7 +737,7 @@ local parcel_size_center = factions_config.parcel_size / 2
|
||||
|
||||
factions.register_command("showparcel", {
|
||||
description = "Shows parcel for six seconds.",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local parcel_faction = factions.get_parcel_faction(parcelpos)
|
||||
if not parcel_faction then
|
||||
@ -739,7 +757,7 @@ factions.register_command("newrank", {
|
||||
description = "Add a new rank.",
|
||||
format = {"string"},
|
||||
faction_permissions = {"ranks"},
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if args.strings[1] then
|
||||
local rank = args.strings[1]
|
||||
@ -783,7 +801,7 @@ factions.register_command("delrank", {
|
||||
description = "Replace and delete a rank.",
|
||||
format = {"string", "string"},
|
||||
faction_permissions = {"ranks"},
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local rank = args.strings[1]
|
||||
local newrank = args.strings[2]
|
||||
@ -799,7 +817,7 @@ factions.register_command("delrank", {
|
||||
factions.register_command("setspawn", {
|
||||
description = "Set the faction's spawn",
|
||||
faction_permissions = {"spawn"},
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:set_spawn(pos)
|
||||
return true
|
||||
@ -809,7 +827,7 @@ factions.register_command("setspawn", {
|
||||
factions.register_command("where", {
|
||||
description = "See whose parcel you stand on.",
|
||||
infaction = false,
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local parcel_faction = factions.get_parcel_faction(parcelpos)
|
||||
local place_name = (parcel_faction and parcel_faction.name) or "Wilderness"
|
||||
@ -821,7 +839,7 @@ factions.register_command("where", {
|
||||
factions.register_command("help", {
|
||||
description = "Shows help for commands.",
|
||||
infaction = false,
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
factions_chat.show_help(player)
|
||||
return true
|
||||
@ -830,7 +848,7 @@ factions.register_command("help", {
|
||||
|
||||
factions.register_command("spawn", {
|
||||
description = "Shows your faction's spawn",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local spawn = faction.spawn
|
||||
if spawn then
|
||||
@ -848,7 +866,7 @@ factions.register_command("promote", {
|
||||
description = "Promotes a player to a rank",
|
||||
format = {"player", "string"},
|
||||
faction_permissions = {"promote"},
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local rank = args.strings[1]
|
||||
if faction.ranks[rank] then
|
||||
@ -863,7 +881,7 @@ factions.register_command("promote", {
|
||||
|
||||
factions.register_command("power", {
|
||||
description = "Display your faction's power",
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player, "Power: "..faction.power.."/".. faction.usedpower .."/"..faction.maxpower)
|
||||
return true
|
||||
@ -904,7 +922,7 @@ factions.register_command("free", {
|
||||
factions.register_command("chat", {
|
||||
description = "Send a message to your faction's members",
|
||||
format = {"string"},
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local msg = table.concat(args.strings, " ")
|
||||
faction:broadcast(msg, player)
|
||||
@ -923,7 +941,7 @@ factions.register_command("which", {
|
||||
description = "Gets a player's faction",
|
||||
infaction = false,
|
||||
format = {"string"},
|
||||
global_privileges = {"faction_user"},
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local playername = args.strings[1]
|
||||
local faction = factions.get_player_faction(playername)
|
||||
|
@ -21,6 +21,7 @@ factions_config.enable_power_per_player = minetest.settings:get_bool("power_per_
|
||||
factions_config.attack_parcel = minetest.settings:get_bool("attack_parcel") or false
|
||||
factions_config.faction_diplomacy = minetest.settings:get_bool("faction_diplomacy") or true
|
||||
factions_config.protection_style = minetest.settings:get("protection_style") or "2d"
|
||||
factions_config.faction_user_priv = minetest.settings:get("faction_user_priv") or false
|
||||
--[[
|
||||
factions_config.protection_max_depth = -512
|
||||
factions_config.protection_max_height = 10000
|
||||
@ -43,4 +44,5 @@ factions_config.enable_power_per_player = true
|
||||
factions_config.attack_parcel = false
|
||||
factions_config.faction_diplomacy = true
|
||||
factions_config.protection_style = "2d"
|
||||
factions_config.faction_user_priv = false
|
||||
--]]
|
@ -43,6 +43,8 @@ factions_config.attack_parcel (Enable attack parcel) bool false
|
||||
faction_diplomacy (Enable faction diplomacy) bool true
|
||||
# Enable or disabled the max depth and height limit for a parcel
|
||||
protection_depth_height_limit (Enable protection depth height limit) bool true
|
||||
# Enable or disabled the need for faction_user priv
|
||||
faction_user_priv (Enable faction user priv) bool false
|
||||
|
||||
[StringSettings]
|
||||
# Set the way that the parcel protection works (2d,3d).
|
||||
|
Loading…
Reference in New Issue
Block a user