diff --git a/shared/helpers.lua b/shared/helpers.lua index f26f4d6..a8ab573 100644 --- a/shared/helpers.lua +++ b/shared/helpers.lua @@ -956,4 +956,18 @@ end function GetEntityForwardVector(entity) local heading = math.rad(GetEntityHeading(entity) + 90) return vec3(math.cos(heading), math.sin(heading), 0.0) +end + +function adjustMinMaxZ(coord, table) + local table = table + local adMinZ, adMaxZ = false, false + if table.minZ > coord.z then + adMinZ = true + table.minZ = (coord.z - 1.05) + end + if table.maxZ < coord.z then + adMinZ = true + table.maxZ = (coord.z + 0.80) + end + return table.minZ, table.maxZ, adMinZ, adMaxZ end \ No newline at end of file diff --git a/shared/targets.lua b/shared/targets.lua index e90d5fa..d336831 100644 --- a/shared/targets.lua +++ b/shared/targets.lua @@ -336,6 +336,13 @@ function createBoxTarget(data, opts, dist) local script = targetFunc[i] if isStarted(script.targetName) then debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1]) + if data[5].minZ or data[5].maxZ then + local adMinZ, adMaxZ + data[5].minZ, data[5].maxZ, adMinZ, adMaxZ = adjustMinMaxZ(data[2], { minZ = data[5].minZ, maxZ = data[5].maxZ }) + if adMinZ or adMaxZ then + print("^5Debug^7: ^2Auto adjusted ^7'^4"..data[1].."^7' ^2minZ and maxZ because ^1they weren't set correctly ^2remove or fix them for this target") + end + end local target = script.boxTarget(data, opts, dist) boxTargets[#boxTargets + 1] = target return target