Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
fix(client): change vectors to the right type if given another
Browse files Browse the repository at this point in the history
  • Loading branch information
BerkieBb committed Apr 19, 2022
1 parent 27619a3 commit 8803c3e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ end
-------------------------------------------------------------------------------

local function AddCircleZone(name, center, radius, options, targetoptions)
center = type(center) == 'table' and vec3(center.x, center.y, center.z) or center
local centerType = type(center)
center = (centerType == 'table' or centerType == 'vector4') and vec3(center.x, center.y, center.z) or center
Zones[name] = CircleZone:Create(center, radius, options)
targetoptions.distance = targetoptions.distance or Config.MaxDistance
Zones[name].targetoptions = targetoptions
Expand All @@ -536,7 +537,8 @@ end
exports('AddCircleZone', AddCircleZone)

local function AddBoxZone(name, center, length, width, options, targetoptions)
center = type(center) == 'table' and vec3(center.x, center.y, center.z) or center
local centerType = type(center)
center = (centerType == 'table' or centerType == 'vector4') and vec3(center.x, center.y, center.z) or center
Zones[name] = BoxZone:Create(center, length, width, options)
targetoptions.distance = targetoptions.distance or Config.MaxDistance
Zones[name].targetoptions = targetoptions
Expand All @@ -546,7 +548,8 @@ exports('AddBoxZone', AddBoxZone)

local function AddPolyZone(name, points, options, targetoptions)
local _points = {}
if type(points[1]) == 'table' then
local pointsType = type(points[1])
if pointsType == 'table' or pointsType == 'vector3' or pointsType == 'vector4' then
for i = 1, #points do
_points[i] = vec2(points[i].x, points[i].y)
end
Expand Down

0 comments on commit 8803c3e

Please sign in to comment.