From 0a1f4de471b62a9361214b18cf14b28ff6a03811 Mon Sep 17 00:00:00 2001 From: FullGas1 Date: Tue, 1 Apr 2025 02:22:35 +0200 Subject: [PATCH] commit --- CTLD.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CTLD.lua b/CTLD.lua index 047a550..6897777 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -2618,7 +2618,7 @@ function ctld.spawnCrate(_arguments, bypassCrateWaitTime) end --*************************************************************** -ctld.randomCrateSpacing = 12 -- meters +ctld.randomCrateSpacing = 20 -- meters function ctld.getPointAt12Oclock(_unit, _offset) return ctld.getPointAtDirection(_unit, _offset, 0) end @@ -2629,16 +2629,15 @@ end function ctld.getPointAtDirection(_unit, _offset, _directionInRadian) ctld.logTrace("_offset = %s", ctld.p(_offset)) - local _randomOffsetX = math.random(ctld.randomCrateSpacing * 2) - ctld.randomCrateSpacing + local _SecureDistanceFromUnit = ctld.getSecureDistanceFromUnit(_unit:getName()) + local _randomOffsetX = math.random(_SecureDistanceFromUnit, ctld.randomCrateSpacing * 2) - ctld.randomCrateSpacing local _randomOffsetZ = math.random(0, ctld.randomCrateSpacing) ctld.logTrace("_randomOffsetX = %s", ctld.p(_randomOffsetX)) ctld.logTrace("_randomOffsetZ = %s", ctld.p(_randomOffsetZ)) local _position = _unit:getPosition() - --local _angle = math.atan2(_position.x.z, _position.x.x) + _directionInRadian local _angle = math.atan(_position.x.z, _position.x.x) + _directionInRadian - local _xOffset = math.cos(_angle) * _offset + _randomOffsetX - local _zOffset = math.sin(_angle) * _offset + _randomOffsetZ - + local _xOffset = math.cos(_angle) * (_offset + _randomOffsetX) + local _zOffset = math.sin(_angle) * (_offset + _randomOffsetZ) local _point = _unit:getPoint() return { x = _point.x + _xOffset, z = _point.z + _zOffset, y = _point.y } end