|
|
|
@ -5,6 +5,7 @@ Bastion = ... |
|
|
|
|
|
|
|
|
|
---@class Bastion.ObjectManager |
|
|
|
|
---@field _lists table<string, {list: Bastion.List, cb:fun(Object: WowGameObject): any}> |
|
|
|
|
---@field objects WowGameObject[] |
|
|
|
|
local ObjectManager = {} |
|
|
|
|
ObjectManager.__index = ObjectManager |
|
|
|
|
|
|
|
|
@ -12,6 +13,7 @@ function ObjectManager:New() |
|
|
|
|
---@class Bastion.ObjectManager |
|
|
|
|
local self = setmetatable({}, ObjectManager) |
|
|
|
|
self._lists = {} |
|
|
|
|
self.objects = {} |
|
|
|
|
|
|
|
|
|
self.activeEnemies = Bastion.List:New() |
|
|
|
|
self.afflicted = Bastion.List:New() |
|
|
|
@ -51,6 +53,8 @@ function ObjectManager:ResetLists() |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
function ObjectManager:Reset() |
|
|
|
|
self.objects = {} |
|
|
|
|
|
|
|
|
|
self.activeEnemies:clear() |
|
|
|
|
self.afflicted:clear() |
|
|
|
|
self.critters:clear() |
|
|
|
@ -87,8 +91,8 @@ function ObjectManager:Refresh() |
|
|
|
|
self:Reset() |
|
|
|
|
|
|
|
|
|
local objects = Objects() |
|
|
|
|
|
|
|
|
|
for _, object in pairs(objects) do |
|
|
|
|
table.insert(self.objects, object) |
|
|
|
|
self:EnumLists(object) |
|
|
|
|
local objectType = ObjectType(object) |
|
|
|
|
if ({ [5] = true, [6] = true, [7] = true })[objectType] then |
|
|
|
@ -100,8 +104,7 @@ function ObjectManager:Refresh() |
|
|
|
|
Bastion.UnitManager:SetObject(unit) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
local creatureType = ObjectCreatureType(object) |
|
|
|
|
if objectType == 5 and creatureType == 8 then |
|
|
|
|
if objectType == 5 and ObjectCreatureType(object) == 8 then |
|
|
|
|
self.critters:push(unit) |
|
|
|
|
elseif unit:GetID() == 204560 then |
|
|
|
|
self.incorporeal:push(unit) |
|
|
|
@ -109,7 +112,7 @@ function ObjectManager:Refresh() |
|
|
|
|
self.afflicted:push(unit) |
|
|
|
|
elseif unit:GetID() == 120651 then |
|
|
|
|
self.explosives:push(unit) |
|
|
|
|
elseif unit:IsPlayer() and (unit:IsInPartyOrRaid() or unit == Bastion.UnitManager["player"]) then |
|
|
|
|
elseif (unit:IsInPartyOrRaid() or unit == Bastion.UnitManager["player"]) then |
|
|
|
|
self.friends:push(unit) |
|
|
|
|
elseif unit:IsEnemy() then |
|
|
|
|
self.enemies:push(unit) |
|
|
|
|