From 7bd84b472816e6f050254e86438ad7eb841a1919 Mon Sep 17 00:00:00 2001 From: Coder12a <38924418+Coder12a@users.noreply.github.com> Date: Thu, 27 Jun 2019 17:55:24 -0500 Subject: [PATCH] Add: /claim list to help --- chatcommands.lua | 14 ++++++-------- claim_events.lua | 32 ++++++++++++-------------------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/chatcommands.lua b/chatcommands.lua index 67eee20..8470ac4 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -255,12 +255,11 @@ factions.register_command ("claim", { elseif arg_one == "all" then factions.claim_all(player, faction) elseif arg_one == "l" or arg_one == "list" then - local timer = 0 - minetest.chat_send_player(player, "All claims:") + local aclaims = "All claims:\n" for i in pairs(faction.land) do - minetest.after(timer, minetest.chat_send_player, player, i) - timer = timer + 0.1 + aclaims = aclaims .. i .. "\n" end + minetest.chat_send_player(player, aclaims) elseif arg_one == "h" or arg_one == "help" then factions.claim_help(player, arg_two) end @@ -311,12 +310,11 @@ factions.register_command("unclaim", { elseif arg_one == "all" then factions.unclaim_all(player, faction) elseif arg_one == "l" or arg_one == "list" then - local timer = 0 - minetest.chat_send_player(player, "All claims:") + local aclaims = "All claims:\n" for i in pairs(faction.land) do - minetest.after(timer, minetest.chat_send_player, player, i) - timer = timer + 0.1 + 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 diff --git a/claim_events.lua b/claim_events.lua index d8bd61e..f3cbda0 100644 --- a/claim_events.lua +++ b/claim_events.lua @@ -234,15 +234,9 @@ function factions.claim_circle(player, faction, r) pos.z = (math.floor(pos.z / parcel_size) * parcel_size) + parcel_size_center for i = 1, 360 do - minetest.after(0.05 * i, function(player, faction, r, pos) - - local angle = i * math.pi / 180 - - local rpos = {x = pos.x + r * math.cos(angle), y = pos.y, z = pos.z + r * math.sin(angle)} - - claim_helper(player, faction, factions.get_parcel_pos(rpos), true) - - end, player, faction, r, pos) + local angle = i * math.pi / 180 + local rpos = {x = pos.x + r * math.cos(angle), y = pos.y, z = pos.z + r * math.sin(angle)} + claim_helper(player, faction, factions.get_parcel_pos(rpos), true) end end @@ -271,7 +265,7 @@ function factions.claim_all(player, faction) end function factions.claim_help(player, func) - local text = "All params for /f claim: , " + local text = "All params for /f claim: , " if func == "o" or func == "one" then text = "/f claim o\n/f claim one\n Claim one parcel." @@ -283,6 +277,8 @@ function factions.claim_help(player, func) text = "/f claim s \n/f claim square \nClaim by square and radius." elseif func == "c" or func == "circle" then text = "/f claim c \n/f claim circle \nClaim by circle and radius." + elseif func == "l" or func == "list" then + text = "/f claim l\n/f claim list\nList all the faction's claimed land." elseif func == "all" then text = "/f claim all\nClaim all faction land." end @@ -365,15 +361,9 @@ function factions.unclaim_circle(player, faction, r) pos.z = (math.floor(pos.z / parcel_size) * parcel_size) + parcel_size_center for i = 1, 360 do - minetest.after(0.05 * i, function(player, faction, r, pos) - - local angle = i * math.pi / 180 - - local rpos = {x = pos.x + r * math.cos(angle), y = pos.y, z = pos.z + r * math.sin(angle)} - - unclaim_helper(player, faction, factions.get_parcel_pos(rpos), true) - - end, player, faction, r, pos) + local angle = i * math.pi / 180 + local rpos = {x = pos.x + r * math.cos(angle), y = pos.y, z = pos.z + r * math.sin(angle)} + unclaim_helper(player, faction, factions.get_parcel_pos(rpos), true) end end @@ -396,7 +386,7 @@ function factions.unclaim_all(player, faction) end function factions.unclaim_help(player, func) - local text = "All params for /f unclaim: , " + local text = "All params for /f unclaim: , " if func == "o" or func == "one" then text = "/f unclaim o\n/f unclaim one\n Unclaim one parcel." @@ -408,6 +398,8 @@ function factions.unclaim_help(player, func) text = "/f unclaim s \n/f unclaim square \nUnclaim by square and radius." elseif func == "c" or func == "circle" then text = "/f unclaim c \n/f unclaim circle \nUnclaim by circle and radius." + elseif func == "l" or func == "list" then + text = "/f claim l\n/f claim list\nList all the faction's claimed land." elseif func == "all" then text = "/f unclaim all\nUnclaim all faction land." end