fix
parent
dbe33df8d3
commit
fd0f41e094
9
init.lua
9
init.lua
|
@ -1,7 +1,7 @@
|
||||||
--Protection Lag Teleporter
|
--Protection Lag Teleporter
|
||||||
|
|
||||||
local check_speed = 0.2 --Teleport this quickly.
|
local check_speed = 0.05 --Teleport this quickly.
|
||||||
local check_time = 4 --Test this many times before finishing.
|
local check_time = 8 --Test this many times before finishing.
|
||||||
local message = true --Send a message when done teleporting. This is useful with high check_time values.
|
local message = true --Send a message when done teleporting. This is useful with high check_time values.
|
||||||
|
|
||||||
protection_lagporter = {}
|
protection_lagporter = {}
|
||||||
|
@ -21,14 +21,13 @@ local function check_togo(name)
|
||||||
--Is the player where he should be?
|
--Is the player where he should be?
|
||||||
if math.abs(p1.x - p2.x) <= 0.1 and math.abs(p1.y - p2.y) <= ytest and math.abs(p1.z - p2.z) <= 0.1 then
|
if math.abs(p1.x - p2.x) <= 0.1 and math.abs(p1.y - p2.y) <= ytest and math.abs(p1.z - p2.z) <= 0.1 then
|
||||||
times[name] = times[name] - 1
|
times[name] = times[name] - 1
|
||||||
player:set_physics_override({gravity=(check_time - times[name]) / check_time})
|
|
||||||
end
|
end
|
||||||
--Yes, he is.
|
--Yes, he is.
|
||||||
if times[name] <= 0 then
|
if times[name] <= 0 then
|
||||||
togo[name] = nil
|
togo[name] = nil
|
||||||
times[name] = nil
|
times[name] = nil
|
||||||
protection_lagporter.glitching[name] = nil
|
protection_lagporter.glitching[name] = nil
|
||||||
player:set_physics_override({speed=1.0, jump=1.0})
|
player:set_physics_override({speed=1.0})
|
||||||
if message then
|
if message then
|
||||||
minetest.chat_send_player(name, "You may now move.")
|
minetest.chat_send_player(name, "You may now move.")
|
||||||
end
|
end
|
||||||
|
@ -52,7 +51,7 @@ function protection_lagporter.check(pos, digger)
|
||||||
if not times[digger] then
|
if not times[digger] then
|
||||||
--Begin checks.
|
--Begin checks.
|
||||||
minetest.after(check_speed, check_togo, digger)
|
minetest.after(check_speed, check_togo, digger)
|
||||||
player:set_physics_override({speed=0, jump=0})
|
player:set_physics_override({speed=0.1})
|
||||||
end
|
end
|
||||||
times[digger] = check_time
|
times[digger] = check_time
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue