Merge pull request #7375 from abcdefg30/fixsurvival02
Fix a crash in survival02
This commit is contained in:
@@ -37,13 +37,13 @@ ParaWaves =
|
|||||||
|
|
||||||
IdleHunt = function(unit) Trigger.OnIdle(unit, unit.Hunt) end
|
IdleHunt = function(unit) Trigger.OnIdle(unit, unit.Hunt) end
|
||||||
|
|
||||||
GuardHarvester = function(unit, attacker)
|
GuardHarvester = function(unit, harvester)
|
||||||
if not unit.IsDead then
|
if not unit.IsDead then
|
||||||
unit.Stop()
|
unit.Stop()
|
||||||
|
|
||||||
local start = unit.Location
|
local start = unit.Location
|
||||||
if attacker.Location then
|
if not harvester.IsDead then
|
||||||
unit.AttackMove(attacker.Location)
|
unit.AttackMove(harvester.Location)
|
||||||
else
|
else
|
||||||
unit.Hunt()
|
unit.Hunt()
|
||||||
end
|
end
|
||||||
@@ -305,15 +305,15 @@ SetupSoviets = function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Harvester1.FindResources()
|
Harvester1.FindResources()
|
||||||
Trigger.OnDamaged(Harvester1, function(self, attacker)
|
Trigger.OnDamaged(Harvester1, function()
|
||||||
Utils.Do(HarvGuards, function(unit)
|
Utils.Do(HarvGuards, function(unit)
|
||||||
GuardHarvester(unit, attacker)
|
GuardHarvester(unit, Harvester1)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Harvester2.FindResources()
|
Harvester2.FindResources()
|
||||||
Trigger.OnDamaged(Harvester2, function(self, attacker)
|
Trigger.OnDamaged(Harvester2, function()
|
||||||
Utils.Do(InfantryGuards, function(unit) GuardHarvester(unit, attacker) end)
|
Utils.Do(InfantryGuards, function(unit) GuardHarvester(unit, Harvester2) end)
|
||||||
|
|
||||||
local toBuild = { }
|
local toBuild = { }
|
||||||
for i = 1, 6, 1 do
|
for i = 1, 6, 1 do
|
||||||
@@ -323,7 +323,7 @@ SetupSoviets = function()
|
|||||||
soviets.Build(toBuild, function(units)
|
soviets.Build(toBuild, function(units)
|
||||||
Utils.Do(units, function(unit)
|
Utils.Do(units, function(unit)
|
||||||
InfantryGuards[#InfantryGuards + 1] = unit
|
InfantryGuards[#InfantryGuards + 1] = unit
|
||||||
GuardHarvester(unit, attacker)
|
GuardHarvester(unit, Harvester2)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user