From 6637c20c5993dfbf1edef410e0deffbd29a1a472 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 23 May 2016 22:06:17 +0200 Subject: [PATCH] Fix the bogus getAirstrikeTarget methods of the nod08 missions They always searched 6 times even after finding a target. Now they also account for SAM sites (like in the previous missions). --- mods/cnc/maps/nod08a/nod08a.lua | 10 ++++++++-- mods/cnc/maps/nod08b/nod08b.lua | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mods/cnc/maps/nod08a/nod08a.lua b/mods/cnc/maps/nod08a/nod08a.lua index 569e80a0b9..0230e77f88 100644 --- a/mods/cnc/maps/nod08a/nod08a.lua +++ b/mods/cnc/maps/nod08a/nod08a.lua @@ -50,12 +50,18 @@ getAirstrikeTarget = function() local target = list[DateTime.GameTime % #list + 1].CenterPosition - if searches < 6 then + local sams = Map.ActorsInCircle(target, WDist.New(8 * 1024), function(actor) + return actor.Type == "sam" end) + + if #sams == 0 then + searches = 0 + return target + elseif searches < 6 then searches = searches + 1 return getAirstrikeTarget() else searches = 0 - return target + return nil end end diff --git a/mods/cnc/maps/nod08b/nod08b.lua b/mods/cnc/maps/nod08b/nod08b.lua index 74fb1b8745..8b280dd5db 100644 --- a/mods/cnc/maps/nod08b/nod08b.lua +++ b/mods/cnc/maps/nod08b/nod08b.lua @@ -51,12 +51,18 @@ getAirstrikeTarget = function() local target = list[DateTime.GameTime % #list + 1].CenterPosition - if searches < 6 then + local sams = Map.ActorsInCircle(target, WDist.New(8 * 1024), function(actor) + return actor.Type == "sam" end) + + if #sams == 0 then + searches = 0 + return target + elseif searches < 6 then searches = searches + 1 return getAirstrikeTarget() else searches = 0 - return target + return nil end end