While debugging a custom zone I found that for some reason when I entered from -X or -Y the hook DeathrunPlayerEnteredZone was called instantly, but when i entered from +X or +Y it was only called when ply:GetPos was inside the zone. Here it is demonstrated with a deny zone.
When entering from -X, -Y, -Z or +Z
When entering from +X and +Y
I searched a bit and the bug was on the function CuboidOverlap(). I guess the logic didn't include these cases or something... So I searched for a solution online and could figure out a fix.
I also came across a bug where, when exiting a zone from the edges, the hook DeathrunPlayerExitedZone wasn't called. This was due to a if statement on the DR:Think() function that checks if the player is in a area of a sphere that is just a little bigger than the zone before proceeding to call the hooks, so if the player leaves the sphere area before the hook could be called, the hook would never be called.
I can see why the check is there, so i made an equivalent one but with a square area that is always a set distance away from the actual zone, preventing this kind of stuff from happening.
For more info on the changes (as if this wall of text wasn't enough -.-) you can read the commit's descriptions.
Also, props to Tarkuswake and Haina for randomly entering my server and encouraging me to make this pull request, your support staff is awesome :D
While debugging a custom zone I found that for some reason when I entered from -X or -Y the hook DeathrunPlayerEnteredZone was called instantly, but when i entered from +X or +Y it was only called when ply:GetPos was inside the zone. Here it is demonstrated with a deny zone.
When entering from -X, -Y, -Z or +Z
When entering from +X and +Y
I searched a bit and the bug was on the function CuboidOverlap(). I guess the logic didn't include these cases or something... So I searched for a solution online and could figure out a fix.
I also came across a bug where, when exiting a zone from the edges, the hook DeathrunPlayerExitedZone wasn't called. This was due to a if statement on the DR:Think() function that checks if the player is in a area of a sphere that is just a little bigger than the zone before proceeding to call the hooks, so if the player leaves the sphere area before the hook could be called, the hook would never be called.
I can see why the check is there, so i made an equivalent one but with a square area that is always a set distance away from the actual zone, preventing this kind of stuff from happening.
For more info on the changes (as if this wall of text wasn't enough -.-) you can read the commit's descriptions.
Also, props to Tarkuswake and Haina for randomly entering my server and encouraging me to make this pull request, your support staff is awesome :D