protection_lagporter/readme.md

36 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2015-12-06 18:13:52 -08:00
### Protection Lagporter
2015-12-06 15:11:38 -08:00
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
2015-12-07 19:01:48 -08:00
This mod overrides `minetest.node_dig` and calls a third argument in `minetest.is_protected`: `digging`
2015-12-06 15:11:38 -08:00
This argument can be safely ignored, so existing mods aren't broken by this.
### Usage in other mods
2015-12-07 19:01:48 -08:00
In a protection mod change the definition of minetest.is_protected and call `protection_lagporter.check(pos, name)` to support the digging option.
2015-12-06 15:11:38 -08:00
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.
2015-12-28 04:18:32 -08:00
2015-12-29 07:26:51 -08:00
## Protection Mods
2016-01-30 20:11:38 -08:00
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`
2015-12-06 15:11:38 -08:00
2015-12-23 11:55:54 -08:00
## Fast Movement Mods
2015-12-29 07:26:51 -08:00
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]`
2015-12-23 11:55:54 -08:00
2015-12-06 15:11:38 -08:00
#### Node Definitions
2015-12-07 19:02:25 -08:00
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.