Add: unclaim as a subcmd
This commit is contained in:
parent
52b9000960
commit
78e6d54576
@ -24,9 +24,7 @@ factions.register_command ("claim", {
|
||||
faction_permissions = {"claim"},
|
||||
description = "Claim the plot of land you're on.",
|
||||
description_arg = ":",
|
||||
format = {"string"},
|
||||
global_privileges = def_global_privileges,
|
||||
ignore_param_limit = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
return claim_helper(player, faction, parcelpos)
|
||||
end
|
||||
@ -35,51 +33,9 @@ factions.register_command("unclaim", {
|
||||
faction_permissions = {"claim"},
|
||||
description = "Unclaim the plot of land you're on.",
|
||||
description_arg = ":",
|
||||
format = {"string"},
|
||||
global_privileges = def_global_privileges,
|
||||
ignore_param_limit = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local arg_one = args.strings[1]
|
||||
local arg_two = args.strings[2]
|
||||
if not arg_one or arg_one == "o" or arg_one == "one" then
|
||||
return unclaim_helper(player, faction, parcelpos)
|
||||
elseif arg_one == "a" or arg_one == "auto" then
|
||||
factions.unclaim_auto(player, faction)
|
||||
elseif arg_one == "f" or arg_one == "fill" then
|
||||
factions.unclaim_fill(player, faction)
|
||||
elseif arg_one == "s" or arg_one == "square" then
|
||||
if arg_two then
|
||||
local r = tonumber(arg_two)
|
||||
if not r then
|
||||
minetest.chat_send_player(player, "Only use numbers in the second cmd parameter [0-9].")
|
||||
return
|
||||
end
|
||||
factions.unclaim_square(player, faction, r)
|
||||
else
|
||||
factions.unclaim_square(player, faction, 3)
|
||||
end
|
||||
elseif arg_one == "c" or arg_one == "circle" then
|
||||
if arg_two then
|
||||
local r = tonumber(arg_two)
|
||||
if not r then
|
||||
minetest.chat_send_player(player, "Only use numbers in the second cmd parameter [0-9].")
|
||||
return
|
||||
end
|
||||
factions.unclaim_circle(player, faction, r)
|
||||
else
|
||||
factions.unclaim_circle(player, faction, 3)
|
||||
end
|
||||
elseif arg_one == "all" then
|
||||
factions.unclaim_all(player, faction)
|
||||
elseif arg_one == "l" or arg_one == "list" then
|
||||
local aclaims = "All claims:\n"
|
||||
for i in pairs(faction.land) do
|
||||
aclaims = aclaims .. i .. "\n"
|
||||
end
|
||||
minetest.chat_send_player(player, aclaims)
|
||||
elseif arg_one == "h" or arg_one == "help" then
|
||||
factions.unclaim_help(player, arg_two)
|
||||
end
|
||||
return unclaim_helper(player, faction, parcelpos)
|
||||
end
|
||||
})
|
||||
--list all known factions
|
||||
|
@ -94,3 +94,93 @@ factions.register_command ({"claim h", "claim help"}, {
|
||||
end
|
||||
})
|
||||
|
||||
factions.register_command ({"unclaim o", "unclaim one"}, {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
return unclaim_helper(player, faction, parcelpos)
|
||||
end
|
||||
})
|
||||
factions.register_command ({"unclaim a", "unclaim auto"}, {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
factions.unclaim_auto(player, faction)
|
||||
end
|
||||
})
|
||||
factions.register_command ({"unclaim f", "unclaim fill"}, {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
factions.unclaim_fill(player, faction)
|
||||
end
|
||||
})
|
||||
factions.register_command ({"unclaim s", "unclaim square"}, {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local arg = args.strings[1]
|
||||
if arg then
|
||||
local r = tonumber(arg)
|
||||
if not r then
|
||||
minetest.chat_send_player(player, "Only use numbers in the second cmd parameter [0-9].")
|
||||
return
|
||||
end
|
||||
factions.unclaim_square(player, faction, r)
|
||||
else
|
||||
factions.unclaim_square(player, faction, 3)
|
||||
end
|
||||
end
|
||||
})
|
||||
factions.register_command ({"unclaim c", "unclaim circle"}, {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local arg = args.strings[1]
|
||||
if arg then
|
||||
local r = tonumber(arg)
|
||||
if not r then
|
||||
minetest.chat_send_player(player, "Only use numbers in the second cmd parameter [0-9].")
|
||||
return
|
||||
end
|
||||
factions.unclaim_circle(player, faction, r)
|
||||
else
|
||||
factions.unclaim_circle(player, faction, 3)
|
||||
end
|
||||
end
|
||||
})
|
||||
factions.register_command ("unclaim all", {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
factions.unclaim_all(player, faction)
|
||||
end
|
||||
})
|
||||
factions.register_command ({"unclaim l", "unclaim list"}, {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local aclaims = "All claims:\n"
|
||||
for i in pairs(faction.land) do
|
||||
aclaims = aclaims .. i .. "\n"
|
||||
end
|
||||
minetest.chat_send_player(player, aclaims)
|
||||
end
|
||||
})
|
||||
factions.register_command ({"unclaim h", "unclaim help"}, {
|
||||
faction_permissions = {"claim"},
|
||||
global_privileges = def_global_privileges,
|
||||
dont_show_in_help = true,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
factions.unclaim_help(player, arg_two)
|
||||
end
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user