Subcmd: flags cmd
This commit is contained in:
parent
8e2a92b792
commit
3b1d02fd33
@ -176,12 +176,7 @@ factions.register_command("flag", {
|
|||||||
description = "Manage the faction's flags.",
|
description = "Manage the faction's flags.",
|
||||||
description_arg = " <flag> <value>:",
|
description_arg = " <flag> <value>:",
|
||||||
global_privileges = def_global_privileges,
|
global_privileges = def_global_privileges,
|
||||||
format = {"string"},
|
|
||||||
ignore_param_limit = true,
|
|
||||||
on_success = function(player, faction, pos, parcelpos, args)
|
on_success = function(player, faction, pos, parcelpos, args)
|
||||||
local flag_name = args.strings[1]
|
|
||||||
local bool = args.strings[2]
|
|
||||||
if (flag_name == "help" or flag_name == "flags") or not bool then
|
|
||||||
local msg = ""
|
local msg = ""
|
||||||
for i, k in pairs(factions.flags) do
|
for i, k in pairs(factions.flags) do
|
||||||
msg = msg .. i ..": ".. k .. "\n"
|
msg = msg .. i ..": ".. k .. "\n"
|
||||||
@ -189,27 +184,6 @@ factions.register_command("flag", {
|
|||||||
minetest.chat_send_player(player, msg)
|
minetest.chat_send_player(player, msg)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if flag_name and bool then
|
|
||||||
local yes = false
|
|
||||||
if bool == "yes" then
|
|
||||||
yes = true
|
|
||||||
elseif bool == "no" then
|
|
||||||
yes = false
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player, "Set the flags only to yes or no.")
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
if flag_name == "open" then
|
|
||||||
factions.toggle_join_free(faction.name, yes)
|
|
||||||
elseif flag_name == "monsters" then
|
|
||||||
elseif flag_name == "tax_kick" then
|
|
||||||
elseif flag_name == "animals" then
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player, flag_name.." is not an flag.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
factions.register_command("desc", {
|
factions.register_command("desc", {
|
||||||
format = {"string"},
|
format = {"string"},
|
||||||
|
@ -184,3 +184,37 @@ factions.register_command ({"unclaim h", "unclaim help"}, {
|
|||||||
factions.unclaim_help(player, arg_two)
|
factions.unclaim_help(player, arg_two)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
factions.register_command({"flag help", "flag flags"}, {
|
||||||
|
faction_permissions = {"flags"},
|
||||||
|
global_privileges = def_global_privileges,
|
||||||
|
dont_show_in_help = true,
|
||||||
|
on_success = function(player, faction, pos, parcelpos, args)
|
||||||
|
local msg = ""
|
||||||
|
for i, k in pairs(factions.flags) do
|
||||||
|
msg = msg .. i ..": ".. k .. "\n"
|
||||||
|
end
|
||||||
|
minetest.chat_send_player(player, msg)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
factions.register_command("flag open", {
|
||||||
|
faction_permissions = {"flags"},
|
||||||
|
global_privileges = def_global_privileges,
|
||||||
|
dont_show_in_help = true,
|
||||||
|
format = {"string"},
|
||||||
|
on_success = function(player, faction, pos, parcelpos, args)
|
||||||
|
local bool = args.strings[1]
|
||||||
|
if bool then
|
||||||
|
local yes = false
|
||||||
|
if bool == "yes" then
|
||||||
|
yes = true
|
||||||
|
elseif bool == "no" then
|
||||||
|
yes = false
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player, "Set the flags only to yes or no.")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
factions.toggle_join_free(faction.name, yes)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user