~harrison-rt/+junk/jaguar_company

« back to all changes in this revision

Viewing changes to tags/2.0/jaguar_company_2.0.oxp/Scripts/jaguar_company_pilot.js

  • Committer: Richard Harrison
  • Date: 2013-01-19 22:54:57 UTC
  • Revision ID: harrison.rt@gmail.com-20130119225457-ymm3tf03jao7b3lp
Tags: 2.1
* Thargoids and tharglets always returns true in $isHostile check.
* There is a safe zone of 30km around the base.
** NB: The safe zone does not extend to known attackers.
* Took out some ship script event handlers and AI sendScriptMessage functions from the base, buoy, miner and tug ship scripts that is inserted by $addFriendly.
* Fixed colour bug with the tracker. Didn't start off red if the target was behind the player.
* Fixed name error for $performJaguarCompanyAttackTarget in $addFriendly.
* Fixed sun check error if no sun exists.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*jslint indent: 4, maxlen: 120, maxerr: 50, white: true, es5: true, undef: true, bitwise: true, regexp: true,
 
2
newcap: true */
 
3
/*jshint es5: true, undef: true, bitwise: true, eqnull: true, noempty: true, eqeqeq: true, boss: true, loopfunc: true,
 
4
laxbreak: true, strict: true, curly: true */
 
5
/*global randomName, randomInhabitantsDescription, missionVariables, player */
 
6
 
 
7
/* jaguar_company_pilot.js
 
8
 *
 
9
 * Copyright © 2012 Richard Thomas Harrison (Tricky)
 
10
 *
 
11
 * This work is licensed under the Creative Commons
 
12
 * Attribution-Noncommercial-Share Alike 3.0 Unported License.
 
13
 *
 
14
 * To view a copy of this license, visit
 
15
 * http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
 
16
 * to Creative Commons, 171 Second Street, Suite 300, San Francisco,
 
17
 * California, 94105, USA.
 
18
 *
 
19
 * Jaguar Company Pilot script for delivering escape-pods to a station.
 
20
 */
 
21
 
 
22
(function () {
 
23
    "use strict";
 
24
 
 
25
    /* Standard public variables for OXP scripts. */
 
26
    this.name = "jaguar_company_pilot.js";
 
27
    this.author = "Tricky";
 
28
    this.copyright = "© 2012 Richard Thomas Harrison (Tricky)";
 
29
    this.license = "CC BY-NC-SA 3.0";
 
30
    this.description = "Jaguar Company Pilot script for delivering escape-pods to a station.";
 
31
    this.version = "1.0";
 
32
 
 
33
    this.unloadCharacter = function() {
 
34
        var insurance,
 
35
        bonus = 0,
 
36
        message,
 
37
        dockedPersonality = player.ship.dockedStation.entityPersonality,
 
38
        basePersonality = worldScripts["Jaguar Company"].$jaguarCompanyBase.entityPersonality;
 
39
 
 
40
        /* Multiple of 5 Cr for insurance. */
 
41
        insurance = 500 + (Math.floor(Math.random() * 40) * 5);
 
42
        /* Create the message for the arrival report. */
 
43
        message = "For rescuing " + randomName() + " " + randomName() +
 
44
            ", a " + randomInhabitantsDescription(false) +
 
45
            " and member of Jaguar Company, their insurance pays " + insurance + " ₢.";
 
46
 
 
47
        if (dockedPersonality === basePersonality) {
 
48
            /* Give a bonus for bringing the pilot back to one of their base's. Multiple of 5Cr. */
 
49
            bonus = 100 + (Math.floor(Math.random() * 20) * 5);
 
50
            message += " Jaguar Company has also added a bonus of " + bonus + " ₢ for bringing back the pilot.";
 
51
        }
 
52
 
 
53
        /* Add on the insurance and bonus to the player's credits. */
 
54
        player.credits += (insurance + bonus);
 
55
        /* Increase the reputation of the player with Jaguar Company *after* launching.
 
56
         * You don't want to be in the base when it swaps roles.
 
57
         */
 
58
        missionVariables.jaguar_company_reputation_post_launch += 5;
 
59
 
 
60
        player.addMessageToArrivalReport(expandDescription(message));
 
61
    };
 
62
}).call(this);