Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-16-2012, 12:37 PM
bolox bolox is offline
Approved Member
 
Join Date: May 2008
Posts: 351
Default

correct- RAF used 'English' miles upto Sept '45 when they converted to Nautical miles (knots), involving the change of every asi

AFAIK headings were usually given as 'vectors' in degrees (10 deg increments)
I THINK this was magnetic.
(there was a second format using 'bearing' and iirc this used the other North, however i may be mixing the 2 up)
need to find reference to this
Reply With Quote
  #2  
Old 04-20-2012, 06:00 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Ok new version to test:
Added Landmarks to the mission, now you get messages like
27 Enemy 15 miles West from Calais at Angels 13, Heading 320
18 Enemy 13 miles South East from New Romney at Angels 8, Heading 0
in the chatbar

To do:
-Add more 'fuzzy' to the messages but at moment i don't know how exact the british radar was.
-merge the Airgroups better if they are in 'pulks'.

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using maddox.game;
using maddox.game.world;
using maddox.GP;


public class Mission : AMission
{

    private static string userdocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    private static string CLODO_FILE_PATH = userdocpath + @"\1C SoftClub\il-2 sturmovik cliffs of dover\";
    private static string FILE_PATH = @"missions\RadarTest\Radar.mis"; // adjust to your needs
    private static string MISSION_FILE = CLODO_FILE_PATH + FILE_PATH;

    List<LocalHeadquarters> Headquarters = new List<LocalHeadquarters>{
        {new LocalHeadquarters("Luton (Ash)", "CallSign24", 242928.64, 251773.16, 
            new ObserverStation( "Static0","AN,16","AN,17","AN,18","AN,19","AO,16","AO,17","AO,18","AO,19","AP,16","AP,17","AP,18","AP,19","AQ,16","AQ,17","AQ,18","AQ,19"), //Dover
            new ObserverStation( "Static2","AL,20","AL,21","AL,22","AM,20","AM,21","AM,22","AN,20","AN,21","AN,22","AO,20","AO,21","AO,22"))}, // Dunkirk
        {new LocalHeadquarters("RadPoe (Woodchurch)", "CallSign32", 208162.91, 227726.61, 
            new ObserverStation( "Static1","AJ,15","AJ,16","AJ,17","AJ,18","AK,15","AK,16","AK,17","AK,18","AL,15","AL,16","AL,17","AL,18","AM,15","AM,16","AM,17","AM,18"), //Rye
            new ObserverStation( "Royal Observer Corps I","AK,19","AK,20","AK,21","AL,19","AL,20","AL,21","AM,19","AM,20","AM,21"))}, // fake simulation of Royal Observer Corps, none destructable
        //{new LocalHeadquarters("Forest (Woodchurch)", "CallSign15", 208162.91, 227726.61, new ObserverStation( "Static4","E,1","E,2","E,3"), new ObserverStation( "Static5","F,1","F,2","F,3"))}
    };


    LandMarkHandling LandMarks = new LandMarkHandling(
        new LandMark("Dover", 245577.51, 234521.20),
        new LandMark("Folkestone", 235333.17, 229568.64),
        new LandMark("St.Magarets's at Cliffe", 250423.81, 238001.64),
        new LandMark("Deal", 250985.14, 244801.80),
        new LandMark("Dymchurch", 223734.62, 222437.79),
        new LandMark("New Romney", 220005.71, 218110.40),
        new LandMark("Rye", 205758.66, 213525.22),
        new LandMark("Hastings", 195366.28, 203132.83),
        new LandMark("Eastbourne", 174755.54, 191963.14),
        new LandMark("Brighton", 144909.86, 197927.40),
        new LandMark("Calais", 284654.87, 215707.54)
        );


    Random random = new Random();


    internal class LandMark
    {
        public string LandMarkName { get; set; }
        public Point2d LandMarkPosition { get; set; }

        public LandMark(string landMarkName, double x, double y)
        {
            this.LandMarkName = landMarkName;
            this.LandMarkPosition = new Point2d(x, y);
        }
    }


    internal class LandMarkHandling
    {
        List<LandMark> LandMarkList = new List<LandMark>();

        public LandMarkHandling(params LandMark[] mark)
        {
            if (mark != null)
                LandMarkList.AddRange(mark);
        }


        public LandMark getNearestLandMarkTo(Point3d position)
        {

            if (!(LandMarkList.Count > 0))
                return null;

            LandMark NearestLandMark = null;
            Point2d currentPosition = new Point2d(position.x, position.y);

            LandMarkList.ForEach(item =>
            {
                if (NearestLandMark != null)
                {
                    if (NearestLandMark.LandMarkPosition.distance(ref currentPosition) > item.LandMarkPosition.distance(ref currentPosition))
                        NearestLandMark = item;
                }
                else NearestLandMark = item;
            });

            return NearestLandMark;
        }
    }


    private List<string> getRadarCreationStrings(string filename)
    {
        List<string> list = new List<string>();
        
        if (!File.Exists(filename))
            GamePlay.gpLogServer(new Player[] { GamePlay.gpPlayer() }, "Missionfile {0} not found! Please check settings", new object[] { FILE_PATH });

        using (StreamReader reader = new StreamReader(filename))
        {
            string line;
            while ((line = reader.ReadLine()) != null)
            {
                if (line.Contains("Stationary.Radar"))
                {
                    list.Add(line);
                }
            }
        }
        return list;
    }

    
    private ISectionFile createRadarTriggers()
    {
        ISectionFile trigger = GamePlay.gpCreateSectionFile();

        List<string> Radarstations = getRadarCreationStrings(MISSION_FILE);

        if (Radarstations.Count > 0)
        {
            int i = 0;
            Radarstations.ForEach(item =>
                {
                    item = item.TrimStart(' ');
                    string[] splittet = item.Split(' ');
                    string keyTr, valueTr;

                    keyTr = "Radar" + string.Format("{0:00}", i) +"Destroyed";
                    valueTr = " TGroundDestroyed 50 " + splittet[3] + " " + splittet[4] + " 100"; //TGroundDestroyedTrigger 50% destroyed in radius 100m
                    trigger.add("Trigger", keyTr, valueTr);

                    Headquarters.ForEach(hq => { hq.AddTriggerToObserver(splittet[0], keyTr); });
                    i++;
                });
        }
        return trigger;
    }


    #region CourseCalculations


    private int ToAngels(double altitude)
    {
        double altAngels = (altitude / 0.3048) / 1000;

        if (altAngels > 1)
            altAngels = Math.Round(altAngels, MidpointRounding.AwayFromZero);
        else
            altAngels = 1;

        return (int)altAngels;
    }


    private int ToMiles(double distance)
    {
        double distanceMiles = 0;
        distanceMiles = Math.Round(((distance / 1609.3426)), 0, MidpointRounding.AwayFromZero);   // distance in Miles

        return (int)distanceMiles;
    }


    private string degreesToWindRose(double degrees)
    {
        String[] directions = { "North", "North East", "East", "South East", "South", "South West", "West", "North West", "North" };
        return directions[(int)Math.Round((((double)degrees % 360) / 45))];
    }

    // to get the correct bearing its nessesary to make a litte enter the matrix operation.
    // the Vector2d.direction() (same as atan2) has 0° at the x-axis and goes counter clockwise, but we need 0° at the y-axis
    // and clockwise direction
    // so to convert it we need 
    // |0 1| |x|   |0*x + 1*y|    |y|
    // |   | | | = |         | =  | |   // ok not very surprising ;)
    // |1 0| |y|   |1*x + 0*y|    |x|

    private double calculateBearingDegree(Vector3d vector)
    {
        Vector2d matVector = new Vector2d(vector.y, vector.x);
        // the value of direction is in rad so we need *180/Pi to get the value in degrees
        return matVector.direction() * 180.0 / Math.PI;
    }


    private double calculateBearingDegree(Vector2d vector)
    {
        Vector2d newVector = new Vector2d(vector.y, vector.x);

        return newVector.direction() * 180.0 / Math.PI;
    }


    private double calculateBearingFromOrigin(Point2d targetLocation, Point2d originLocation)
    {

        double deltaX = targetLocation.x - originLocation.x;
        double deltaY = targetLocation.y - originLocation.y;

        double bearing = Math.Atan2(deltaX, deltaY);
        bearing = bearing * (180.0 / Math.PI); 

        return (bearing > 0.0 ? bearing : (360.0 + bearing));
    }


    private double calculateBearingFromOrigin(Point3d targetLocation, Point3d originLocation)
    {

        double deltaX = targetLocation.x - originLocation.x;
        double deltaY = targetLocation.y - originLocation.y;


        double bearing = Math.Atan2(deltaX, deltaY); 
        bearing = bearing * (180.0 / Math.PI); 

        return (bearing > 0.0 ? bearing : (360.0 + bearing));
    }


    private int getDegreesIn10Step(double degrees)
    {
        degrees = Math.Round((degrees / 10), MidpointRounding.AwayFromZero) * 10;

        return (int) degrees;
    }



    #endregion


    internal class LocalHeadquarters
    {
        public string Name { get; set; }
        public Point2d LocationCoords { get; set; }
        public string Callsign { get; set; }
        private List<ObserverStation> AttachedObservers = new List<ObserverStation>();

        public LocalHeadquarters(string name, string callsign, double x, double y, params ObserverStation[] observerStations)
        {
            this.Name = name;
            this.Callsign = callsign;
            this.LocationCoords = new Point2d(x, y);

            if (observerStations != null)
                AttachedObservers.AddRange(observerStations);
        }


        public bool ObserveSector(string sectorName)
        {

            List<string> AttachedSectors = new List<string>();

            if (AttachedObservers.Count > 0)
            {
                AttachedObservers.ForEach(item =>
                {
                    if (item.IsActive)
                        AttachedSectors.AddRange(item.observedSectors);
                });
            }

            if (AttachedSectors.Exists(item => item.Equals(sectorName)))
                return true;
            else
                return false;
        }

        public List<ObserverStation> GetObservers()
        {

            return AttachedObservers;
        }



        public List<string> GetObservedSectors()
        {
            List<string> sectorList = new List<string>();

            AttachedObservers.ForEach(item =>
                {
                    if (item.IsActive)
                    {
                        item.observedSectors.ForEach(sector =>
                            {
                                if (!sectorList.Exists(newsector => sector == newsector))
                                    sectorList.Add(sector);
                            });
                    };
                });
            return sectorList;
        }


        public List<string> GetLostObservedSectors()
        {

            List<string> sectorList = new List<string>();

            AttachedObservers.ForEach(item =>
            {
                if (!item.IsActive)
                {
                    item.observedSectors.ForEach(sector =>
                    {
                        if (!sectorList.Exists(newsector => sector == newsector))
                            sectorList.Add(sector);
                    });
                };
            });

            if (sectorList.Count > 0)
            {
                List<string> CurrentObservedSectors = GetObservedSectors();

                if (CurrentObservedSectors.Count > 0)
                {
                    CurrentObservedSectors.ForEach(item =>
                        {
                            if (sectorList.Exists(sector => sector == item))
                            {
                                sectorList.RemoveAll(sector => sector == item);
                            }
                        });

                }

            }
            return sectorList;
        }


        public void SetObserverInactive(string triggerName)
        {

            if (AttachedObservers.Exists(item => item.TriggerName == triggerName))
            {
                AttachedObservers[AttachedObservers.FindIndex(item => item.TriggerName == triggerName)].IsActive = false;
            }
        }


        public void AddTriggerToObserver(string staticName, string triggerName)
        {
            if (AttachedObservers.Exists(item => item.StaticName == staticName))
            {
                AttachedObservers[AttachedObservers.FindIndex(item => item.StaticName == staticName)].TriggerName = triggerName;
            }
        }
    }


    internal class ObserverStation
    {
        public bool IsActive { get; set; }
        public string StaticName { get; set; }
        public string TriggerName { get; set; }

        public List<string> observedSectors = new List<string>();

        public ObserverStation(string staticName, params string[] sectorNames)
        {
            this.StaticName = staticName;
            this.IsActive = true;

            if (sectorNames != null)
                observedSectors.AddRange(sectorNames);
        }


        public ObserverStation(string staticName, string triggerName, params string[] sectorNames)
        {
            this.StaticName = staticName;
            this.TriggerName = triggerName;
            this.IsActive = true;

            if (sectorNames != null)
                observedSectors.AddRange(sectorNames);
        }


        public void SetTriggerName(string triggerName)
        {
            this.TriggerName = triggerName;
        }

    }


    internal class Pilot
    {
        public Player player { get; set; }
        public LocalHeadquarters connectedHeadquarter;
        public DateTime TimeStamp { get; set; }

        public Pilot(Player player)
        {
            this.player = player;
        }
    }


    internal List<Pilot> PilotsInGame = new List<Pilot>();


    public void checkSectors(Player player)
    {
 
        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);

            if (PilotsInGame[i].connectedHeadquarter != null)
            {
                if (Headquarters.Exists(hq => hq == PilotsInGame[i].connectedHeadquarter))
                {
                    LocalHeadquarters localHQ = PilotsInGame[i].connectedHeadquarter;

                    AiAirGroup[] EnemyAirgroups = base.GamePlay.gpAirGroups((player.Army() == 1) ? 2 : 1);

                    if (EnemyAirgroups != null)
                    {
                        bool foundEnemy = false;

                        Dictionary<string, int> Messages = new Dictionary<string, int>();

                        foreach (AiAirGroup aag in EnemyAirgroups)
                        {
                            string sectorName = GamePlay.gpSectorName(aag.Pos().x, aag.Pos().y);
                            
                            if (localHQ.ObserveSector(sectorName) && aag.Pos().z > 600.00)
                            {
                                foundEnemy = true;
                                string message ="";

                                Point3d destinationPoint = aag.Pos();
                                LandMark NearestLandMark = LandMarks.getNearestLandMarkTo(aag.Pos());
                                Point2d AirgroupPos = new Point2d(aag.Pos().x, aag.Pos().y);
                                Vector2d AirgroupVector = new Vector2d(aag.Vwld().x, aag.Vwld().y);

                                if (NearestLandMark != null)
                                    message = string.Format("Enemy {0} miles {1} from {2} at Angels {3}, Heading {4}", ToMiles(NearestLandMark.LandMarkPosition.distance(ref AirgroupPos)), degreesToWindRose(calculateBearingFromOrigin(AirgroupPos, NearestLandMark.LandMarkPosition)), NearestLandMark.LandMarkName, ToAngels(aag.Pos().z), getDegreesIn10Step(calculateBearingDegree(AirgroupVector)));
                                else
                                    message = string.Format("Enemy in Sector: {1} heading {2}", sectorName, getDegreesIn10Step(calculateBearingDegree(AirgroupVector)));
                                  
                                int nrOfAircraft;
                                
                                if (Messages.TryGetValue(message, out nrOfAircraft))
                                {
                                    Messages[message] = nrOfAircraft + aag.NOfAirc;
                                }
                                else
                                {
                                    Messages.Add(message, aag.NOfAirc);
                                }
                            }
                        }

                        Timeout(3, () =>
                            {
                                
                                foreach (var msg in Messages)
                                {
                                    GamePlay.gpLogServer(new[] { player }, "{0} {1}", new object[] { msg.Value, msg.Key });
                                }

                                if (localHQ.GetLostObservedSectors().Count > 0)
                                {
                                    string lostSectors = "";

                                    localHQ.GetLostObservedSectors().ForEach(item =>
                                        {
                                            lostSectors += item + " ";
                                        });

                                    lostSectors = lostSectors.TrimEnd(' ');

                                    GamePlay.gpLogServer(null, "Radar blind for Sectors {0}!", new[] { lostSectors });
                                    if (!foundEnemy)
                                        GamePlay.gpLogServer(new[] { player }, "No Enemy in other available Sectors spottet", null);
                                }
                                else if (!foundEnemy)
                                    GamePlay.gpLogServer(new[] { player }, "No Enemy in Range", null);
                            });
                    }
                }
            }
        }
    }


    private void connectToHeadquarterSpeech(AiAircraft aircraft, LocalHeadquarters localHQ)
    {
        double initTime = 0.0;
        
        aircraft.SayToGroup(aircraft.AirGroup(), "Hello_guys");

        Timeout(initTime += 2, () =>
            {
                aircraft.SayToGroup(aircraft.AirGroup(), "This_is");
            });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), localHQ.Callsign);
        });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), "n2"); // to is missing as ogg
        });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), aircraft.CallSign());
        });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), "leader__");
        });
    }


    #region mission menus

    #region class Menu

    internal class Menu
    {
        internal class MenuEntry
        {
            internal string MenuName { get; set; }
            internal bool active { get; set; }
        }

        internal List<MenuEntry> menuEntries = new List<MenuEntry>();

        public void AddMenuEntry(string description, bool active)
        {
            MenuEntry NewMenuEntry = new MenuEntry();

            NewMenuEntry.MenuName = description;
            NewMenuEntry.active = active;

            menuEntries.Add(NewMenuEntry);
        }

        public string[] GetMenuDescriptions()
        {
            List<string> Descriptions = new List<string>();

            menuEntries.ForEach(item =>
            {
                Descriptions.Add(item.MenuName);
            });

            return Descriptions.ToArray();
        }

        public bool[] GetActives()
        {
            List<bool> Actives = new List<bool>();

            menuEntries.ForEach(item =>
            {
                Actives.Add(item.active);
            });

            return Actives.ToArray();
        }

        public bool IsValid()
        {
            if (menuEntries == null || menuEntries.Count < 1)
                return false;
            else
                return true;

        }

    }

    #endregion

    
    public void SetMainMenu(Player player)
    {
        if (player.Army() == 1) // red Side
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Radaroperations" }, new bool[] { true });
        else
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Not Available" }, new bool[] { true });
    }


    public void SetRadarMenu(Player player)
    {
        string headQuarter = "Select Headquarter";
        string connectedTo = "";

        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);

            if (PilotsInGame[i].connectedHeadquarter != null)
                connectedTo = string.Format(" (connected: {0})", PilotsInGame[i].connectedHeadquarter.Name);
        }
        headQuarter += connectedTo;

        GamePlay.gpSetOrderMissionMenu(player, true, 100, new string[] { headQuarter, "Get Radar Information" }, new bool[] { true, true });

    }


    public void SetConnectToHeadquarterMenu(Player player)
    {
        Menu NewMenu = new Menu();
        LocalHeadquarters headQuarter = null;

        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);
            headQuarter = PilotsInGame[i].connectedHeadquarter;
        }

        Headquarters.ForEach(item =>
        {
            if (headQuarter != null && item == headQuarter)
            {
                NewMenu.AddMenuEntry(item.Name + " *", true);
            }
            else
                NewMenu.AddMenuEntry(item.Name, true);
        });

        if (NewMenu.IsValid())
            GamePlay.gpSetOrderMissionMenu(player, true, 101, NewMenu.GetMenuDescriptions() , NewMenu.GetActives());
        else
            GamePlay.gpSetOrderMissionMenu(player, true, 101, new string[]{ "Not available" }, new bool[]{true});
    }


    public void SetHeadQuarter(Player player, int menuItemIndex)
    {
        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);
            PilotsInGame[i].connectedHeadquarter = Headquarters[menuItemIndex-1];
            if (player.Place() != null)
                connectToHeadquarterSpeech((player.Place() as AiAircraft), PilotsInGame[i].connectedHeadquarter);
        }

    }


    public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
    {
        if (ID == 0)
        { // main menu
            if (menuItemIndex == 1)
            {
                SetRadarMenu(player);
            }
        }

        if (ID == 100)
        {
            //Radar Menu
            if (menuItemIndex == 1)
            {
                SetConnectToHeadquarterMenu(player);
            }

            if (menuItemIndex == 2)
            {
                checkSectors(player);
                SetMainMenu(player);
            }
            if (menuItemIndex == 0)
                SetMainMenu(player);
        }

        if (ID == 101)
        {
            //Radar Menu
            if (menuItemIndex == 0)
                SetRadarMenu(player);
            else
            {
                SetHeadQuarter(player, menuItemIndex);
                SetRadarMenu(player);
            }
        }
    }

    #endregion


    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        MissionNumberListener = -1;
        GamePlay.gpPostMissionLoad(createRadarTriggers());
    }


    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        if (!PilotsInGame.Exists(item => item.player == player))
        {
            PilotsInGame.Add(new Pilot(player));
        }

        SetMainMenu(player);
    }


    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);
        
        if (shortName.StartsWith("Radar") && shortName.EndsWith("Destroyed"))
        {
            GamePlay.gpLogServer(null, "Radar destroyed", null);

            Headquarters.ForEach(item =>
                {
                    item.SetObserverInactive(shortName);
                });
        }
    }

}
Attached Files
File Type: zip RadarTest.zip (6.8 KB, 57 views)

Last edited by FG28_Kodiak; 04-20-2012 at 08:42 AM.
Reply With Quote
  #3  
Old 04-20-2012, 07:43 AM
csThor csThor is offline
Approved Member
 
Join Date: Oct 2007
Location: somewhere in Germany
Posts: 1,213
Default

I've read something of a 300% inaccuracy but that sounds grossly overstated to me. I do have a suggestion, however, and that pertains to the reported number of planes. IIRC the numbers were never that accurate, mostly it was 10+ or 20+ ... so I wonder if it would be better to use this term (which also adds a bit of insecurity as 10+ can mean 10 or 19) ...
Reply With Quote
  #4  
Old 04-20-2012, 08:21 PM
ATAG_Colander ATAG_Colander is offline
Approved Member
 
Join Date: Jan 2012
Posts: 214
Default

Quote:
Originally Posted by csThor View Post
I've read something of a 300% inaccuracy ...
From what I've read about the Chain Home radar, the altitude was measured comparing the strength of two receivers at different heights in the tower. Because of this, they where measuring angles.

Since the angles where not exact, the altitude error increased with the distance. I think this could be emulated with simple trigonometry using random errors for the angle.

Reply With Quote
  #5  
Old 04-26-2012, 02:03 PM
5./JG27.Farber 5./JG27.Farber is offline
Approved Member
 
Join Date: Aug 2011
Posts: 1,958
Default

Is this the final evolution of the script Kodiak? We are eger to implement it and iron out the wrinkles on our own maps. What about the 4 min delay?

Thanks for this,
Farber.
Reply With Quote
  #6  
Old 04-26-2012, 02:18 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

No its not
Current Version, added routine to merge Airgroups better, to avoid 'splittering' added a short time delay (for testing)
To Do: complete the Radar Mission Menu, hope i finish it this weekend, so the script is usable on servers.
Future: Create a DLL and Configuration via XML-file, so the handling will be easier for missionbuilders.
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using maddox.game;
using maddox.game.world;
using maddox.GP;


public class Mission : AMission
{

    private static string userdocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    private static string CLODO_FILE_PATH = userdocpath + @"\1C SoftClub\il-2 sturmovik cliffs of dover\";
    private static string FILE_PATH = @"missions\RadarTest\Radar.mis"; // adjust to your needs
    private static string MISSION_FILE = CLODO_FILE_PATH + FILE_PATH;

    List<LocalHeadquarters> Headquarters = new List<LocalHeadquarters>{
        {new LocalHeadquarters("Luton (Ash)", "CallSign24", 242928.64, 251773.16, 
            new ObserverStation( "Static0","AN,16","AN,17","AN,18","AN,19","AO,16","AO,17","AO,18","AO,19","AP,16","AP,17","AP,18","AP,19","AQ,16","AQ,17","AQ,18","AQ,19"), //Dover
            new ObserverStation( "Static2","AL,20","AL,21","AL,22","AM,20","AM,21","AM,22","AN,20","AN,21","AN,22","AO,20","AO,21","AO,22"))}, // Dunkirk
        {new LocalHeadquarters("RadPoe (Woodchurch)", "CallSign32", 208162.91, 227726.61, 
            new ObserverStation( "Static1","AJ,15","AJ,16","AJ,17","AJ,18","AK,15","AK,16","AK,17","AK,18","AL,15","AL,16","AL,17","AL,18","AM,15","AM,16","AM,17","AM,18"), //Rye
            new ObserverStation( "Royal Observer Corps I","AK,19","AK,20","AK,21","AL,19","AL,20","AL,21","AM,19","AM,20","AM,21"))}, // fake simulation of Royal Observer Corps, none destructable
        //{new LocalHeadquarters("Forest (Woodchurch)", "CallSign15", 208162.91, 227726.61, new ObserverStation( "Static4","E,1","E,2","E,3"), new ObserverStation( "Static5","F,1","F,2","F,3"))}
    };


    LandMarkHandling LandMarks = new LandMarkHandling(
        new LandMark("Dover", 245577.51, 234521.20),
        new LandMark("Folkestone", 235333.17, 229568.64),
        new LandMark("St.Magarets's at Cliffe", 250423.81, 238001.64),
        new LandMark("Deal", 250985.14, 244801.80),
        new LandMark("Dymchurch", 223734.62, 222437.79),
        new LandMark("New Romney", 220005.71, 218110.40),
        new LandMark("Rye", 205758.66, 213525.22),
        new LandMark("Hastings", 195366.28, 203132.83),
        new LandMark("Eastbourne", 174755.54, 191963.14),
        new LandMark("Brighton", 144909.86, 197927.40),
        new LandMark("Calais", 284654.87, 215707.54)
        );


    Random random = new Random();


    internal class LandMark
    {
        public string LandMarkName { get; set; }
        public Point2d LandMarkPosition { get; set; }

        public LandMark(string landMarkName, double x, double y)
        {
            this.LandMarkName = landMarkName;
            this.LandMarkPosition = new Point2d(x, y);
        }
    }


    internal class LandMarkHandling
    {
        List<LandMark> LandMarkList = new List<LandMark>();

        public LandMarkHandling(params LandMark[] mark)
        {
            if (mark != null)
                LandMarkList.AddRange(mark);
        }


        public LandMark getNearestLandMarkTo(Point3d position)
        {

            if (!(LandMarkList.Count > 0))
                return null;

            LandMark NearestLandMark = null;
            Point2d currentPosition = new Point2d(position.x, position.y);

            LandMarkList.ForEach(item =>
            {
                if (NearestLandMark != null)
                {
                    if (NearestLandMark.LandMarkPosition.distance(ref currentPosition) > item.LandMarkPosition.distance(ref currentPosition))
                        NearestLandMark = item;
                }
                else NearestLandMark = item;
            });

            return NearestLandMark;
        }
    }


    private List<string> getRadarCreationStrings(string filename)
    {
        List<string> list = new List<string>();
        
        if (!File.Exists(filename))
            GamePlay.gpLogServer(new Player[] { GamePlay.gpPlayer() }, "Missionfile {0} not found! Please check settings", new object[] { FILE_PATH });

        using (StreamReader reader = new StreamReader(filename))
        {
            string line;
            while ((line = reader.ReadLine()) != null)
            {
                if (line.Contains("Stationary.Radar"))
                {
                    list.Add(line);
                }
            }
        }
        return list;
    }

    
    private ISectionFile createRadarTriggers()
    {
        ISectionFile trigger = GamePlay.gpCreateSectionFile();

        List<string> Radarstations = getRadarCreationStrings(MISSION_FILE);

        if (Radarstations.Count > 0)
        {
            int i = 0;
            Radarstations.ForEach(item =>
                {
                    item = item.TrimStart(' ');
                    string[] splittet = item.Split(' ');
                    string keyTr, valueTr;

                    keyTr = "Radar" + string.Format("{0:00}", i) +"Destroyed";
                    valueTr = " TGroundDestroyed 50 " + splittet[3] + " " + splittet[4] + " 100"; //TGroundDestroyedTrigger 50% destroyed in radius 100m
                    trigger.add("Trigger", keyTr, valueTr);

                    Headquarters.ForEach(hq => { hq.AddTriggerToObserver(splittet[0], keyTr); });
                    i++;
                });
        }
        return trigger;
    }


    #region Calculations

    private int ToAngels(double altitude)
    {
        double altAngels = (altitude / 0.3048) / 1000;

        if (altAngels > 1)
            altAngels = Math.Round(altAngels, MidpointRounding.AwayFromZero);
        else
            altAngels = 1;

        return (int)altAngels;
    }


    private int ToMiles(double distance)
    {
        double distanceMiles = 0;
        distanceMiles = Math.Round(((distance / 1609.3426)), 0, MidpointRounding.AwayFromZero);   // distance in Miles

        return (int)distanceMiles;
    }


    private string degreesToWindRose(double degrees)
    {
        String[] directions = { "North", "North East", "East", "South East", "South", "South West", "West", "North West", "North" };
        return directions[(int)Math.Round((((double)degrees % 360) / 45))];
    }

    // to get the correct bearing its nessesary to make a litte enter the matrix operation.
    // the Vector2d.direction() (same as atan2) has 0° at the x-axis and goes counter clockwise, but we need 0° at the y-axis
    // and clockwise direction
    // so to convert it we need 
    // |0 1| |x|   |0*x + 1*y|    |y|
    // |   | | | = |         | =  | |   // ok not very surprising ;)
    // |1 0| |y|   |1*x + 0*y|    |x|

    private double calculateBearingDegree(Vector3d vector)
    {
        Vector2d matVector = new Vector2d(vector.y, vector.x);
        // the value of direction is in rad so we need *180/Pi to get the value in degrees
        return matVector.direction() * 180.0 / Math.PI;
    }


    private double calculateBearingDegree(Vector2d vector)
    {
        Vector2d newVector = new Vector2d(vector.y, vector.x);

        return newVector.direction() * 180.0 / Math.PI;
    }


    private double calculateBearingFromOrigin(Point2d targetLocation, Point2d originLocation)
    {

        double deltaX = targetLocation.x - originLocation.x;
        double deltaY = targetLocation.y - originLocation.y;

        double bearing = Math.Atan2(deltaX, deltaY);
        bearing = bearing * (180.0 / Math.PI); 

        return (bearing > 0.0 ? bearing : (360.0 + bearing));
    }


    private double calculateBearingFromOrigin(Point3d targetLocation, Point3d originLocation)
    {

        double deltaX = targetLocation.x - originLocation.x;
        double deltaY = targetLocation.y - originLocation.y;


        double bearing = Math.Atan2(deltaX, deltaY); 
        bearing = bearing * (180.0 / Math.PI); 

        return (bearing > 0.0 ? bearing : (360.0 + bearing));
    }


    private int getDegreesIn10Step(double degrees)
    {
        degrees = Math.Round((degrees / 10), MidpointRounding.AwayFromZero) * 10;

        if ((int)degrees == 360)
            degrees = 0.0;

        return (int) degrees;
    }

    private int noOfAircraft(int number)
    {
        int firstDecimal = 0;
        int higherDecimal = 0;

        higherDecimal = Math.DivRem(number, 10, out firstDecimal);

        if (firstDecimal > 3 && firstDecimal <= 8)
            firstDecimal = 5;
        else if (firstDecimal > 8)
            higherDecimal += 1;

        if (higherDecimal > 0)
            return (int)higherDecimal * 10;
        else
            return (int)firstDecimal;
    }
    
    #endregion


    internal class LocalHeadquarters
    {
        public string Name { get; set; }
        public Point2d LocationCoords { get; set; }
        public string Callsign { get; set; }
        private List<ObserverStation> AttachedObservers = new List<ObserverStation>();

        public LocalHeadquarters(string name, string callsign, double x, double y, params ObserverStation[] observerStations)
        {
            this.Name = name;
            this.Callsign = callsign;
            this.LocationCoords = new Point2d(x, y);

            if (observerStations != null)
                AttachedObservers.AddRange(observerStations);
        }


        public bool ObserveSector(string sectorName)
        {

            List<string> AttachedSectors = new List<string>();

            if (AttachedObservers.Count > 0)
            {
                AttachedObservers.ForEach(item =>
                {
                    if (item.IsActive)
                        AttachedSectors.AddRange(item.observedSectors);
                });
            }

            if (AttachedSectors.Exists(item => item.Equals(sectorName)))
                return true;
            else
                return false;
        }


        public List<ObserverStation> GetObservers()
        {
            return AttachedObservers;
        }


        public List<string> GetObservedSectors()
        {
            List<string> sectorList = new List<string>();

            AttachedObservers.ForEach(item =>
                {
                    if (item.IsActive)
                    {
                        item.observedSectors.ForEach(sector =>
                            {
                                if (!sectorList.Exists(newsector => sector == newsector))
                                    sectorList.Add(sector);
                            });
                    };
                });
            return sectorList;
        }


        public List<string> GetLostObservedSectors()
        {
            List<string> sectorList = new List<string>();

            AttachedObservers.ForEach(item =>
            {
                if (!item.IsActive)
                {
                    item.observedSectors.ForEach(sector =>
                    {
                        if (!sectorList.Exists(newsector => sector == newsector))
                            sectorList.Add(sector);
                    });
                };
            });

            if (sectorList.Count > 0)
            {
                List<string> CurrentObservedSectors = GetObservedSectors();

                if (CurrentObservedSectors.Count > 0)
                {
                    CurrentObservedSectors.ForEach(item =>
                        {
                            if (sectorList.Exists(sector => sector == item))
                            {
                                sectorList.RemoveAll(sector => sector == item);
                            }
                        });

                }

            }
            return sectorList;
        }

        public void SetObserverInactive(string triggerName)
        {

            if (AttachedObservers.Exists(item => item.TriggerName == triggerName))
            {
                AttachedObservers[AttachedObservers.FindIndex(item => item.TriggerName == triggerName)].IsActive = false;
            }
        }


        public void AddTriggerToObserver(string staticName, string triggerName)
        {
            if (AttachedObservers.Exists(item => item.StaticName == staticName))
            {
                AttachedObservers[AttachedObservers.FindIndex(item => item.StaticName == staticName)].TriggerName = triggerName;
            }
        }


        public double GetDistance(Player player)
        {
            Point2d playerLocation = new Point2d(player.Place().Pos().x, player.Place().Pos().y);

            double distance = LocationCoords.distance(ref playerLocation);

            return distance;
        }

    }

    internal class ObserverStation
    {
        public bool IsActive { get; set; }
        public string StaticName { get; set; }
        public string TriggerName { get; set; }

        public List<string> observedSectors = new List<string>();

        public ObserverStation(string staticName, params string[] sectorNames)
        {
            this.StaticName = staticName;
            this.IsActive = true;

            if (sectorNames != null)
                observedSectors.AddRange(sectorNames);
        }


        public ObserverStation(string staticName, string triggerName, params string[] sectorNames)
        {
            this.StaticName = staticName;
            this.TriggerName = triggerName;
            this.IsActive = true;

            if (sectorNames != null)
                observedSectors.AddRange(sectorNames);
        }


        public void SetTriggerName(string triggerName)
        {
            this.TriggerName = triggerName;
        }

    }


    internal class Pilot
    {
        public Player player { get; set; }
        public LocalHeadquarters connectedHeadquarter;
        public DateTime TimeStamp { get; set; }
        public bool RadarUsed { get; set; }

        public Pilot(Player player)
        {
            this.player = player;
            this.RadarUsed = false;
        }
    }


    internal List<Pilot> PilotsInGame = new List<Pilot>();


    public void checkSectors(Player player)
    {
        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);

            if (PilotsInGame[i].RadarUsed) return;

            PilotsInGame[i].RadarUsed = true;

            if (PilotsInGame[i].connectedHeadquarter != null)
            {
                if (Headquarters.Exists(hq => hq == PilotsInGame[i].connectedHeadquarter))
                {
                    LocalHeadquarters localHQ = PilotsInGame[i].connectedHeadquarter;
                    Dictionary<AiAirGroup, int> planePulks = getPulks(GamePlay.gpAirGroups((player.Army() == 1) ? 2 : 1), 1600.0); //all Airgroups in 1600m radius count as one

                    Dictionary<string, string> Messages = new Dictionary<string, string>();
                    //List<string> Messages = new List<string>();

                    if (planePulks != null && planePulks.Count > 0)
                    {
                        bool foundEnemy = false;

                        foreach (var kvp in planePulks)
                        {
                            string sectorName = GamePlay.gpSectorName(kvp.Key.Pos().x, kvp.Key.Pos().y);

                            if (localHQ.ObserveSector(sectorName) && kvp.Key.Pos().z > 600.00)
                            {
                                foundEnemy = true;
                                string tmpKey = "";
                                string message = "";
                                Point3d destinationPoint = kvp.Key.Pos();
                                LandMark NearestLandMark = LandMarks.getNearestLandMarkTo(kvp.Key.Pos());
                                Point2d AirgroupPos = new Point2d(kvp.Key.Pos().x, kvp.Key.Pos().y);
                                Vector2d AirgroupVector = new Vector2d(kvp.Key.Vwld().x, kvp.Key.Vwld().y);

                                if (kvp.Value > 3) // only if more than 3 planes in a pulk generate a message
                                {
                                    if (NearestLandMark != null)
                                    {
                                        tmpKey = string.Format("Enemy {0} miles {1} from {2} at Angels {3}, Heading {4}", ToMiles(NearestLandMark.LandMarkPosition.distance(ref AirgroupPos)), degreesToWindRose(calculateBearingFromOrigin(AirgroupPos, NearestLandMark.LandMarkPosition)), NearestLandMark.LandMarkName, ToAngels(kvp.Key.Pos().z), getDegreesIn10Step(calculateBearingDegree(AirgroupVector)));
                                        message = string.Format("{0}+ Enemy {1} miles {2} from {3} at Angels {4}, Heading {5}", noOfAircraft(kvp.Value), ToMiles(NearestLandMark.LandMarkPosition.distance(ref AirgroupPos)), degreesToWindRose(calculateBearingFromOrigin(AirgroupPos, NearestLandMark.LandMarkPosition)), NearestLandMark.LandMarkName, ToAngels(kvp.Key.Pos().z), getDegreesIn10Step(calculateBearingDegree(AirgroupVector)));
                                    }
                                    else
                                    {
                                        tmpKey = string.Format("Enemy in Sector: {0} heading {1}", noOfAircraft(kvp.Value), sectorName, getDegreesIn10Step(calculateBearingDegree(AirgroupVector)));
                                        message = string.Format("{0}+ Enemy in Sector: {1} heading {2}", noOfAircraft(kvp.Value), sectorName, getDegreesIn10Step(calculateBearingDegree(AirgroupVector)));
                                    }
                                    if (!Messages.ContainsKey(tmpKey))
                                    {
                                        Messages.Add(tmpKey, message);
                                    }
                                }
                                
                            }
                        }

                        Timeout(3, () =>
                        {
                            GamePlay.gpLogServer(new[] { player }, "From {0}:", new object[]{localHQ.Name });
                            
                            if (Messages.Count > 0)
                                foreach(var kvp in Messages)
                                {
                                        GamePlay.gpLogServer(new[] { player }, kvp.Value, null);
                                };

                            if (localHQ.GetLostObservedSectors().Count > 0)
                            {
                                string lostSectors = "";

                                localHQ.GetLostObservedSectors().ForEach(item =>
                                {
                                    lostSectors += item + " ";
                                });

                                lostSectors = lostSectors.TrimEnd(' ');
                                GamePlay.gpLogServer(null, "Radar blind for Sectors {0}!", new[] { lostSectors });
                                
                                if (!foundEnemy)
                                    GamePlay.gpLogServer(new[] { player }, "No Enemy in other available Sectors spottet", null);
                            }
                            else if (!foundEnemy)
                                GamePlay.gpLogServer(new[] { player }, "No Enemy in Range", null);
                        });
                    }
                }
            }
            Timeout(13.0, () => // delay for next use
                {
                    PilotsInGame[i].RadarUsed = false;
                });
        }
    }


    private Dictionary<AiAirGroup, int> getPulks(AiAirGroup[] airgroups, double maxdistance)
    {
        Dictionary<AiAirGroup, List<AiAirGroup>> Pulks = new Dictionary<AiAirGroup, List<AiAirGroup>>(); 

        if (airgroups != null && airgroups.Length > 1)
        {
            Pulks.Add(airgroups[0], new List<AiAirGroup>());  //leaderGroup //'attached' groups (in radius maxdistance)

            for (int i = 1; i < airgroups.Length; i++)
            {
                bool airgroupAdded = false;
                foreach (var kvp in Pulks)
                {
                    Point3d airgroupPos = kvp.Key.Pos();

                    if (airgroups[i].Pos().distance(ref airgroupPos) < maxdistance)
                    {
                        kvp.Value.Add(airgroups[i]);
                        airgroupAdded = true;
                    }
                }
                if (!airgroupAdded)
                    Pulks.Add(airgroups[i], new List<AiAirGroup>());
            }
        }

        Dictionary<AiAirGroup, int> planePulks = new Dictionary<AiAirGroup, int>();

        foreach (var kvp in Pulks)
        {
            int numberOfPlanes = 0;

            numberOfPlanes += kvp.Key.NOfAirc;

            if (kvp.Value.Count > 0)
                kvp.Value.ForEach(item =>
                    {
                        numberOfPlanes += item.NOfAirc;
                    });

            planePulks.Add(kvp.Key, numberOfPlanes);
        }

        return planePulks;
    }


    private void connectToHeadquarterSpeech(AiAircraft aircraft, LocalHeadquarters localHQ)
    {
        double initTime = 0.0;
        
        aircraft.SayToGroup(aircraft.AirGroup(), "Hello_guys");

        Timeout(initTime += 2, () =>
            {
                aircraft.SayToGroup(aircraft.AirGroup(), "This_is");
            });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), localHQ.Callsign);
        });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), "n2"); // to is missing as ogg
        });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), aircraft.CallSign());
        });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), "leader__");
        });
    }


    #region mission menus

    #region class Menu

    internal class Menu
    {
        internal class MenuEntry
        {
            internal string MenuName { get; set; }
            internal bool active { get; set; }
        }

        internal List<MenuEntry> menuEntries = new List<MenuEntry>();

        public void AddMenuEntry(string description, bool active)
        {
            MenuEntry NewMenuEntry = new MenuEntry();

            NewMenuEntry.MenuName = description;
            NewMenuEntry.active = active;

            menuEntries.Add(NewMenuEntry);
        }

        public string[] GetMenuDescriptions()
        {
            List<string> Descriptions = new List<string>();

            menuEntries.ForEach(item =>
            {
                Descriptions.Add(item.MenuName);
            });

            return Descriptions.ToArray();
        }

        public bool[] GetActives()
        {
            List<bool> Actives = new List<bool>();

            menuEntries.ForEach(item =>
            {
                Actives.Add(item.active);
            });

            return Actives.ToArray();
        }

        public bool IsValid()
        {
            if (menuEntries == null || menuEntries.Count < 1)
                return false;
            else
                return true;

        }

    }

    #endregion

    
    public void SetMainMenu(Player player)
    {
        if (player.Army() == 1) // red Side
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Radaroperations" }, new bool[] { true });
        else
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Not Available" }, new bool[] { true });
    }


    public void SetRadarMenu(Player player)
    {
        string headQuarter = "Select Headquarter";
        string connectedTo = "";

        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);

            if (PilotsInGame[i].connectedHeadquarter != null)
                connectedTo = string.Format(" (connected: {0})", PilotsInGame[i].connectedHeadquarter.Name);
        }
        headQuarter += connectedTo;

        if(PilotsInGame.Exists(item=> item.player == player))
        {
            int i = PilotsInGame.FindIndex(item=> item.player == player);
            if(PilotsInGame[i].RadarUsed)
                GamePlay.gpSetOrderMissionMenu(player, true, 100, new string[] { headQuarter, "Get Radar Information" }, new bool[] { true, false });
            else
                GamePlay.gpSetOrderMissionMenu(player, true, 100, new string[] { headQuarter, "Get Radar Information" }, new bool[] { true, true });
        }
    }


    public void SetConnectToHeadquarterMenu(Player player, double maxdistanceToHq)
    {
        Menu NewMenu = new Menu();
        LocalHeadquarters headQuarter = null;

        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);
            headQuarter = PilotsInGame[i].connectedHeadquarter;
        }

        Headquarters.ForEach(item =>
        {
            if (headQuarter != null && item == headQuarter && item.GetDistance(player) < maxdistanceToHq)
            {
                NewMenu.AddMenuEntry(item.Name + " *", true);
            }
            else
                NewMenu.AddMenuEntry(item.Name, true);
        });

        if (NewMenu.IsValid())
            GamePlay.gpSetOrderMissionMenu(player, true, 101, NewMenu.GetMenuDescriptions() , NewMenu.GetActives());
        else
            GamePlay.gpSetOrderMissionMenu(player, true, 101, new string[]{ "Not available" }, new bool[]{true});
    }


    public void SetHeadQuarter(Player player, int menuItemIndex)
    {
        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);
            PilotsInGame[i].connectedHeadquarter = Headquarters[menuItemIndex-1];
            if (player.Place() != null)
                connectToHeadquarterSpeech((player.Place() as AiAircraft), PilotsInGame[i].connectedHeadquarter);
        }

    }


    public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
    {
        if (ID == 0)
        { // main menu
            if (menuItemIndex == 1)
            {
                SetRadarMenu(player);
            }
        }

        if (ID == 100)
        {
            //Radar Menu
            if (menuItemIndex == 1)
            {
                SetConnectToHeadquarterMenu(player, 50000.0);
            }

            if (menuItemIndex == 2)
            {
                checkSectors(player);
                SetMainMenu(player);
            }
            if (menuItemIndex == 0)
                SetMainMenu(player);
        }

        if (ID == 101)
        {
            //Radar Menu
            if (menuItemIndex == 0)
                SetRadarMenu(player);
            else
            {
                SetHeadQuarter(player, menuItemIndex);
                SetRadarMenu(player);
            }
        }
    }

    #endregion


    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        MissionNumberListener = -1;
        GamePlay.gpPostMissionLoad(createRadarTriggers());
    }


    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        if (!PilotsInGame.Exists(item => item.player == player))
        {
            PilotsInGame.Add(new Pilot(player));
        }

        SetMainMenu(player);
    }


    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);
        
        if (shortName.StartsWith("Radar") && shortName.EndsWith("Destroyed"))
        {
            GamePlay.gpLogServer(null, "Radar destroyed", null);

            Headquarters.ForEach(item =>
                {
                    item.SetObserverInactive(shortName);
                });
        }
    }

}

Last edited by FG28_Kodiak; 04-26-2012 at 02:23 PM.
Reply With Quote
  #7  
Old 04-26-2012, 02:24 PM
5./JG27.Farber 5./JG27.Farber is offline
Approved Member
 
Join Date: Aug 2011
Posts: 1,958
Default

Speedy reply!

You sir, are a credit to the community and our forth coming campaign!

S!
Reply With Quote
  #8  
Old 04-29-2012, 01:57 PM
5./JG27.Farber 5./JG27.Farber is offline
Approved Member
 
Join Date: Aug 2011
Posts: 1,958
Default

What pattern would a radar "emit"?

Which pattern is closets to reality?







Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:15 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.