From b0de983ffbfd93eabfae15e394f4246b0b515181 Mon Sep 17 00:00:00 2001 From: alexerate <35458285+alexerate@users.noreply.github.com> Date: Mon, 5 Feb 2018 23:49:18 +0100 Subject: [PATCH] function anti_lag added --- interact.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/interact.lua b/interact.lua index a0579d1..fc982a4 100644 --- a/interact.lua +++ b/interact.lua @@ -1,22 +1,26 @@ local old_is_protected = minetest.is_protected 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 - player:setpos(playerpos) return true end return old_is_protected(pos, name) end 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 local owners = areas:getNodeOwners(pos) minetest.chat_send_player(name, ("%s is protected by %s."):format( minetest.pos_to_string(pos), table.concat(owners, ", "))) + --minetest.after(1,anti_lag,{player=player,playerpos=playerpos}) + player:setpos(playerpos) end end) +function anti_lag(player) + player.player:setpos(player.playerpos) +end \ No newline at end of file