Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion Ionics

Content

Warnings

  1. License not specified
  2. XML script list found
  3. Unknown key 'licence' at https://wiki.alioth.net/img_auth.php/f/f9/Ionics_1.3.1.oxz!manifest.plist

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Ionics aims to enhance the northeast corner of Galaxy 2 with a number of interlocking missions revolving around a rich storyline. Ionics aims to enhance the northeast corner of Galaxy 2 with a number of interlocking missions revolving around a rich storyline.
Identifier oolite.oxp.Galileo.Ionics oolite.oxp.Galileo.Ionics
Title Ionics Ionics
Category Missions Missions
Author Galileo Galileo
Version 1.3.1 1.3.1
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Ionics_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/f/f9/Ionics_1.3.1.oxz n/a
License
File Size n/a
Upload date 1610873518

Documentation

Also read http://wiki.alioth.net/index.php/Ionics

readme.txt

The Ionics OXP
Written by Galileo
Version 1.3.1

------------
The Ionics OXP aims to enhance the northeast corner of Galaxy 2 with a number of interlocking missions revolving around a rich storyline. The OXP also contains 3 new ships available to the player: 
- The Huntsman 
- The Redback 
- The Whitetail 

The organisations featured in the OXP are: 
- The Link, a clandestine organisation that aspires to rid the known Ooniverse of oppressive regimes. 
- The Ramaza Liberation Front, a rebel group opposing the Ramazan government's reign. 
- The Ionics Corporation, an aerospace group based in Zaria.

To start the mission go to Zaria in galaxy 2.

IONICS COOPERATION
------------------
The Ionics Corporation is an aerospace manufacturer founded in [YEAR] in the Zaria system.
The companies first release was a mid-sized attack vessel named the Huntsman, marketed at traders due to it's relatively large cargo hold compared to similarly sized attack vessels. It was quite successful in the nord-east of the 2nd galaxy and second-hand vessels are still quite common in the area. Despite it's local success it is rarely found elsewhere in the ooniverse. Production of the Huntsman ceased in 3081, with the release of a new attack vessel named the Whitetail. The Whitetail featured a sleek, distinctive design, 6 missile slots, and a blistering top speed of 380 LM. It was an instant success and quickly became the vessel of choice for local pirates and bounty hunters. This brought Ionics to the attention of the Zaria government who several years earlier had embarked on a successful attempt to rid the system of criminal activity including piracy and smuggling. Under the systems harsh new piracy laws, the companies directors were arrested on charges of aiding & abetting piracy. With profits from the success of the Whitetail, the company launched a reasonably successful defence to the charges and after 6 weeks of negotiations, Ionics signed an agreement that would forbid their vessels being sold to the general public. Instead the government would would let it's current contract with the [OTHER_CORP] corporation expire and Ionics would become the governments sole supplier of military vessels for a period of 10 years. This partnership turned out to be extremely profitable for Ionics, almost immediately, a new cruise vessel was designed. Named the Redback, it's primary purpose was to lead fleets of Whitetails into battle and provide a mission control centre for the fleets. It was also well equipped for fighting solo, sporting [NICE_FEATURES]
3 years after the contract was signed, war broke out between Zaria and neighbouring system Ramaza. Ionics' strong financial ties to the current government encouraged them to hire weapons experts from every corner of the galaxy and develop several new additions to the Ionics military arsenal. The rapid design and production of missiles, lasers, ECM systems and a new carrier vessel, the Funnelweb, helped Zaria gain a lead in the ensuing battle and an eventual win in [YEAR]. In [YEAR], Ionics' contract was renewed with little change to terms and conditions.
In the year [YEAR], Ionics was dealt a severe blow when rising public anger over the increasingly oppressive piracy laws sparked an violent uprising resulting in the overthrowing of the government and a rewrite of the constitution which excluded Ionics' contract. Ionics entire range was once again released onto the market, but despite a successful marketing plan they have never seen profit margins like those enjoyed in the 14 year stint with the Zaria government.

THE RAMAZA LIBERATION FRONT
---------------------------
The Ramaza Liberation Front, or RLF, was originally formed to oppose the centuries-old dictatorship on the planet Ramaza in Galaxy 2.
The system was originally a Democracy, but devolved to a Dictatorship following a military coup. Since then, the upper echelons of Ramaza's government have been dominated by a military junta. This has lead to long decades of civil unrest as successive governments have taxed the civilian population almost to poverty, ploughing the money into military projects and maintaining immense forces of ground troops, naval assets, aircraft and, more recently, spacecraft. The overly aggressive standpoint of the Ramazaian government has meant that the Galactic Cooperative's Security Council have maintained a constant vigil on the system government's policies, fearing expansionist actions into neighbouring systems. To date, the Ramaza space navy has been restricted to a few hundred ships, supplied by the Ionics Corporation.
Currently, the RLF have made some three hundred representations to the Galactic Cooperative of Worlds for intercession into the on-going struggles between themselves and the current government of Ramaza, but due to its policy of non-intervention in any one system's political, civil or military unrest, GalCop has so far refused to offer any support to them.
Rumours abound that the Ramaza Liberation Front have been courting several outside agencies in their desperation to counter the government's increasingly daunting array of military assets, but only time will tell if these negotiations will come to anything.

THE LINK
--------
The Link is a shadowy, underground organisation that seeks to rid the eight galaxies of oppressive regimes and replace them with more equitable, but not necessarily more benign, leadership. Their origins, leadership and, indeed, the very structure of their organisation remains unknown, but what is known is that they have their own force of ships and the will to use them to further their secretive agenda.


INSTALLATION
------------
To install The Ionics OXP, unzip the package and drag it into your Oolite AddOns folder.

UPGRADING
---------
If you are upgrading to a new version of The Ionics OXP, delete the old folder when installing this one.


CHANGELOG
---------
v 1.3.1
* Added a 'null' parameter to mission.setInstructionsKey()

v 1.3
* Translated the main legacy script to Java Script.
* The main script is no longer evaluated when the mission has ended. This avoids the waste of cpu time with useless checks after mission ending.
* Raised minimum Oolite to 1.74.1
* During the Ramazan war, ships are no longer spawned near the station, but launch from it.
* Used some new AI commands to simplify several AI scripts.

v 1.2.5
* Changed back the system name: Cevara --> Cevera. The name in the text was not wrong but the oxp accidently changed the system name itself in a wrong way.
* Three systems were defined with much bigger nebula than default. No problem, but when also system_redux was installed the sky colouring was overdone because system_redux strongly increases the number of nebula. Those three systems now have the default nebula count explicit defined so the sky looks again as original intended.

v 1.2.4
* Changed old typo in system name: Cevera --> Cevara.

v 1.2.3
* Changed all line endings in the script.plist. Was mac style and generated errors with Windows.

v 1.2.2
* Added mission offering compatibility. Should not longer collide with other oxp offerings.
* Added mission destinations on the galactic charts.
* Changed many internal names to less common names to avoid name conflicts. (preceded most names with: ionics)
* Changed some AI files.
* Restructured the mission code for better performance.
* Added pilots to some ships.

v 1.2.1 (Versions 1.2.1 and newer updated by Eric Walch)
* New texture for the Huntsman
* Bugfix: Don't require ACCEPT_OFFER_1 as condition at Zaria
* Make some sort of weapons platform for use in the battle (fire plasma, missiles, etc.)
* Rearranged Ramazan war and improved AI.

For more information, see http://wiki.alioth.net/index.php/Ionics_OXP


ROADMAP FOR VERSION 2.0
-----------------------
* Calculate kills by player
* Setup ranking system for The Link and award medals
* Add Link HQ at Bebege
* Write random mini-missions in sector
* Assassinate dictator mission
* War in Legeara

* Add pictures to mission screens
* Move battle to Link Base 
* Improve spacelane in Zaria etc.
* Improve Funnelweb (ballturrets, docking bay, etc.)
* Improve the Link Base (cladding, turrets, lights, warning messages, etc.)

Comment by Eric: the 2.0 roadmap was formulated in 2006 by Galileo. Galileo seams to have abandoned this oxp since, so a version 2.0 is not likely to happen unless someone else wants to write further on the story.

Equipment

This expansion declares no equipment. This may be related to warnings.

Ships

Name
Ionics Huntsman
Ball Turret
Ionics Funnelweb
Ionics Huntsman
Ionics Huntsman
Link Vessel
The Link Base
ionics_link_base_defender
Ionics Redback
ionics_redback-trader
ionics_redback_mission
RLF Vessel
RLF Fighter
RLF Fighter
RLF Leader
Ionics Whitetail
ionics_whitetail_mission
ionics_whitetail_mission_escort
Ionics CR150 Weapons Platform
Ramazan Government Redback
Ramazan Government Whitetail
Ionics Redback
Ionics Whitetail

Models

This expansion declares no models. This may be related to warnings.

Scripts

Path
Scripts/ionics_RLF_vessel.js
this.name      = "ionics_RLF_vessel"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 eric walch."; 
this.description = "Ramazan_rebel-liberation-front_vessel"; 
this.version   = "1.0";

this.shipDied = function() {
    missionVariables.ionics_rlf_fleet_size--;
};

this.shipLaunchedEscapePod = function () {
    // change role to exclude it from the count of active ships.
    this.ship.primaryRole = "derelict";
}
Scripts/ionics_funnelweb.js
this.name      = "ionics_funnelweb"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 eric walch."; 
this.description = "ionics_funnelweb used in mission"; 
this.version   = "1.0";

this.shipDied = function() {
    missionVariables.ionics = "MISSION_SUCCESSFUL";
    player.consoleMessage(expandDescription("Congratulations [commander_name]! You head back to Ramaza, we'll take it from here."), 10);
    mission.unmarkSystem(251);
    mission.markSystem(26);
    mission.setInstructionsKey("ionics_short_desc4", "ionics_v_rlf")
};
Scripts/ionics_government_vessel.js
this.name      = "ionics_government_vessel"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 eric walch."; 
this.description = "Ramazan_government_vessel"; 
this.version   = "1.0";

this.shipDied = function (ship) {
    missionVariables.ionics_government_fleet_size--;
    if (ship.isPlayer) missionVariables.ionics_government_kills++;
};

this.shipLaunchedEscapePod = function () {
    // change role to exclude it from the count of active ships.
    this.ship.primaryRole = "derelict";
    this.ship.group = null;
}
Scripts/ionics_link_vessel.js
this.name      = "ionics_link_vessel"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 eric walch."; 
this.description = "Ramazan_link_vessel"; 
this.version   = "1.0";

this.shipDied = function() {
    missionVariables.ionics_link_fleet_size--;
};

this.shipLaunchedEscapePod = function () {
    // change role to exclude it from the count of active ships.
    this.ship.primaryRole = "derelict";
    this.ship.group = null;
}
Scripts/ionics_main.js
this.name        = "ionics_v_rlf"; 
this.author      = "Galileo, JS translation by Eric Walch"; 
this.description = "Script only used for the ionics mission."; 
this.version     = "1.3.1"; 

this.startUp = function() {
    var end = missionVariables.ionics;
    if (end === "RAMAZA_WAR_OVER" || end === "MISSION_COMPLETE_2B" || end === "MISSION_COMPLETE_3A") {
        // mission is over, no need to evaluate any code anymore.
        delete this.missionScreenOpportunity;
        delete this.shipLaunchedFromStation;
        delete this.shipExitedWitchspace;
    }
};

this.missionScreenOpportunity = function () {
    if (galaxyNumber != 1) return;
    var ionics = missionVariables.ionics;
    if (player.ship.dockedStation.isMainStation) {
        // Side with RLF
        if (system.ID === 251 && !ionics) {
            // Zaria: First visit to Zaria.
            mission.runScreen({title: "Ionics", messageKey: "ionics_zaria_news_1"});
            missionVariables.ionics = "PRE_STAGE1";
            missionVariables.ionics_ramaza_status = "RLF_1";
            return;
        }
        if (system.ID === 26 && ionics === "PRE_STAGE1") {
            // Ramaza: First orders.
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_1", choicesKey: "ionics_question_1"
            },
            function (choice) {
                if (choice === "ACCEPT_OFFER_1") {
                    missionVariables.ionics = "STAGE1";
                    mission.setInstructionsKey("ionics_short_desc1");
                    mission.markSystem(251);
                }
                if (choice === "REJECT_OFFER_1") {
                    missionVariables.ionics = "MISSION_COMPLETE_1";
                }
            });
        }
        if (system.ID === 251 && ionics === "STAGE1") {
            // Zaria: Collected package.
            mission.unmarkSystem(251);
            player.credits += 500;
            missionVariables.ionics = "STAGE2A";
            mission.setInstructionsKey("ionics_short_desc2a");
            mission.markSystem(26);
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_2a"});
        }
        if (system.ID === 26 && ionics === "STAGE2A") {
            // Ramaza: Package delivered. RLF make offer to destroy fleet.
            mission.unmarkSystem(26);
            player.credits += 500;
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_3a", choicesKey: "ionics_question_3"
            },
            function (choice) {
                if (choice === "ACCEPT_OFFER_3A") {
                    // Ramaza: Accept offer to destroy fleet.
                    missionVariables.ionics = "STAGE3A";
                    mission.setInstructionsKey("ionics_short_desc3a");
                    mission.markSystem(251);
                }
                if (choice === "REJECT_OFFER_3A") {
                    // Ramaza: Rejected offer to destroy fleet. Missions end completely.
                    missionVariables.ionics = "MISSION_COMPLETE_3A";
                }
            });
        }
        if (system.ID === 251 && ionics === "MISSION_SUCCESSFUL") {
            // Zaria: Ionics fleet destroyed, refuelling for trip back to Ramaza.
            missionVariables.ionics = "ZARIA_NEWS_2";
            mission.runScreen({title: "Ionics", messageKey: "ionics_zaria_news_2"});
            mission.setInstructionsKey("ionics_short_desc4");
        }
        if (system.ID === 26 && (ionics === "MISSION_SUCCESSFUL" || ionics === "ZARIA_NEWS_2")) {
            // Ramaza: Ionics fleet destroyed, RLF makes payment.
            missionVariables.ionics = "MISSION_COMPLETE_A";
            player.credits += 15000;
            mission.unmarkSystem(26);
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_4a"});
            mission.setInstructionsKey(null);
        }
        if (system.ID === 251 && ionics === "MISSION_COMPLETE_A") {
            // Zaria: The Link becomes involved.
            missionVariables.ionics = "ZARIA_NEWS_3";
            missionVariables.ionics_ramaza_status = "RLF_2";
            mission.runScreen({title: "Ionics", messageKey: "ionics_zaria_news_3"});
        }
        if (system.ID === 198 && ionics === "STAGE5") {
            // Cevera: Pick up equipment.
            missionVariables.ionics = "STAGE6";
            missionVariables.ionics_ramaza_status = "RLF_2";
            mission.unmarkSystem(198);
            mission.markSystem(26);
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_6"});
            mission.setInstructionsKey("ionics_short_desc6");
        }
        if (system.ID === 251 && ionics === "MISSION_COMPLETE_1") {
            // Zaria: Ionics makes offer.
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_2b", choicesKey: "ionics_question_2b"
            },
            function (choice) {
                if (choice === "ACCEPT_OFFER_2B") {
                    // Zaria: Accept Ionics offer.
                    missionVariables.ionics = "STAGE2B";
                    mission.setInstructionsKey("ionics_short_desc2b");
                    mission.markSystem(26);
                }
                if (choice === "REJECT_OFFER_2B") {
                    // Zaria: Rejected Ionics offer. Missions end completely.
                    missionVariables.ionics = "MISSION_COMPLETE_2B";
                }
            });
        }
        if (system.ID === 26 && ionics === "STAGE2B") {
            // Ramaza: RLF infiltrated.
            missionVariables.ionics = "STAGE3B";
            mission.unmarkSystem(26);
            mission.markSystem(251);
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_3b"});
            mission.setInstructionsKey("ionics_short_desc3b");
        }
        if (system.ID === 251 && ionics === "STAGE3B") {
            // Zaria: RLF infiltrated. Ionics makes payment.
            missionVariables.ionics = "MISSION_COMPLETE_B";
            mission.unmarkSystem(251);
            player.credits += 1500;
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_4b"});
            mission.setInstructionsKey(null);
        }
        if (system.ID === 26 && ionics === "WAR_IN_RAMAZA") {
            // Ramaza: war going on.
            var display_stats = this.ionics_display_stats;
            if (display_stats === "REJECT") {
                // Ramaza: war going on, launch player.*
                this.ionics_display_stats = false;
                player.ship.launch();
                return;
            }
            if (display_stats && missionVariables.ionics_government_kills > 25) {
                // Ramaza: war going on warn player.
                mission.runScreen({title: "Ionics", messageKey: "ionics_war_ramaza"});
                this.ionics_display_stats = "REJECT";
            }
        }
    }
    if (player.ship.dockedStation.name === "The Link Base") {
        // Player docked at the link base. Always in Ramaza (system.ID = 26)
        function firstVisit(choice) {
            // Handles the choices of next check
            switch(choice) {
                case "WHAT_IS_THE_LINK":{
                    // Ramaza: answer question about The Link.
                    mission.runScreen({title: "Ionics", messageKey: "ionics_answer_1", choicesKey: "ionics_question_5"}, firstVisit);
                    break;
                }
                case "ACCEPT_OFFER_4": {
                    // Ramaza: accept mission.
                    missionVariables.ionics = "STAGE5";
                    mission.markSystem(198);
                    mission.setInstructionsKey("ionics_short_desc5");
                    break;
                }
                case "REJECT_OFFER_4": {
                    // Ramaza: reject mission. END.
                    missionVariables.ionics = "MISSION_REJECTED_STAGE5";
                    break;
                }
            }
        }
        if (ionics === "ZARIA_NEWS_3") {
        // Ramaza: First time docked at The Link base.
        mission.runScreen({title: "Ionics", messageKey: "ionics_order_5", choicesKey: "ionics_question_4"}, firstVisit);
        }
        if (ionics === "STAGE6") {
            // Ramaza: Second docking, admitted to The Link.
            mission.runScreen({title: "Ionics", messageKey: "ionics_order_7"});
            mission.markSystem(26);
            // Ramaza: Setup war in Ramaza.
            missionVariables.ionics = "WAR_IN_RAMAZA";
            mission.setInstructionsKey("ionics_short_desc7");
            missionVariables.ionics_government_fleet_size = 200; 
            missionVariables.ionics_link_fleet_size = 100; 
            missionVariables.ionics_rlf_fleet_size = 50; 
            this.ionics_display_stats = false;
            missionVariables.ionics_ramaza_status = "RLF_3";
            missionVariables.ionics_government_kills = 0;
        }
        if (ionics === "WAR_IN_RAMAZA" && this.ionics_display_stats) {
            // Ramaza: Docked at Link Base, free refuel and display war progress.
            mission.runScreen({title: "Ionics", messageKey: "ionics_war_progress"});
            this.ionics_display_stats = false;
            player.ship.fuel = 7;
            var emptySlots = player.ship.missileCapacity - player.ship.missiles.length;
            for (var i=0; i<emptySlots; i++) {player.ship.awardEquipment("EQ_MISSILE")};
            var missileText = emptySlots ? ("and " + emptySlots + " missile silo(s) ") : "";
            var legalStatus = player.bounty ? " and your legal status has been cleaned" : "";
            player.bounty = 0;
            mission.addMessageText("Your fuel tanks " + missileText + "have been replenished" + legalStatus + ".");
            this.validatePosition(system.shipsWithPrimaryRole("ramazan_government_vessel"));
        }
        if (ionics === "WAR_IN_RAMAZA_VICTORY") {
            // Ramaza: Docked at Link Base, war is won.
            mission.runScreen({title: "Ionics", messageKey: "ionics_ramaza_victory"});
            missionVariables.ionics = "RAMAZA_WAR_OVER";
            missionVariables.ionics_ramaza_status = "LIBERATED";
            player.bounty = 0;
            mission.unmarkSystem(26);
            mission.setInstructionsKey(null);
            // remove no longer used variables
            delete missionVariables.ionics_government_fleet_size; 
            delete missionVariables.ionics_link_fleet_size; 
            delete missionVariables.ionics_rlf_fleet_size;
            delete missionVariables.ionics_government_kills;
        }
    }
};

this.shipLaunchedFromStation = function () {
    // reset display for mission.
    if (galaxyNumber === 1 && system.ID === 26 && missionVariables.ionics === "WAR_IN_RAMAZA" && !this.warTimer) {
        // this.warTimer is undefined when loading a gaved game. In all other cases we already entered through witchspace.
        this.startWar();
    }
};


this.shipExitedWitchspace = function() {
    if (galaxyNumber !== 1) return;

    var ionics = missionVariables.ionics;    
    if (system.ID === 26 && ionics === "STAGE2A" && Math.random() < 0.5) {
        // Ramaza: Delivering package, Ionics assassin strikes (maybe).
        var redback = system.addShips("redback", 1, [0, 0, 1500]);
        redback[0].commsMessage("Die rebel scum!");
    }
    if (system.ID === 251 && ionics === "STAGE3A") {
        // Zaria: Setup Ionics fleet delivery battle.
        var funnelweb = system.addShips("funnelweb_mission", 1, [0, 0, 10000], 5E3)[0];
        var redback = system.addShips("redback_mission", 2, [0, 0, 9500], 5E3);
        var whitetail = system.addShips("whitetail_mission", 4, [0, 0, 9250], 5E3);
        system.addShips("rlf_leader", 1, [0, 0, 2000], 5E3);
        system.addGroup("rlf_fighter", 4, [0, 0, 2500], 5E3);
        if (!funnelweb.group) funnelweb.group = new ShipGroup("Weapon Transport");
        funnelweb.group.addShip(funnelweb);
        for (var i=0; i<redback.length; i++) this.addToGroup(funnelweb.group, redback[i]);
        for (var i=0; i<whitetail.length; i++) this.addToGroup(funnelweb.group, whitetail[i]);
        funnelweb.group.leader = funnelweb;
        // funnelweb.group.name = "Weapon Transport";
        this.sendToPlanet(system.shipsWithPrimaryRole("police"));
    }
    if (system.ID === 26 && ionics === "ZARIA_NEWS_3") {
        // Ramaza: Link sends comms message to commander.
        var message = "Please dock at The Link Base, we urgently require your assistance.";
        if (player.ship.equipmentStatus("EQ_ADVANCED_COMPASS") === "EQUIPMENT_OK") {
            message = message + " The coordinates have been uploaded to your space compass.";
        } else {
            message = message + "You need an advanced space compass for the coordinates.";
        }
        player.commsMessage(message, 10);
    }
    if ((ionics === "STAGE5" || ionics === "STAGE6") && Math.random() < 0.75) {
        // Anywhere: Ramazan government attacks
        var whitetail = system.addShips("whitetail_mission", 4, [0, 0, -1000]);
        whitetail[0].commsMessage("You will pay dearly for your interference Commander!");
    }
    if (system.ID === 26 && missionVariables.ionics === "WAR_IN_RAMAZA") {
        this.startWar();
    }
};

this.validatePosition = function (ships) {
    /*
    This code makes sure that ships that did drift away while fighting, are put back in the battlezone when called.
    This should prevent that the player can't find any ship at all, while new ones are not added.
    */
    for (var i=0; i<ships.length; i++) {
        if (this.battlezone.subtract(ships[i].position).magnitude() > 50E3 && ships[i].AIState == "ATTACK_SHIP") {
            ships[i].position = battlezone.add(Vector3D.random(10E3));
        }
    }
};

this.sendToPlanet = function (ships) {
    /*
    This code sets all ships in the state: HEAD_FOR_PLANET when they have that state.
    This should delay the pressence of regular police that by default start with going to the 
    whichpoint.
    */
    for (var i=0; i<ships.length; i++) ships[i].AIState = "HEAD_FOR_PLANET";
}

this.addToGroup = function (mainGroup, ship) {
    // add ship and possible escorts to group. Main reason is to let Oolite deal with friendly fire.
    if (ship.escortGroup) {
        // there are escorts. (ship is part of escort group)
        for (var i=0; i<ship.escortGroup.count; i++) {
            mainGroup.addShip(ship.escortGroup.ships[i]);
        }
    } else {
        mainGroup.addShip(ship);
    }
    ship.group = mainGroup;
};

this.startWar = function (){
    this.ionics_display_stats = true;
    this.linkStation = system.shipsWithPrimaryRole("ionics_linkbase")[0];
    if (!this.government_vessels) this.government_vessels = new ShipGroup("government vessels");
    if (!this.link_vessels) this.link_vessels = new ShipGroup("link vessels");
    this.rlf_additionPoint = Vector3D(0, 200000, 200000).toCoordinateSystem("wpm");
    this.battlezone = Vector3D(200000, 0, 0).toCoordinateSystem("pwm");
    if (this.warTimer) {
         this.warTimer.start();
    } else {
        this.warTimer = new Timer(this, this.warProgess, 5, 15);
    }
    // missionVariables.ionics_government_kills is added in 1.3.
    // Initialise here in case a player started the mission with the legacy version.
    if (!missionVariables.ionics_government_kills) missionVariables.ionics_government_kills = 0; 
};

this.setupWar = function (){
    // this code was previously in 'planetInfo.plist' for system 26
    system.addShips("asteroid", 20, Vector3D(400E3, 0, 0).toCoordinateSystem("pwm"), 20E3);
    system.addShips("ionics_RLF_vessel", 5, Vector3D(400E3, 0, 0).toCoordinateSystem("pwm"), 1);
    system.addShips("ionics_link_vessel", 5, Vector3D(400E3, 0, 0).toCoordinateSystem("pwm"), 1);
    system.addShips("ionics_linkbase", 1, Vector3D(400E3, 0, 0).toCoordinateSystem("pwm"), 1);

}

// add the next with a timer:
this.warProgess = function() {
    if (system.ID !== 26) {this.warTimer.stop(); return}; // Player jumped out of system.

    if (system.countShipsWithPrimaryRole("ramazan_government_vessel") == 0 && this.government_vessels.count == 0) {
        var fleet = missionVariables.ionics_government_fleet_size;
        if (fleet > 5) fleet = 5;
        for (var i = 0; i<fleet; i++) this.addToGroup(this.government_vessels, system.mainStation.launchShipWithRole("ramazan_government_vessel", true));
    }

    if (system.countShipsWithPrimaryRole("ionics_link_vessel") == 0 && this.link_vessels.count == 0 && this.linkStation && this.linkStation.isValid) {
        var fleet = missionVariables.ionics_link_fleet_size;
        if (fleet > 5) fleet = 5;
        for (var i = 0; i<fleet; i++) this.addToGroup(this.link_vessels, this.linkStation.launchShipWithRole("ionics_link_vessel", true));
    }

    if (system.countShipsWithPrimaryRole("ionics_RLF_vessel") == 0) {
        var fleet = missionVariables.ionics_rlf_fleet_size;
        if (fleet > 5) fleet = 5;
        if (fleet > 0) system.addShips("ionics_RLF_vessel", fleet, this.rlf_additionPoint);
    }
    
    if (missionVariables.ionics_government_fleet_size < 1) {
        missionVariables.ionics = "WAR_IN_RAMAZA_VICTORY";
        player.commsMessage("We've won the war!!! All vessels return to base for debriefing", 10);
        mission.setInstructionsKey("ionics_short_desc8");
        var weaponPlatforms = system.shipsWithPrimaryRole("ionics_weapons_platform");
        for (var i=0; i<weaponPlatforms.length; i++) weaponPlatforms[i].switchAI("nullAI.plist");
        this.warTimer.stop();
        delete this.warTimer;
    }
};
Scripts/ionics_weapons_platform.js
this.name      = "ionics_weapons_platform"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 eric walch."; 
this.description = "Ramazan_government_vessel"; 
this.version   = "1.0";

this.shipSpawned = function () {
    this.ship.primaryRole = "ionics_weapons_platform";
};

this.shipDied = function (ship) {
    if (ship.isPlayer) missionVariables.ionics_government_kills++;
};