mirror of
https://github.com/minetest-mods/areas.git
synced 2024-12-28 03:30:39 +01:00
function anti_lag added
This commit is contained in:
parent
6cad881b6f
commit
b0de983ffb
10
interact.lua
10
interact.lua
@ -1,22 +1,26 @@
|
|||||||
|
|
||||||
local old_is_protected = minetest.is_protected
|
local old_is_protected = minetest.is_protected
|
||||||
function minetest.is_protected(pos, name)
|
function minetest.is_protected(pos, name)
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
local playerpos = player:getpos()
|
|
||||||
if not areas:canInteract(pos, name) then
|
if not areas:canInteract(pos, name) then
|
||||||
player:setpos(playerpos)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return old_is_protected(pos, name)
|
return old_is_protected(pos, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_protection_violation(function(pos, name)
|
minetest.register_on_protection_violation(function(pos, name)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
local playerpos = player:getpos()
|
||||||
if not areas:canInteract(pos, name) then
|
if not areas:canInteract(pos, name) then
|
||||||
local owners = areas:getNodeOwners(pos)
|
local owners = areas:getNodeOwners(pos)
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
("%s is protected by %s."):format(
|
("%s is protected by %s."):format(
|
||||||
minetest.pos_to_string(pos),
|
minetest.pos_to_string(pos),
|
||||||
table.concat(owners, ", ")))
|
table.concat(owners, ", ")))
|
||||||
|
--minetest.after(1,anti_lag,{player=player,playerpos=playerpos})
|
||||||
|
player:setpos(playerpos)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
function anti_lag(player)
|
||||||
|
player.player:setpos(player.playerpos)
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user