https://github.com/shacknetisp/protection_lagporter
Protection enhancement for Minetest to stop glitching through protected nodes.
https://github.com/shacknetisp/protection_lagporter
lua minetest minetest-mod mod protection
Last synced: 17 days ago
JSON representation
Protection enhancement for Minetest to stop glitching through protected nodes.
- Host: GitHub
- URL: https://github.com/shacknetisp/protection_lagporter
- Owner: shacknetisp
- License: mit
- Created: 2015-12-06T23:06:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-31T04:11:38.000Z (about 9 years ago)
- Last Synced: 2025-02-12T21:17:22.686Z (2 months ago)
- Topics: lua, minetest, minetest-mod, mod, protection
- Language: Lua
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
### Protection Lagporter
This mod will teleport players back to where they started digging if they try to dig through protection.### Known Problems
* It cannot handle very long lag.
* Occasionally players who try very hard to break through protection while in the air will jump up and down rapidly. This won't last very long though.### minetest.is_protected
This mod overrides `minetest.node_dig` and calls a third argument in `minetest.is_protected`: `digging`
This argument can be safely ignored, so existing mods aren't broken by this.### Usage in other mods
In a protection mod change the definition of minetest.is_protected and call `protection_lagporter.check(pos, name)` to support the digging option.
A table of players being teleported is available with `protection_lagporter.glitching`, player names will either be `nil` if not teleporting or `true` if they are.
## Protection Mods
In protection mods simply add `digging` to the definition of `minetest.is_protected`:`minetest.isprotected(pos, name, digging)`
And add this line just before before returning `true`:
`if digging then protection_lagporter.check(pos, name) end`
## Fast Movement Mods
These mods must be changed to detect `protection_lagporter.glitching` and set the speed to 0.1 if it is `true` for `protection_lagporter.glitching[playerName]`
#### Node Definitions
In node definitions you should use the digger argument, `minetest.is_protected(pos, name, true)`, if you test for protection in `on_dig`. This is only needed if the node is walkable.