]> git.lizzy.rs Git - hangglider.git/commitdiff
Added wardzones support
authorPiezo_ <orderofthefourthwall@gmail.com>
Sat, 29 Dec 2018 21:13:18 +0000 (13:13 -0800)
committerPiezo_ <orderofthefourthwall@gmail.com>
Sat, 29 Dec 2018 21:13:18 +0000 (13:13 -0800)
init.lua

index 8284a9b09fedf873596f3b55d666cefd3217764f..6fc40240196d0ad7b4237a2f283db457e8c6bad8 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -137,7 +137,13 @@ end
 
 hangglider.can_fly = function (pname, pos)
        -- Checks if the player will get shot down at the position
-       if minetest.is_protected(vector.round(pos), pname) then
+       if wardzones then
+               local zone = wardzones.getZone(pos)
+               if zone then
+                       return (minetest.check_player_privs(pname, {protection_bypass=true}) or wardzones.checkPlayerZoneAccess(pname, zone) or not zone["data"]["no_fly"])
+               end
+       end
+       if areas and minetest.is_protected(vector.round(pos), pname) then 
                if hangglider.flak then 
                        for id, area in pairs(areas:getAreasAtPos(pos)) do
                                if area.flak then