remove faction_user requirement

This commit is contained in:
Elkien3 2018-10-26 20:11:04 -05:00
parent eb7c6eb472
commit 3871a4b1dd

View File

@ -163,7 +163,7 @@ end
factions.register_command ("claim", {
faction_permissions = {"claim"},
description = "Claim the plot of land you're on.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local can_claim = faction:can_claim_parcel(parcelpos)
if can_claim then
@ -192,7 +192,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"},
on_success = function(player, faction, pos, parcelpos, args)
local parcel_faction = factions.get_parcel_faction(parcelpos)
if not parcel_faction then
@ -213,7 +213,7 @@ factions.register_command("unclaim", {
factions.register_command("list", {
description = "List all registered factions.",
infaction = false,
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local list = factions.get_faction_list()
local tosend = "Existing factions:"
@ -242,7 +242,7 @@ factions.register_command("version", {
factions.register_command("info", {
format = {"faction"},
description = "Shows a faction's description.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
minetest.chat_send_player(player,
"factions: " .. args.factions[1].name .. ": " ..
@ -253,7 +253,7 @@ factions.register_command("info", {
factions.register_command("leave", {
description = "Leave your faction.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:remove_player(player)
return true
@ -264,7 +264,7 @@ factions.register_command("kick", {
faction_permissions = {"playerslist"},
format = {"player"},
description = "Kick a player from your faction.",
global_privileges = {"faction_user"},
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 +286,7 @@ factions.register_command("create", {
format = {"string"},
infaction = false,
description = "Create a new faction.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
if faction then
send_error(player, "You are already in a faction.")
@ -309,7 +309,7 @@ factions.register_command("join", {
format = {"faction"},
description = "Join a faction.",
infaction = false,
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local new_faction = args.factions[1]
if new_faction:can_join(player) then
@ -328,7 +328,7 @@ factions.register_command("join", {
factions.register_command("disband", {
faction_permissions = {"disband"},
description = "Disband your faction.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:disband()
return true
@ -338,7 +338,7 @@ factions.register_command("disband", {
factions.register_command("close", {
faction_permissions = {"playerslist"},
description = "Make your faction invite-only.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:toggle_join_free(false)
return true
@ -348,7 +348,7 @@ factions.register_command("close", {
factions.register_command("open", {
faction_permissions = {"playerslist"},
description = "Allow any player to join your faction.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:toggle_join_free(true)
return true
@ -358,7 +358,7 @@ factions.register_command("open", {
factions.register_command("description", {
faction_permissions = {"description"},
description = "Set your faction's description",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:set_description(table.concat(args.other," "))
return true
@ -369,7 +369,7 @@ factions.register_command("invite", {
format = {"player"},
faction_permissions = {"playerslist"},
description = "Invite a player to your faction.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:invite_player(args.players[1]:get_player_name())
return true
@ -380,7 +380,7 @@ factions.register_command("uninvite", {
format = {"player"},
faction_permissions = {"playerslist"},
description = "Revoke a player's invite.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:revoke_invite(args.players[1]:get_player_name())
return true
@ -400,7 +400,7 @@ factions.register_command("delete", {
factions.register_command("ranks", {
description = "List ranks within your faction",
global_privileges = {"faction_user"},
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 +411,7 @@ factions.register_command("ranks", {
factions.register_command("rank_privileges", {
description = "List available rank privileges.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
minetest.chat_send_player(player, "Privileges available:\n")
for i, k in pairs(factions.permissions) do
@ -424,7 +424,7 @@ factions.register_command("rank_privileges", {
if factions_config.faction_diplomacy then
factions.register_command("send_alliance", {
description = "Send an alliance request to another faction.",
global_privileges = {"faction_user"},
format = {"string"},
on_success = function(player, faction, pos, parcelpos, args)
if faction:has_permission(player, "diplomacy") then
@ -464,7 +464,7 @@ if factions_config.faction_diplomacy then
factions.register_command("send_neutral", {
description = "Send neutral to another faction.",
global_privileges = {"faction_user"},
format = {"string"},
on_success = function(player, faction, pos, parcelpos, args)
if faction:has_permission(player, "diplomacy") then
@ -504,7 +504,7 @@ if factions_config.faction_diplomacy then
factions.register_command("accept", {
description = "accept an request from another faction.",
global_privileges = {"faction_user"},
format = {"string"},
on_success = function(player, faction, pos, parcelpos, args)
if faction:has_permission(player, "diplomacy") then
@ -535,7 +535,7 @@ if factions_config.faction_diplomacy then
factions.register_command("refuse", {
description = "refuse an request from another faction.",
global_privileges = {"faction_user"},
format = {"string"},
on_success = function(player, faction, pos, parcelpos, args)
if faction:has_permission(player, "diplomacy") then
@ -559,7 +559,7 @@ if factions_config.faction_diplomacy then
factions.register_command("delcare_war", {
description = "Delcare war on a faction.",
global_privileges = {"faction_user"},
format = {"string"},
on_success = function(player, faction, pos, parcelpos, args)
if faction:has_permission(player, "diplomacy") then
@ -590,7 +590,7 @@ if factions_config.faction_diplomacy then
factions.register_command("break", {
description = "Break an alliance.",
global_privileges = {"faction_user"},
format = {"string"},
on_success = function(player, faction, pos, parcelpos, args)
if faction:has_permission(player, "diplomacy") then
@ -615,7 +615,7 @@ if factions_config.faction_diplomacy then
factions.register_command("inbox", {
description = "Check your diplomacy request inbox.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
if faction:has_permission(player, "diplomacy") then
local empty = true
@ -640,7 +640,7 @@ if factions_config.faction_diplomacy then
factions.register_command("allies", {
description = "Shows the factions that are allied to you.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local empty = true
for i,k in pairs(faction.allies) do
@ -655,7 +655,7 @@ if factions_config.faction_diplomacy then
factions.register_command("neutral", {
description = "Shows the factions that are neutral with you.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local empty = true
for i,k in pairs(faction.neutral) do
@ -670,7 +670,7 @@ if factions_config.faction_diplomacy then
factions.register_command("enemies", {
description = "Shows enemies of your faction.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local empty = true
for i,k in pairs(faction.enemies) do
@ -686,7 +686,7 @@ end
factions.register_command("who", {
description = "List players in your faction, and their ranks.",
global_privileges = {"faction_user"},
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..")")
@ -704,7 +704,7 @@ local parcel_size_center = factions_config.parcel_size / 2
factions.register_command("showparcel", {
description = "Shows parcel for six seconds.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local parcel_faction = factions.get_parcel_faction(parcelpos)
if not parcel_faction then
@ -724,7 +724,7 @@ factions.register_command("newrank", {
description = "Add a new rank.",
format = {"string"},
faction_permissions = {"ranks"},
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
if args.strings[1] then
local rank = args.strings[1]
@ -768,7 +768,7 @@ factions.register_command("delrank", {
description = "Replace and delete a rank.",
format = {"string", "string"},
faction_permissions = {"ranks"},
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local rank = args.strings[1]
local newrank = args.strings[2]
@ -784,7 +784,7 @@ factions.register_command("delrank", {
factions.register_command("setspawn", {
description = "Set the faction's spawn",
faction_permissions = {"spawn"},
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
faction:set_spawn(pos)
return true
@ -794,7 +794,7 @@ factions.register_command("setspawn", {
factions.register_command("where", {
description = "See whose parcel you stand on.",
infaction = false,
global_privileges = {"faction_user"},
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"
@ -806,7 +806,7 @@ factions.register_command("where", {
factions.register_command("help", {
description = "Shows help for commands.",
infaction = false,
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
factions_chat.show_help(player)
return true
@ -815,7 +815,7 @@ factions.register_command("help", {
factions.register_command("spawn", {
description = "Shows your faction's spawn",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local spawn = faction.spawn
if spawn then
@ -833,7 +833,7 @@ factions.register_command("promote", {
description = "Promotes a player to a rank",
format = {"player", "string"},
faction_permissions = {"promote"},
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local rank = args.strings[1]
if faction.ranks[rank] then
@ -848,7 +848,7 @@ factions.register_command("promote", {
factions.register_command("power", {
description = "Display your faction's power",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
minetest.chat_send_player(player, "Power: "..faction.power.."/".. faction.usedpower .."/"..faction.maxpower)
return true
@ -889,7 +889,7 @@ factions.register_command("free", {
factions.register_command("chat", {
description = "Send a message to your faction's members",
format = {"string"},
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local msg = table.concat(args.strings, " ")
faction:broadcast(msg, player)
@ -908,7 +908,7 @@ factions.register_command("which", {
description = "Gets a player's faction",
infaction = false,
format = {"string"},
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local playername = args.strings[1]
local faction = factions.get_player_faction(playername)