Back to Index Page generated: Nov 12, 2024, 11:02:04 PM

Expansion Lave Initial Shipyard

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Makes sure there is an Adder and Cobra Mk I for sale when starting a new game at Lave. Makes sure there is an Adder and Cobra Mk I for sale when starting a new game at Lave.
Identifier oolite.oxp.phkb.LaveInitialShipyard oolite.oxp.phkb.LaveInitialShipyard
Title Lave Initial Shipyard Lave Initial Shipyard
Category Miscellaneous Miscellaneous
Author phkb phkb
Version 1.0 1.0
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://aegidian.org/bb/viewtopic.php?f=3&t=20768&p=273274&hilit=LaveInitialShipyard.oxz#p273274 n/a
Download URL https://wiki.alioth.net/img_auth.php/6/62/LaveInitialShipyard.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1700601511

Documentation

Also read http://wiki.alioth.net/index.php/Lave%20Initial%20Shipyard

Equipment

This expansion declares no equipment.

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Config/script.js
"use strict";
this.name = "LaveInitialShipyard";
this.author = "phkb";
this.copyright = "2020 phkb";
this.description = "Makes sure Lave has a Cobra Mk I and an Adder for sale when the game starts.";
this.licence = "CC BY-NC-SA 4.0";

//-------------------------------------------------------------------------------------------------------------
this.startUpComplete = function () {
    // only do this if we're in Lave, and the clock has just started.
    if (galaxyNumber == 0 && system.ID == 7 && clock.daysComponent == 2084004 && clock.hoursComponent == 20 && clock.minutesComponent == 13) {
        var bAdder = false;
        var bCobra = false;
        if (system.mainStation.shipyard && system.mainStation.shipyard.length > 0) {
            var sy = system.mainStation.shipyard;
            // are the default ships in the shipyard already?
            for (var i = 0; i < sy.length; i++) {
                if (sy[i].shipdata_key == "adder-player" && sy[i].price == 65000) bAdder = true;
                if (sy[i].shipdata_key == "cobramk1-player" && sy[i].price == 101100) bCobra = true;
            }
        }
        if (bAdder == false) {
            var keyList = ["adder-player", "griff_adder-PLAYER"];
            var idx = 0;
            var done = false;
            do {
                if (Ship.shipDataForKey(keyList[idx]).roles == "player") {
                    system.mainStation.addShipToShipyard({
                        short_description: "Adder: Standard customer model. Price 65 000 ₢.",
                        shipdata_key: keyList[idx],
                        price: 65000,
                        personality: Math.floor(Math.random() * 32768),
                        extras: ["EQ_HEAT_SHIELD"]
                    });
                    done = true;
                } else {
                    idx += 1;
                }
            } while (done == false && idx < keyList.length);
        }
        if (bCobra == false) {
            var keyList = ["cobramk1-player", "griff_cobra_Mk1-PLAYER"];
            var idx = 0;
            var done = false;
            do {
                if (Ship.shipDataForKey(keyList[idx]).roles == "player") {
                    system.mainStation.addShipToShipyard({
                        short_description: "Cobra Mark I: Plus Fuel Scoops. Price 101 100 ₢.",
                        shipdata_key: keyList[idx],
                        price: 101100,
                        personality: Math.floor(Math.random() * 32768),
                        extras: ["EQ_FUEL_SCOOPS"]
                    });
                    done = true;
                } else {
                    idx += 1;
                }
            } while (done == false && idx < keyList.length);
        }
    }
    // make sure we don't try this again.
    delete this.startUpComplete;
}