| 
						
						
						
					 | 
					 | 
					@ -1,3 +1,4 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					---@type Tinkr, Bastion | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local Tinkr, Bastion = ... | 
					 | 
					 | 
					 | 
					local Tinkr, Bastion = ... | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					local ObjectManager = Tinkr.Util.ObjectManager | 
					 | 
					 | 
					 | 
					local ObjectManager = Tinkr.Util.ObjectManager | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -10,19 +11,19 @@ local UnitManager = { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    units = {}, | 
					 | 
					 | 
					 | 
					    units = {}, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    customUnits = {}, | 
					 | 
					 | 
					 | 
					    customUnits = {}, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    objects = {}, | 
					 | 
					 | 
					 | 
					    objects = {}, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cache = {} | 
					 | 
					 | 
					 | 
					    cache = {}, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function UnitManager:__index(k) | 
					 | 
					 | 
					 | 
					function UnitManager:__index(k) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if k == 'none' then | 
					 | 
					 | 
					 | 
					    if k == "none" then | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return self:Get('none') | 
					 | 
					 | 
					 | 
					        return self:Get("none") | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end | 
					 | 
					 | 
					 | 
					    end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if UnitManager[k] then | 
					 | 
					 | 
					 | 
					    if UnitManager[k] then | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return UnitManager[k] | 
					 | 
					 | 
					 | 
					        return UnitManager[k] | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end | 
					 | 
					 | 
					 | 
					    end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    local k = k or 'none' | 
					 | 
					 | 
					 | 
					    local k = k or "none" | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    -- if custom unit exists, return it it's cache expired return a new one | 
					 | 
					 | 
					 | 
					    -- if custom unit exists, return it it's cache expired return a new one | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if self.customUnits[k] then | 
					 | 
					 | 
					 | 
					    if self.customUnits[k] then | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -52,7 +53,7 @@ function UnitManager:__index(k) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end | 
					 | 
					 | 
					 | 
					        end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end | 
					 | 
					 | 
					 | 
					    end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return self.objects['none'] | 
					 | 
					 | 
					 | 
					    return self.objects["none"] | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end | 
					 | 
					 | 
					 | 
					end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					-- Constructor | 
					 | 
					 | 
					 | 
					-- Constructor | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -65,7 +66,6 @@ function UnitManager:New() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return self | 
					 | 
					 | 
					 | 
					    return self | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end | 
					 | 
					 | 
					 | 
					end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					-- Get or create a unit | 
					 | 
					 | 
					 | 
					-- Get or create a unit | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					---@param token string | 
					 | 
					 | 
					 | 
					---@param token string | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					---@return Unit | 
					 | 
					 | 
					 | 
					---@return Unit | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -77,8 +77,8 @@ function UnitManager:Get(token) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    local tguid = ObjectGUID(token) | 
					 | 
					 | 
					 | 
					    local tguid = ObjectGUID(token) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if tguid and self.objects[tguid] == nil then | 
					 | 
					 | 
					 | 
					    if tguid and self.objects[tguid] == nil then | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if token == 'none' then | 
					 | 
					 | 
					 | 
					        if token == "none" then | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            self.objects['none'] = Unit:New() | 
					 | 
					 | 
					 | 
					            self.objects["none"] = Unit:New() | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        else | 
					 | 
					 | 
					 | 
					        else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            self.objects[tguid] = Unit:New(Object(tguid)) | 
					 | 
					 | 
					 | 
					            self.objects[tguid] = Unit:New(Object(tguid)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        end | 
					 | 
					 | 
					 | 
					        end | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -88,8 +88,8 @@ function UnitManager:Get(token) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        local tguid = ObjectGUID(token) or "none" | 
					 | 
					 | 
					 | 
					        local tguid = ObjectGUID(token) or "none" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if self.objects[tguid] == nil then | 
					 | 
					 | 
					 | 
					        if self.objects[tguid] == nil then | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if token == 'none' then | 
					 | 
					 | 
					 | 
					            if token == "none" then | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                self.objects['none'] = Unit:New() | 
					 | 
					 | 
					 | 
					                self.objects["none"] = Unit:New() | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            else | 
					 | 
					 | 
					 | 
					            else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                self.objects[tguid] = Unit:New(Object(tguid)) | 
					 | 
					 | 
					 | 
					                self.objects[tguid] = Unit:New(Object(tguid)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            end | 
					 | 
					 | 
					 | 
					            end | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -127,7 +127,7 @@ function UnitManager:CreateCustomUnit(token, cb) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if self.customUnits[token] == nil then | 
					 | 
					 | 
					 | 
					    if self.customUnits[token] == nil then | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        self.customUnits[token] = { | 
					 | 
					 | 
					 | 
					        self.customUnits[token] = { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            unit = cachedUnit, | 
					 | 
					 | 
					 | 
					            unit = cachedUnit, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            cb = cb | 
					 | 
					 | 
					 | 
					            cb = cb, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end | 
					 | 
					 | 
					 | 
					    end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -303,15 +303,7 @@ function UnitManager:FindFriendsCentroid(radius, range) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return unit:GetPosition() | 
					 | 
					 | 
					 | 
					        return unit:GetPosition() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end | 
					 | 
					 | 
					 | 
					    end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    local _, _, z = TraceLine( | 
					 | 
					 | 
					 | 
					    local _, _, z = TraceLine(centroid.x, centroid.y, centroid.z + 5, centroid.x, centroid.y, centroid.z - 5, 0x100151) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.x, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.y, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.z + 5, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.x, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.y, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.z - 5, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        0x100151 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    centroid.z = z + 0.01 | 
					 | 
					 | 
					 | 
					    centroid.z = z + 0.01 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -342,15 +334,7 @@ function UnitManager:FindEnemiesCentroid(radius, range) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return unit:GetPosition() | 
					 | 
					 | 
					 | 
					        return unit:GetPosition() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end | 
					 | 
					 | 
					 | 
					    end | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    local _, _, z = TraceLine( | 
					 | 
					 | 
					 | 
					    local _, _, z = TraceLine(centroid.x, centroid.y, centroid.z + 5, centroid.x, centroid.y, centroid.z - 5, 0x100151) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.x, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.y, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.z + 5, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.x, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.y, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        centroid.z - 5, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        0x100151 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    centroid.z = z + 0.01 | 
					 | 
					 | 
					 | 
					    centroid.z = z + 0.01 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |