User Tools

Site Tools


dev:core:funref:is_protected

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:core:funref:is_protected [2019-10-02 17:27]
82.67.173.193 created
dev:core:funref:is_protected [2020-01-22 10:53] (current)
admin ↷ Page moved from reference:advtrains:is_protected to dev:core:funref:is_protected
Line 10: Line 10:
  
 ===== Parameters ===== ===== Parameters =====
-  * ''pos'' //(table)//: a Minetest vector position.+  * ''pos'' //(table)//: a Minetest position vector.
   * ''name'' //(string)//: the player name. It does not need to be logged in, but it *needs* to exist in the ''auth.txt'' file.   * ''name'' //(string)//: the player name. It does not need to be logged in, but it *needs* to exist in the ''auth.txt'' file.
 +
 +===== Returns =====
 +True if the node is protected and the player cannot bypass this protection, false otherwise.
  
 ===== Errors and warnings ===== ===== Errors and warnings =====
Line 40: Line 43:
 <file lua is_protected.lua> <file lua is_protected.lua>
 function advtrains.is_protected(pos, name) function advtrains.is_protected(pos, name)
- if not name then +    if not name then 
- error("advtrains.is_protected() called without name parameter!"+        error("advtrains.is_protected() called without name parameter!"
- end +    end 
- if minetest.check_player_privs(name, {protection_bypass=true}) then +    if minetest.check_player_privs(name, {protection_bypass=true}) then 
- --player can bypass protection +        --player can bypass protection 
- return false +        return false 
- end +    end 
- return minetest.is_protected(pos, name)+    return minetest.is_protected(pos, name)
 end end
 </file> </file>
dev/core/funref/is_protected.1570030034.txt.gz · Last modified: 2019-10-02 17:27 by 82.67.173.193