[Mod] Latency Protection [latency_protection]

Post Reply
Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

[Mod] Latency Protection [latency_protection]

by Coder12 » Post

Latency protection mod attempts to prevent players from glitching through protected nodes. By either teleporting the player or damaging them.

License: MIT
Mod dependencies: none
Optional mod dependencies: none
Contributors: Panquesito7
Damage mode

This mode attempts to prevent players from glitching through protected nodes. By damaging players who interact with a protected position too fast.

Teleport mode

This mode attempts to prevent players from glitching through protected nodes. By recording position every 20 seconds (This can be changed in settings) and teleporting them if the protection interaction happens in a very quick time frame. If a player interacts with a protected node the position will not be recorded for an extra cycle. Before recording a position, the player’s avg_jitter is checked to make sure the player is not lagging out. Latency Protection Settings
The timer for when to record a player position. This only works if punishment is set to teleport.

Code: Select all

latency_protection.timer = 20
The max jitter a player can have before refusing the position update. This only works if punishment is set to teleport.

Code: Select all

latency_protection.jitter_max = 1.5
The time limit between is_protected calls. If the function is called too fast the player will be teleport or damaged. time_max is read in microseconds.

Code: Select all

latency_protection.time_max = 10000
Damage amount to apply to the player. This only works if punishment is set to damage.

Code: Select all

latency_protection.damage = 16
Set what type of punishment to be given to a player. Teleport the player. Damage the player.

Code: Select all

latency_protection.punishment = "damage"
ContentDB
Browse Code
Download
Last edited by Coder12 on Mon Sep 06, 2021 00:11, edited 5 times in total.

User avatar
Hume2
Member
Posts: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: [Mod] Latency Protection [latency_protection]

by Hume2 » Post

It's an interesting idea. However, it can be misused to teleport back into a protected area after leaving it. On a PvP server, when someone falls into a trap, he can teleport back.

From what I've seen from your code, it is possible to do even more. If someone dies, he can teleport back to his original position by violating protection. Or when I jail someone, he can teleport back by violating a protection. Well, these can be fixed easily though, just keep in mind that it's possible.
If you lack the reality, go on a trip or find a job.

Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

Re: [Mod] Latency Protection [latency_protection]

by Coder12 » Post

Hume2 wrote:It's an interesting idea. However, it can be misused to teleport back into a protected area after leaving it. On a PvP server, when someone falls into a trap, he can teleport back.

From what I've seen from your code, it is possible to do even more. If someone dies, he can teleport back to his original position by violating protection. Or when I jail someone, he can teleport back by violating a protection. Well, these can be fixed easily though, just keep in mind that it's possible.
Hmm. Thanks for the feed back I will see if I can fix these problems.

Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

Re: [Mod] Latency Protection [latency_protection]

by Coder12 » Post

I attempted to fix some of those thing. I was only able to address one, on re-spawn it will record a new position. I guess a real cure would be protection damage.
Last edited by Coder12 on Mon Oct 28, 2019 19:41, edited 2 times in total.

User avatar
Hume2
Member
Posts: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: [Mod] Latency Protection [latency_protection]

by Hume2 » Post

I think, subtracting health points by each protection violation might work. It would make glitching through walls nearly impossible.
If you lack the reality, go on a trip or find a job.

Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

Re: [Mod] Latency Protection [latency_protection]

by Coder12 » Post

Hume2 wrote:I think, subtracting health points by each protection violation might work. It would make glitching through walls nearly impossible.
I will see about that. I know some people who do not like protection damage, So I am gonna take that into account.

Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

Re: [Mod] Latency Protection [latency_protection]

by Coder12 » Post

Alright I added the option to switch between damaging or teleporting a player. Plus, I made it where it keeps track of time between protection calls. If the time is short between calls it will activate the punishment.

Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

Re: [Mod] Latency Protection [latency_protection]

by Coder12 » Post

I have buffed the default settings for time_max and damage.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] Latency Protection [latency_protection]

by Linuxdirk » Post

Coder12 wrote:Alright I added the option to switch between damaging or teleporting a player.
Why not both?

Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

Re: [Mod] Latency Protection [latency_protection]

by Coder12 » Post

Linuxdirk wrote:
Coder12 wrote:Alright I added the option to switch between damaging or teleporting a player.
Why not both?
Sorry for late reply, I can add a option for both if you like.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests