Permalink
Browse files

Merge remote-tracking branch 'origin/master' into pureint

  • Loading branch information...
2 parents 91d9f09 + 62c8d0e commit 7a1eed932b8f98f48d3226315540cd8824dd6e42 @abma abma committed Sep 15, 2011
Showing with 17 additions and 25 deletions.
  1. +3 −9 data/ai/attackerbehaviour.lua
  2. +7 −6 data/ai/taskqueuebehaviour.lua
  3. +7 −10 data/ai/unit.lua
@@ -16,27 +16,21 @@ function AttackerBehaviour:Init()
end
function AttackerBehaviour:UnitBuilt(unit)
- local unitInternal = unit:Internal()
- local unitID = unitInternal:ID()
- if unitID == self.unit.engineID then
+ if unit.engineID == self.unit.engineID then
self.attacking = false
ai.attackhandler:AddRecruit(self)
end
end
function AttackerBehaviour:UnitDead(unit)
- local unitInternal = unit:Internal()
- local unitID = unitInternal:ID()
- if unitID == self.unit.engineID then
+ if unit.engineID == self.unit.engineID then
ai.attackhandler:RemoveRecruit(self)
end
end
function AttackerBehaviour:UnitIdle(unit)
- local unitInternal = unit:Internal()
- local unitID = unitInternal:ID()
- if unitID == self.unit.engineID then
+ if unit.engineID == self.unit.engineID then
self.attacking = false
ai.attackhandler:AddRecruit(self)
end
@@ -22,7 +22,7 @@ function TaskQueueBehaviour:UnitBuilt(unit)
if not self:IsActive() then
return
end
- if unit:Internal():ID() == self.unit:Internal():ID() then
+ if unit.engineID == self.unit.engineID then
self.progress = true
end
end
@@ -31,7 +31,7 @@ function TaskQueueBehaviour:UnitIdle(unit)
if not self:IsActive() then
return
end
- if unit:Internal():ID() == self.unit:Internal():ID() then
+ if unit.engineID == self.unit.engineID then
self.progress = true
self.countdown = 0
--self.unit:ElectBehaviour()
@@ -40,10 +40,11 @@ end
function TaskQueueBehaviour:UnitDead(unit)
if self.unit ~= nil then
- if unit:Internal():ID() == self.unit:Internal():ID() then
- for k,v in pairs(self.behaviours) do
- ai.modules.sleep.Kill(self.waiting[k])
- self.waiting[k] = nil
+ if unit.engineID == self.unit.engineID then
+ if self.waiting ~= nil then
+ for k,v in pairs(self.waiting) do
+ ai.modules.sleep.Kill(self.waiting[k])
+ end
end
self.waiting = nil
self.unit = nil
View
@@ -49,21 +49,18 @@ function Unit:UnitDead(unit)
for k,v in pairs(self.behaviours) do
v:UnitDead(unit)
end
- if self:Internal() ~= nil then
- local unitInternal = unit:Internal()
- local unitID = unitInternal:ID()
- if unitID == self.engineID then
- if self.behaviours then
- for k,v in pairs(self.behaviours) do
- self.behaviours[k] = nil
- end
- self.behaviours = nil
+ if unit.engineID == self.engineID then
+ if self.behaviours then
+ for k,v in pairs(self.behaviours) do
+ self.behaviours[k] = nil
end
- self.engineUnit = nil
+ self.behaviours = nil
end
+ self.engineUnit = nil
end
end
+
function Unit:UnitDamaged(unit,attacker)
for k,v in pairs(self.behaviours) do
v:UnitDamaged(unit,attacker)

0 comments on commit 7a1eed9

Please sign in to comment.