diff options
author | Brandon <brandon@bremaweb.com> | 2013-08-06 21:44:00 -0500 |
---|---|---|
committer | Brandon <brandon@bremaweb.com> | 2013-08-06 21:44:00 -0500 |
commit | 565b5a4d3b7d08fa9298b4dbbe8874df0b281729 (patch) | |
tree | aa91800c7ad6ba9e198a2e6318f8ac983a0049fe | |
parent | f1ef00552933aa90b1499d2ecc7ff4d4b7c1f6af (diff) |
shareall and unshareall commands to (un)share all of a persons claims
-rw-r--r-- | chatcommands.lua | 60 | ||||
-rw-r--r-- | init.lua | 6 |
2 files changed, 64 insertions, 2 deletions
diff --git a/chatcommands.lua b/chatcommands.lua index 3f7eee4..d0df825 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -140,3 +140,63 @@ minetest.register_chatcommand("showarea", { -- (Removed at Rarkenin's request) end, }) + +minetest.register_chatcommand("shareall", { + params = "<name>", + description = "shares all your landclaims with <name>", + privs = {interact=true}, + func = function(name, param) + + if minetest.env:get_player_by_name(param) then + local qdone = 0 + for k,v in pairs(claims) do + if claims[k].owner == name then + claims[k].shared[param] = param + qdone = qdone + 1 + end + end + + landrush.save_claims() + + if qdone > 0 then + minetest.chat_send_player(name, param.." may now edit all of your areas.") + minetest.chat_send_player(name, qdone.." total areas were shared.") + minetest.chat_send_player(param, name.." has just shared all of their areas with you.") + else + minetest.chat_send_player(name, param.." was not given any permissions. You may not own any land.") + end + else + minetest.chat_send_player(name, param.." is not a valid player. Player must be online to share.") + end + end, +}) + +minetest.register_chatcommand("unshareall", { + params = "<name>", + description = "unshares all your landclaims with <name>", + privs = {interact=true}, + func = function(name, param) + + if minetest.env:get_player_by_name(param) then + local qdone = 0 + for k,v in pairs(claims) do + if claims[k].owner == name then + claims[k].shared[param] = nil + qdone = qdone + 1 + end + end + + landrush.save_claims() + + if qdone > 0 then + minetest.chat_send_player(name, param.." no longer may edit all of your areas.") + minetest.chat_send_player(name, qdone.." total areas were unshared.") + minetest.chat_send_player(param, name.." has just unshared all of their areas with you.") + else + minetest.chat_send_player(name, param.." had noting changed. You may not own any land.") + end + else + minetest.chat_send_player(name, param.." is not a valid player. Player must be online to unshare.") + end + end, +}) @@ -77,7 +77,9 @@ function landrush.get_chunk(pos) -- 3 levels of vertical protection local y = 0 - if ( pos.y < -60 ) then + if ( pos.y < -200 ) then + y = -32000 + elseif ( pos.y < -60 ) then y = -200 elseif ( pos.y < 140 ) then y = -30 @@ -381,7 +383,7 @@ minetest.after(0, function () dofile(path.."/default.lua") dofile(path.."/bucket.lua") -dofile(path.."/doors.lua") +--dofile(path.."/doors.lua") dofile(path.."/fire.lua") dofile(path.."/chatcommands.lua") |