From ebddb35b00b89477cef4ee81d2b498c79d5635f1 Mon Sep 17 00:00:00 2001 From: NotSomething0 <54156973+NotSomething0@users.noreply.github.com> Date: Sun, 19 Jan 2025 09:07:03 -0600 Subject: [PATCH] fix(marker): logical error when setting faceCamera (#686) Due to the way boolean values were being assigned, faceCamera would always evaluate to true because of its default value. This change fixes the logical error and ensures boolean properties are properly set. --- imports/marker/client.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/imports/marker/client.lua b/imports/marker/client.lua index 2e1805b..b8b5ef6 100644 --- a/imports/marker/client.lua +++ b/imports/marker/client.lua @@ -5,9 +5,6 @@ local defaultRotation = vector3(0, 0, 0) local defaultDirection = vector3(0, 0, 0) local defaultColor = { r = 255, g = 255, b = 255, a = 100 } local defaultSize = { width = 2, height = 1 } -local defaultBobUpAndDown = false -local defaultFaceCamera = true -local defaultRotate = false local defaultTextureDict = nil local defaultTextureName = nil @@ -152,9 +149,9 @@ function lib.marker.new(options) self.height = options.height or defaultSize.height self.rotation = options.rotation or defaultRotation self.direction = options.direction or defaultDirection - self.bobUpAndDown = options.bobUpAndDown or defaultBobUpAndDown - self.faceCamera = options.faceCamera or defaultFaceCamera - self.rotate = options.rotate or defaultRotate + self.bobUpAndDown = type(options.bobUpAndDown) == 'boolean' and options.bobUpAndDown + self.faceCamera = type(options.faceCamera) ~= 'boolean' or options.faceCamera + self.rotate = type(options.rotate) == 'boolean' and options.rotate self.textureDict = options.textureDict or defaultTextureDict self.textureName = options.textureName or defaultTextureName self.draw = drawMarker