From b73f24d6c9e5a89e378aaeea608b964e3ff62999 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Fri, 31 Jan 2020 19:03:19 +0100 Subject: [PATCH] proper skybox check --- fly.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fly.lua b/fly.lua index 93c8b04..aa59704 100644 --- a/fly.lua +++ b/fly.lua @@ -17,12 +17,15 @@ end local player_can_fly = function(player) local pos = player:get_pos() for _, box in pairs(skybox.list) do - if pos.y > box.miny and pos.y < box.maxy then - -- height match found - if box.fly then - return true - end - break + local match = false + if box.miny and box.maxy then + match = pos.y > box.miny and pos.y < box.maxy + elseif type(box.match) == "function" then + match = box.match(player, pos) + end + + if match and box.fly then + return true end end