Merge pull request #5537 from obrakmann/more-lua-crash-fixes
More lua crash fixes
This commit is contained in:
@@ -43,10 +43,8 @@ end
|
||||
BuildNod1 = function()
|
||||
Production.BuildTeamFromTemplate(nod, Nod1Template, function(team)
|
||||
Team.Do(team, function(actor)
|
||||
if not Actor.IsDead(actor) then
|
||||
Actor.OnIdle(actor, Actor.Hunt)
|
||||
Actor.OnKilled(actor, KillCounter)
|
||||
end
|
||||
Actor.OnIdle(actor, Actor.Hunt)
|
||||
Actor.OnKilled(actor, KillCounter)
|
||||
end)
|
||||
Team.AddEventHandler(team.OnAllKilled, BuildNod1)
|
||||
end)
|
||||
@@ -55,10 +53,8 @@ end
|
||||
BuildAuto1 = function()
|
||||
Production.BuildTeamFromTemplate(nod, Auto1Template, function(team)
|
||||
Team.Do(team, function(actor)
|
||||
if not Actor.IsDead(actor) then
|
||||
Actor.OnIdle(actor, Actor.Hunt)
|
||||
Actor.OnKilled(actor, KillCounter)
|
||||
end
|
||||
Actor.OnIdle(actor, Actor.Hunt)
|
||||
Actor.OnKilled(actor, KillCounter)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -38,11 +38,7 @@ end
|
||||
|
||||
Build = function(template, repeats, func)
|
||||
Production.BuildTeamFromTemplate(nod, template, function(team)
|
||||
Team.Do(team, function(actor)
|
||||
if not Actor.IsDead(actor) then
|
||||
func(actor)
|
||||
end
|
||||
end)
|
||||
Team.Do(team, func)
|
||||
if repeats then
|
||||
Team.AddEventHandler(team.OnAllKilled, function()
|
||||
Build(template, repeats, func)
|
||||
|
||||
@@ -57,7 +57,11 @@ Team.Contains = function(team, actor)
|
||||
end
|
||||
|
||||
Team.Do = function(team, func)
|
||||
Utils.Do(team.Actors, func)
|
||||
Utils.Do(team.Actors, function(actor)
|
||||
if not Actor.IsDead(actor) then
|
||||
func(actor)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Team.Patrol = function(team, waypoints, wait, loop)
|
||||
|
||||
@@ -77,12 +77,10 @@ FollowWaypoints = function(team, waypoints)
|
||||
end
|
||||
|
||||
PlaneExitMap = function(actor, exitPoint)
|
||||
if not Actor.IsDead(actor) then
|
||||
Actor.Stop(actor)
|
||||
Actor.Fly(actor, exitPoint.CenterPosition)
|
||||
Actor.FlyOffMap(actor)
|
||||
Actor.RemoveSelf(actor)
|
||||
end
|
||||
Actor.Stop(actor)
|
||||
Actor.Fly(actor, exitPoint.CenterPosition)
|
||||
Actor.FlyOffMap(actor)
|
||||
Actor.RemoveSelf(actor)
|
||||
end
|
||||
|
||||
BaseRaid = function()
|
||||
@@ -192,10 +190,8 @@ SetupWorld = function()
|
||||
Utils.Do(SovietHarvesters, function(harvester)
|
||||
Actor.OnDamaged(harvester, function(h)
|
||||
Team.Do(harvesterGuard, function(g)
|
||||
if not Actor.IsDead(g) then
|
||||
Actor.Stop(g)
|
||||
Actor.AttackMove(g, h.Location, 3)
|
||||
end
|
||||
Actor.Stop(g)
|
||||
Actor.AttackMove(g, h.Location, 3)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user