protection_lagporter/readme.md

38 lines
1.7 KiB
Markdown
Raw 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.
#### TenPlus1's Protection Redo
function minetest.is_protected(pos, digger, digging)
if not protector.can_dig(protector.radius, pos, digger, false, 1) then
if digging then protection_lagporter.check(pos, digger) end
return true
end
return protector.old_is_protected(pos, digger, digging)
end
#### ShadowNinja's Areas
function minetest.is_protected(pos, name, digging)
if not areas:canInteract(pos, name) then
if digging then protection_lagporter.check(pos, name) end
return true
end
return old_is_protected(pos, name, digging)
end
#### Node Definitions
2015-12-07 19:01:48 -08:00
In node definitions you should use the digger argument, `minetest.is_protected(pos, name, digging)`, if you test for protection in `on_dig`. This is only needed if the node is walkable.